Claude Code Slash Commands#
Slash commands are typed directly in the Claude Code interactive prompt. They control session behavior, manage context, and access configuration without leaving the terminal.
Session control#
| Command | What it does |
|---|
/help | Show available commands and keyboard shortcuts |
/exit or /quit | End the session |
/clear | Discard all conversation history and start a blank session |
/compact | Summarize conversation history to free context window space |
/reset | Alias for /clear |
[!TIP]
Use /compact instead of /clear when you want Claude to remember what it has done so far but the conversation is getting long. /clear wipes everything.
Context and memory#
| Command | What it does |
|---|
/memory | Open the global ~/.claude/CLAUDE.md file in your editor |
/context | Show a summary of the current context window usage |
Configuration#
| Command | What it does |
|---|
/config | Open or show the current settings (project or user-level settings.json) |
/model | Show or change the active model |
/model claude-sonnet-4-6 | Switch to Sonnet for the rest of the session |
/model claude-opus-4-7 | Switch to Opus |
/model claude-haiku-4-5 | Switch to Haiku |
| Command | What it does |
|---|
/permissions | Show current tool permission settings |
Bug reporting and status#
| Command | What it does |
|---|
/bug | Report a bug to Anthropic with session context attached |
/status | Show account status, usage, and model information |
/cost | Show the estimated cost of the current session |
Doctor and diagnostics#
| Command | What it does |
|---|
/doctor | Check environment health β API key, Node version, connectivity |
Output:
β
API key found (ANTHROPIC_API_KEY)
β
Node.js 22.2.0
β
npm 10.7.0
β
@anthropic-ai/claude-code 1.3.0
β
API connectivity: OK
Mode switching#
| Command | What it does |
|---|
/fast | Toggle Fast mode (uses claude-opus-4-6 with faster output) |
MCP server management#
| Command | What it does |
|---|
/mcp | List connected MCP servers and their status |
/mcp add <name> <command> | Add a new MCP server |
/mcp remove <name> | Remove an MCP server |
Vim mode#
| Command | What it does |
|---|
/vim | Toggle vim keybindings in the input prompt |
User-defined skills#
Claude Code supports custom slash commands defined as Markdown files in ~/.claude/commands/ (global) or .claude/commands/ (project-level). Each file becomes a /command-name command.
Create a custom command#
mkdir -p ~/.claude/commands
# ~/.claude/commands/review.md
Review the staged git diff for:
1. Security issues (secrets, injection vulnerabilities, XSS)
2. Missing error handling
3. Test coverage gaps
4. Code style inconsistencies with the existing codebase
Be concise. Report findings as a bulleted list grouped by severity: Critical, Warning, Info.
Now /review is available in every Claude Code session:
> /review
Output:
**Critical**
- None
**Warning**
- auth/login.py:47 β password compared with == instead of hmac.compare_digest (timing attack)
**Info**
- utils/format.py β new function `format_currency` has no test coverage
- README.md β installation instructions not updated for new dependency
Project-level command#
Place the file in .claude/commands/ in your project root. It only appears when you are inside that project.
# .claude/commands/deploy.md
Run the full pre-deploy checklist for this project:
1. `npm run build` β confirm clean build
2. `npm run test` β confirm all tests pass
3. `python scripts/validate_frontmatter.py` β confirm content is valid
4. Report a summary: pass/fail per step, plus any warnings.
[!TIP]
Commands support $ARGUMENTS substitution. For example, a command file containing Summarize issue $ARGUMENTS from the GitHub repo lets you type /summarize-issue 123.
Keyboard shortcuts (interactive mode)#
| Shortcut | Action |
|---|
Ctrl+C | Cancel current input or interrupt running operation |
Ctrl+D | Exit (same as /exit) |
Up / Down | Navigate input history |
Tab | Autocomplete slash commands |
Shift+Enter | Insert a newline without submitting |
Escape | Clear current input |
Cmd+Esc (Mac) / Ctrl+Esc | Open Claude Code from VS Code |
Quick reference card#
Session: /help /exit /clear /compact
Context: /memory /context
Config: /config /model <name>
Cost: /cost /status
Diagnose: /doctor /bug
MCP: /mcp
Mode: /fast /vim
Custom: /your-command (from ~/.claude/commands/)