Skip to content

Instantly share code, notes, and snippets.

@linuz90
Last active January 21, 2026 21:00
Show Gist options
  • Select an option

  • Save linuz90/f82ae05fe27056a4500eceb1c97bd141 to your computer and use it in GitHub Desktop.

Select an option

Save linuz90/f82ae05fe27056a4500eceb1c97bd141 to your computer and use it in GitHub Desktop.
ccmd - fzf picker for Claude Code commands
# ccmd - Claude Code commands picker with fzf
#
# Fuzzy-search through all your Claude Code slash commands and run them.
# Shows command name + description (parsed from YAML frontmatter).
#
# Requires: fzf (brew install fzf)
#
# Setup:
# 1. Set CLAUDE_ASSISTANT_DIR to your "personal assistant" folder
# (where you keep your .claude/commands/ and custom scripts)
# 2. Add this function to your .zshrc
# 3. Run `ccmd` from anywhere
#
# The folder structure expected:
# $CLAUDE_ASSISTANT_DIR/
# .claude/commands/ <- project-specific commands (run in assistant dir)
# claude/commands/ <- global commands (run in current dir)
#
# For a full personal assistant setup, see:
# https://github.com/linuz90/claude-telegram-bot/blob/main/docs/personal-assistant-guide.md
function ccmd() {
local assistant_dir="${CLAUDE_ASSISTANT_DIR:-$HOME/claude-assistant}"
local project_cmds="$assistant_dir/.claude/commands"
local global_cmds="$assistant_dir/claude/commands"
# Build list from YAML frontmatter descriptions
local cmd_list=""
# Project commands (run in assistant dir)
for f in "$project_cmds"/*.md(N); do
local name=$(basename "$f" .md)
local desc=$(grep -m1 "^description:" "$f" 2>/dev/null | sed 's/description: *//')
cmd_list+="/$name | ${desc:-No description} | project\n"
done
# Global commands (run in current dir)
for f in "$global_cmds"/*.md(N); do
local name=$(basename "$f" .md)
local desc=$(grep -m1 "^description:" "$f" 2>/dev/null | sed 's/description: *//')
cmd_list+="/$name | ${desc:-No description} | global\n"
done
# fzf picker
local selected=$(echo -e "$cmd_list" | fzf --height 50% --reverse \
--header "Claude Commands (Enter to run)" \
--preview-window hidden \
--delimiter " \| " \
--with-nth 1,2)
# Run selected command
if [[ -n "$selected" ]]; then
local cmd_name=$(echo "$selected" | cut -d'|' -f1 | xargs)
local cmd_type=$(echo "$selected" | cut -d'|' -f3 | xargs)
if [[ "$cmd_type" == "project" ]]; then
echo "Running: cc \"$cmd_name\" (in $assistant_dir)"
(cd "$assistant_dir" && cc "$cmd_name")
else
echo "Running: cc \"$cmd_name\""
cc "$cmd_name"
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment