add-fish-alias
Use when creating a new fish shell alias, function, or command shortcut, or when user asks to "add an alias for X"
When & Why to Use This Skill
This Claude skill automates the creation and management of Fish shell aliases and functions within a structured dotfile environment. It streamlines terminal productivity by generating correctly formatted Fish function files that include advanced features like tab-completion inheritance, argument passing, and interactive prompts, ensuring a consistent and efficient command-line experience.
Use Cases
- Command Simplification: Quickly create short aliases for long or complex terminal commands (e.g., mapping 'g' to 'git') while maintaining full tab-completion support.
- Automated Tool Setup: Build shell wrappers that check for the existence of a command and offer to install it via package managers like Homebrew if it's missing.
- Subcommand Mapping: Create intuitive shortcuts for specific tool subcommands, such as mapping 'pv i' to 'pipenv install' to reduce keystrokes.
- Interactive CLI Workflows: Develop sophisticated shell functions that utilize interactive prompts (via gum) for choosing options or confirming actions during terminal tasks.
- Standardized Dotfile Management: Ensure all shell customizations are organized correctly by automatically placing alias files in the designated directory structure with proper naming conventions.
| name | add-fish-alias |
|---|---|
| description | Use when creating a new fish shell alias, function, or command shortcut, or when user asks to "add an alias for X" |
Add Fish Alias
Create a new fish shell function/alias in Juliet dotfiles.
Process
Create function file
symlinked/config/fish/functions/aliases/<name>.fishWrite the function
function <name> --wraps "<wrapped-command>" <wrapped-command> $argv endReload fish (or open new terminal)
source ~/.config/fish/config.fish
File Naming
- Filename = function name (e.g.,
g.fishdefinesgfunction) - Use lowercase, hyphens for multi-word names
- Files are auto-loaded alphabetically
Patterns
Simple Wrapper
function g --wraps "git"
git $argv
end
Wrapper with Auto-Install
function nv --wraps "neovide"
if ! command -v neovide 2&> /dev/null
gum confirm "Neovide not installed. Install?" && brew install --cask neovide
end
neovide $argv
end
Function with Subcommand Aliases
function pv --wraps "pipenv"
switch $argv[1]
case "i"
set argv[1] install
end
pipenv $argv
end
Interactive Function (using gum)
function clone
set -l provider (gum choose --header "Source?" github gitlab)
# ... rest of logic
end
Multiple Functions in One File
Group related functions (e.g., git.fish contains ga, gl, gm, commit, etc.)
Conventions
- Use
--wrapsfor tab completion inheritance - Use
$argvto pass all arguments - Use
gumfor interactive prompts (confirm, choose, input, spin) - Helper functions:
log,error,debuglog(defined in fish config)
Common Mistakes
- Forgetting
--wraps(loses tab completion) - Using
$@instead of$argv(bash syntax, not fish) - Creating in wrong directory (must be in
symlinked/config/fish/functions/aliases/)