Commands Architecture
Overview
Commands in Claude Code are slash-prefixed actions (/commit, /review, /diff) that trigger specific behaviors. They're like shortcuts for common tasks.
Plain text
Shared from "Claude-Code" on Inkdown
Commands in Claude Code are slash-prefixed actions (/commit, /review, /diff) that trigger specific behaviors. They're like shortcuts for common tasks.
| File | Purpose |
|---|---|
commands.ts | Command registry, getCommands() function |
commands/[name]/index.ts | Individual command implementations |
commands/[name]/prompt.ts | Prompts for prompt-type commands |
types/command.ts | Command type definitions |
/commit/review/clear/exit/cost/contextCommands can be added at runtime by plugins and skills.
Commands register at startup but execute only when called.
Commands can call other commands or use shared utilities.
Plugins and skills add commands dynamically.
Description field feeds the /help system automatically.