Claude Code Custom Commands: 3 Practical Examples and When to (Not) Use Them (www.aiengineering.report)

🤖 AI Summary
Anthropic’s Claude Code supports user-defined custom slash commands—saved English prompts stored in ~/.claude (global) or a project’s .claude directory—letting developers create reusable shortcuts (with $ARGUMENTS, $1, $2, etc.) that act like mini-scripts. The write-up walks through three practical examples: a /commit command that inspects staged/unstaged diffs for TODOs, commented-out code, debug flags or hardcoded test logic and either aborts with a structured report or stages and commits with an auto-generated or passed message; a /catchup command to reload uncommitted changes into a cleared conversation; and an extended /catchup that pulls a specified GitHub issue into context using the GitHub MCP (personal access token + MCP) so code + rationale travel together. Significance: custom commands let LLM-driven workflows cover gaps linters and manual reviews miss (semantic checks across diffs), streamline context management for iterative chat sessions, and integrate external tools (MCPs) directly into local Claude Code work. Practical guidance: save only long, frequently reused prompts (don’t create indirection for trivial or rare actions), tailor templates to your workflow, and avoid proliferating project-specific commands that confuse collaborators. For examples and inspiration, see the awesome-claude-code repo and claudecodecommands.directory.
Loading comments...
loading comments...