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
┌─────────────────────────────────────────────────────────────────────────────┐
│ COMMANDS ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ COMMAND TYPES │ │
│ │ │ │
│ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
│ │ │ PROMPT │ │ ACTION │ │ OUTPUT │ │ │
│ │ │ Commands │ │ Commands │ │ Commands │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ /commit │ │ /clear │ │ /cost │ │ │
│ │ │ /review │ │ /exit │ │ /usage │ │ │
│ │ │ /fix │ │ /compact │ │ /context │ │ │
│ │ └────────────┘ └────────────┘ └────────────┘ │ │
│ │ │ │
│ │ Prompt → AI processes Action → Immediate effect │ │
│ │ Output → Display info (no AI call) │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ COMMAND REGISTRY │ │
│ │ │ │
│ │ commands.ts → Central registry │ │
│ │ commands/*.ts → Individual command implementations │ │
│ │ skills/* → Skill-based commands │ │
│ │ plugins/* → Plugin commands │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘