Tab completion for the claude
CLI (Claude Code) in bash, zsh, and fish.
Claude Code ships no built-in completion generator (the client is
closed-source, so source <(claude completion bash) is not possible). Static
flag lists go stale on every release. These scripts instead parse
claude --help at runtime and cache the result per version, so completion
always matches the claude you actually have installed.
git clone https://github.com/AzarAI-TOP/bash-completion-for-claude.git
cd bash-completion-for-claude
./install.shBy default install.sh detects your current shell (from $SHELL) and
installs just that one:
./install.sh # detect current shell and install it
./install.sh bash # install for a specific shell
./install.sh zsh
./install.sh fish
./install.sh all # install for all threeIf the detected shell is not one of bash/zsh/fish, it tells you and exits; install explicitly with one of the arguments above.
Then, in a new shell:
claude --<Tab> # options: --model --resume --print ...
claude <Tab> # subcommands: agents auth mcp plugin update ...
Install locations:
| shell | installed to | loading |
|---|---|---|
| bash | ${XDG_DATA_HOME:-~/.local/share}/bash-completion/completions/claude |
lazy-loaded by bash-completion; no ~/.bashrc edit |
| zsh | ${XDG_DATA_HOME:-~/.local/share}/zsh/site-functions/_claude |
autoloaded via compinit if the dir is on $fpath |
| fish | ${XDG_CONFIG_HOME:-~/.config}/fish/completions/claude.fish |
autoloaded by fish on demand |
For zsh, the install dir must be on $fpath before compinit. If
completion does not show up, add to ~/.zshrc:
fpath=("${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions" $fpath)
autoload -U compinit && compinit- On first completion the script runs
claude --help, extracts every--optionand every subcommand from theCommands:section, and caches the list under${XDG_CACHE_HOME:-~/.cache}/claude-completion/words-<version>. - Later completions read the cache (instant). After you upgrade Claude Code the version changes, so a fresh list is generated automatically.
- A few path-taking options (
--add-dir,--settings,--mcp-config,--debug-file,--system-prompt-file,--append-system-prompt-file) fall back to file/dir completion.
- bash:
bash-completion(provides the lazy-load dir and_init_completion/_filedir) - zsh:
compinitenabled (standard) - fish: any recent version
claudeonPATH
rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions/claude"
rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions/_claude"
rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/fish/completions/claude.fish"
rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/claude-completion"MIT