skip to content

Claude Code Slash Commands

Complete reference for every built-in Claude Code slash command β€” session control, context management, configuration, tools, and MCP.

4 min read 7 snippets yesterday quick read

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#

CommandWhat it does
/helpShow available commands and keyboard shortcuts
/exit or /quitEnd the session
/clearDiscard all conversation history and start a blank session
/compactSummarize conversation history to free context window space
/resetAlias 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#

CommandWhat it does
/memoryOpen the global ~/.claude/CLAUDE.md file in your editor
/contextShow a summary of the current context window usage

Configuration#

CommandWhat it does
/configOpen or show the current settings (project or user-level settings.json)
/modelShow or change the active model
/model claude-sonnet-4-6Switch to Sonnet for the rest of the session
/model claude-opus-4-7Switch to Opus
/model claude-haiku-4-5Switch to Haiku

Permissions and tools#

CommandWhat it does
/permissionsShow current tool permission settings

Bug reporting and status#

CommandWhat it does
/bugReport a bug to Anthropic with session context attached
/statusShow account status, usage, and model information
/costShow the estimated cost of the current session

Doctor and diagnostics#

CommandWhat it does
/doctorCheck 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#

CommandWhat it does
/fastToggle Fast mode (uses claude-opus-4-6 with faster output)

MCP server management#

CommandWhat it does
/mcpList connected MCP servers and their status
/mcp add <name> <command>Add a new MCP server
/mcp remove <name>Remove an MCP server

Vim mode#

CommandWhat it does
/vimToggle 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)#

ShortcutAction
Ctrl+CCancel current input or interrupt running operation
Ctrl+DExit (same as /exit)
Up / DownNavigate input history
TabAutocomplete slash commands
Shift+EnterInsert a newline without submitting
EscapeClear current input
Cmd+Esc (Mac) / Ctrl+EscOpen 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/)