/ prefix in the REPL (e.g., /commit, /review, /mcp). They live in src/commands/ and are registered in src/commands.ts (~25K lines).
Commands are distinct from tools. Tools are capabilities the LLM invokes autonomously during a query. Commands are actions the user invokes explicitly by typing
/command-name.Command types
Three command types cover the full range of use cases:- PromptCommand
- LocalCommand
- LocalJSXCommand
Sends a formatted prompt to the LLM with an injected tool allowlist. Used for AI-assisted actions like code review and commit message generation.Example — the
/insights command uses a lazy-loaded PromptCommand to defer a 113 KB module until invoked:Command base shape
All three command types share a commonCommandBase:
Defining a command
A minimalPromptCommand definition:
allowedTools accepts the same wildcard pattern format as the permission system:
How commands are invoked
User types /command-name
The REPL input handler detects the
/ prefix and looks up the command by name (or alias) in the registered command list.Command type dispatch
LocalCommand—load()is called to lazy-load the module, thencall()executes synchronously in-process. The text result appears in the REPL.LocalJSXCommand—load()is called, thencall()returns a React node that the REPL renders as a full-screen overlay.PromptCommand—getPromptForCommand()builds the message content, which is injected into the conversation and submitted to the Query Engine with the command’sallowedToolsas the active tool filter.
Feature-flag gating and conditional imports
src/commands.ts gates a number of commands behind bun:bundle feature flags. Commands inside inactive flags are completely absent from production builds:
Command catalog
Git & version control
Git & version control
| Command | Source | Description |
|---|---|---|
/commit | commit.ts | Create a git commit with an AI-generated message |
/commit-push-pr | commit-push-pr.ts | Commit, push, and create a PR in one step |
/branch | branch/ | Create or switch git branches |
/diff | diff/ | View file changes (staged, unstaged, or against a ref) |
/pr_comments | pr_comments/ | View and address PR review comments |
/rewind | rewind/ | Revert to a previous state |
Code quality
Code quality
| Command | Source | Description |
|---|---|---|
/review | review.ts | AI-powered code review of staged/unstaged changes |
/security-review | security-review.ts | Security-focused code review |
/advisor | advisor.ts | Get architectural or design advice |
/bughunter | bughunter/ | Find potential bugs in the codebase |
Session & context
Session & context
| Command | Source | Description |
|---|---|---|
/compact | compact/ | Compress conversation context to fit more history |
/resume | resume/ | Restore a previous conversation session |
/session | session/ | Manage sessions (list, switch, delete) |
/export | export/ | Export conversation to a file |
/summary | summary/ | Generate a summary of the current session |
/clear | clear/ | Clear the conversation history |
Configuration & settings
Configuration & settings
| Command | Source | Description |
|---|---|---|
/config | config/ | View or modify Claude Code settings |
/permissions | permissions/ | Manage tool permission rules |
/model | model/ | Switch the active model |
/effort | effort/ | Adjust response effort level |
/theme | theme/ | Change the terminal color theme |
/vim | vim/ | Toggle vim mode for input |
MCP, plugins & skills
MCP, plugins & skills
| Command | Source | Description |
|---|---|---|
/mcp | mcp/ | Manage MCP server connections |
/plugin | plugin/ | Install, remove, or manage plugins |
/reload-plugins | reload-plugins/ | Reload all installed plugins |
/skills | skills/ | View and manage skills |
Diagnostics & status
Diagnostics & status
| Command | Source | Description |
|---|---|---|
/doctor | doctor/ | Run environment diagnostics |
/status | status/ | Show system and session status |
/cost | cost/ | Display token usage and estimated cost |
/stats | stats/ | Show session statistics |
/version | version.ts | Show Claude Code version |
IDE & desktop integration
IDE & desktop integration
| Command | Source | Description |
|---|---|---|
/bridge | bridge/ | Manage IDE bridge connections (feature-gated) |
/ide | ide/ | Open in IDE |
/desktop | desktop/ | Hand off to the desktop app |
/teleport | teleport/ | Transfer session to another device |
See also
- Architecture overview — Where the command system fits in the full pipeline
- Tool System — Agent tools (distinct from slash commands)
- Query Engine — How
PromptCommandprompts are processed