fish-helper
Fish shell scripting - functions, abbreviations, completions, and configuration When user works with .fish files, mentions Fish shell, fish config, Fisher plugins, or Fish scripting patterns
What this skill does
# Fish Shell Helper Agent
## What's New in Fish 4.x (2025-2026)
### Fish 4.0 (February 2025)
- **Rust rewrite**: Entire codebase ported from C++ to Rust (2,731 commits, 200+ contributors)
- **New keyboard protocol**: Human-readable bind notation (`bind ctrl-right` instead of escape sequences), xterm modifyOtherKeys and kitty keyboard protocol support
- **OSC 133 prompt marking**: Prompts and command output marked for terminal integration
- **Command-specific abbreviations**: `abbr --command git co checkout`
- **Self-installable builds**: Static binaries embed functions, man pages, and webconfig
- **History filtering**: `fish_should_add_to_history` function for selective exclusion
- **`string match --max-matches`** and **`set --no-event`** flags
### Fish 4.1 (September 2025)
- **Brace compound commands**: `{ echo 1; echo 2 }` syntax
- **Transient prompts**: `fish_transient_prompt` function for simplified prompt after execution
- **Mouse support**: OSC 133 prompt marking with kitty click events
- **`string pad --center`** option
- **Vi mode**: ctrl+a (increment) and ctrl+x (decrement)
### Fish 4.2 (November 2025)
- Multi-line autosuggestions from history
- `fish_tab_title` function for separate tab titles
- Fish assumes UTF-8 regardless of system locale
### Fish 4.3 (December 2025)
- **Universal variables replaced with global defaults** for cleaner configuration
- **Adaptive themes**: `[light]` and `[dark]` sections in theme files
- Terminal working directory reported via OSC 7
### Fish 4.4 (February 2026)
- Vi mode word motions aligned with Vim behavior (counts supported: `d3w`)
- New `catppuccin-*` color themes
- `set_color` strikethrough modifier
## Overview
Fish (Friendly Interactive SHell) is a modern interactive shell focused on user experience. It provides syntax highlighting, autosuggestions, and tab completions out of the box. Fish intentionally breaks POSIX compatibility in favor of cleaner, more discoverable syntax.
Key design principles:
- Discoverability over tradition (no hidden configuration)
- User-friendliness over backward compatibility
- Correctness (no word splitting on variables)
## Syntax Differences from Bash
### Variable Assignment
```fish
# Fish uses set, not VAR=value
set name "world"
set -gx PATH /usr/local/bin $PATH # global + exported
set -l local_var "temporary" # local scope
set -U EDITOR vim # universal (persists across sessions)
set -e var_name # erase variable
```
### Variable Scopes
- **Universal** (`-U`): Shared across all sessions, persisted to disk
- **Global** (`-g`): Current session only
- **Function** (`-f`): Current function
- **Local** (`-l`): Current block
### Command Substitution
```fish
# Fish uses (command) or $(command), NOT backticks
set files (ls)
echo "Current dir: $(pwd)"
# Output splits on newlines only (not whitespace like bash)
# Use quotes to prevent splitting
set content "$(cat file.txt)"
```
### No Process Substitution
```fish
# Bash: diff <(cmd1) <(cmd2)
# Fish: use psub
diff (cmd1 | psub) (cmd2 | psub)
```
### Conditionals and Loops
```fish
# if/else if/else/end (no then/fi)
if test -f /etc/os-release
cat /etc/os-release
else if test -f /etc/issue
cat /etc/issue
else
echo "Unknown OS"
end
# switch/case/end (no esac, no fallthrough)
switch (uname)
case Linux
echo "Linux"
case Darwin
echo "macOS"
case '*'
echo "Other"
end
# for/end (no do/done)
for file in *.txt
echo $file
end
# while/end
while read -l line
echo "Line: $line"
end < input.txt
```
### Lists (Arrays)
```fish
# All variables are lists. 1-indexed, negative indexing supported
set colors red green blue
echo $colors[1] # red
echo $colors[-1] # blue
echo $colors[2..3] # green blue
echo (count $colors) # 3
# PATH variables auto-split on colons
set -gx PATH /usr/local/bin /usr/bin /bin
```
### String Manipulation
```fish
# Use the string builtin (no ${var%pattern} parameter expansion)
string length "hello" # 5
string upper "hello" # HELLO
string replace "old" "new" "old text" # new text
string split "," "a,b,c" # a\nb\nc
string match -r '(\d+)' "file42.txt" # 42
string trim " hello " # hello
string sub -s 2 -l 3 "hello" # ell
```
### Arithmetic
```fish
# Use math builtin (no $(( )) or let)
math 2 + 2 # 4
math "10 / 3" # 3.333333 (floating point by default)
math "sqrt(16)" # 4
set result (math "$x * 2")
```
### Special Variables
| Bash | Fish |
| ---------- | ------------------- |
| `$?` | `$status` |
| `$@`, `$*` | `$argv` |
| `$$` | `$fish_pid` |
| `$#` | `(count $argv)` |
| `$!` | `$last_pid` |
| `$0` | `(status filename)` |
### Other Key Differences
- No heredocs: use `printf '%s\n' "line1" "line2"` or multi-line strings
- No `[[`: use `test` or `[` only
- No subshells: use `begin; end` for grouping, `set -l` for scoping
- No `export`: use `set -gx`
- No `source ~/.bashrc`: use `source ~/.config/fish/config.fish`
- Globs that match nothing cause command failure (not literal pass-through)
- `?` glob deprecated; use `*` or disable with `qmark-noglob`
- No word splitting on variable expansion (a feature, not a bug)
## Functions Quick Reference
```fish
# Define a function
function greet -d "Greet someone"
echo "Hello, $argv[1]!"
end
# Function with argument names
function mkcd -a dir -d "Create and enter directory"
mkdir -p $dir && cd $dir
end
# Function wrapping a command (inherit completions)
function ls --wraps ls -d "ls with color"
command ls --color=auto $argv
end
# Event handlers
function on_pwd_change --on-variable PWD
echo "Changed to $PWD"
end
function on_exit --on-event fish_exit
echo "Goodbye!"
end
# Save function to autoload file
funcsave greet # saves to ~/.config/fish/functions/greet.fish
```
## Abbreviations Quick Reference
```fish
# Simple abbreviation
abbr -a gco git checkout
abbr -a gst git status
# Position: expand anywhere (not just as command)
abbr -a --position anywhere -- -C --color
# Command-specific (Fish 4.0+)
abbr --command git co checkout
abbr --command git br branch
# With cursor positioning
abbr -a L --position anywhere --set-cursor "| less"
# Function-based expansion
abbr -a !! --position anywhere --function last_history_item
# Regex-based
abbr -a dotenv --regex '\.env.*' --function edit_with_caution
```
## Completions Quick Reference
```fish
# Basic completion for a command
complete -c mycommand -s h -l help -d "Show help"
complete -c mycommand -s v -l verbose -d "Verbose output"
# Require a parameter
complete -c mycommand -s o -l output -r -d "Output file" -F
# Exclusive (require param, no files)
complete -c mycommand -s f -l format -x -a "json yaml toml" -d "Output format"
# Conditional completions
complete -c git -n "__fish_use_subcommand" -a checkout -d "Switch branches"
complete -c git -n "__fish_seen_subcommand_from checkout" -a "(git branch --format='%(refname:short)')" -d "Branch"
# Disable file completions globally
complete -c mycommand -f
# Wrap another command's completions
complete -c hub -w git
```
## Configuration Structure
```
~/.config/fish/
config.fish # Main config (runs on every shell start)
conf.d/ # Modular config snippets (sourced alphabetically)
abbr.fish
path.fish
env.fish
functions/ # Autoloaded functions (one per file)
fish_prompt.fish
fish_right_prompt.fish
mkcd.fish
completions/ # Custom completions (one per command)
mycommand.fish
themes/ # Color themes (.theme files)
fish_plugins # Fisher plugin list
fish_variables # Universal variables (auto-managed, do not edit)
```
### Startup Order
1. Files in `conf.d/` directories (system, then Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.