Slash commands are shortcuts that control Claude's behavior during an interactive session. They come in several types:
- Built-in commands: Provided by Claude Code (
/help,/clear,/model) - Skills: User-defined commands created as
SKILL.mdfiles (/optimize,/pr) - Plugin commands: Commands from installed plugins (
/frontend-design:frontend-design) - MCP prompts: Commands from MCP servers (
/mcp__github__list_prs)
Note: Custom slash commands have been merged into skills. Files in
.claude/commands/still work, but skills (.claude/skills/) are now the recommended approach. Both create/command-nameshortcuts. See the Skills Guide for the full reference.
Built-in commands are shortcuts for common actions. There are 55+ built-in commands and 5 bundled skills available. Type / in Claude Code to see the full list, or type / followed by any letters to filter.
| Command | Purpose |
|---|---|
/add-dir <path> |
Add working directory |
/agents |
Manage agent configurations |
/branch [name] |
Branch conversation into a new session (alias: /fork). Note: /fork renamed to /branch in v2.1.77 |
/btw <question> |
Side question without adding to history |
/chrome |
Configure Chrome browser integration |
/clear |
Clear conversation (aliases: /reset, /new) |
/color [color|default] |
Set prompt bar color |
/compact [instructions] |
Compact conversation with optional focus instructions |
/config |
Open Settings (alias: /settings) |
/context |
Visualize context usage as colored grid |
/copy [N] |
Copy assistant response to clipboard; w writes to file |
/cost |
Show token usage statistics |
/desktop |
Continue in Desktop app (alias: /app) |
/diff |
Interactive diff viewer for uncommitted changes |
/doctor |
Diagnose installation health |
/effort [low|medium|high|max|auto] |
Set effort level. max requires Opus 4.6 |
/exit |
Exit the REPL (alias: /quit) |
/export [filename] |
Export the current conversation to a file or clipboard |
/extra-usage |
Configure extra usage for rate limits |
/fast [on|off] |
Toggle fast mode |
/feedback |
Submit feedback (alias: /bug) |
/help |
Show help |
/hooks |
View hook configurations |
/ide |
Manage IDE integrations |
/init |
Initialize CLAUDE.md. Set CLAUDE_CODE_NEW_INIT=true for interactive flow |
/insights |
Generate session analysis report |
/install-github-app |
Set up GitHub Actions app |
/install-slack-app |
Install Slack app |
/keybindings |
Open keybindings configuration |
/login |
Switch Anthropic accounts |
/logout |
Sign out from your Anthropic account |
/mcp |
Manage MCP servers and OAuth |
/memory |
Edit CLAUDE.md, toggle auto-memory |
/mobile |
QR code for mobile app (aliases: /ios, /android) |
/model [model] |
Select model with left/right arrows for effort |
/passes |
Share free week of Claude Code |
/permissions |
View/update permissions (alias: /allowed-tools) |
/plan [description] |
Enter plan mode |
/plugin |
Manage plugins |
/pr-comments [PR] |
Fetch GitHub PR comments |
/privacy-settings |
Privacy settings (Pro/Max only) |
/release-notes |
View changelog |
/reload-plugins |
Reload active plugins |
/remote-control |
Remote control from claude.ai (alias: /rc) |
/remote-env |
Configure default remote environment |
/rename [name] |
Rename session |
/resume [session] |
Resume conversation (alias: /continue) |
/review |
Deprecated — install the code-review plugin instead |
/rewind |
Rewind conversation and/or code (alias: /checkpoint) |
/sandbox |
Toggle sandbox mode |
/schedule [description] |
Create/manage scheduled tasks |
/security-review |
Analyze branch for security vulnerabilities |
/skills |
List available skills |
/stats |
Visualize daily usage, sessions, streaks |
/status |
Show version, model, account |
/statusline |
Configure status line |
/tasks |
List/manage background tasks |
/terminal-setup |
Configure terminal keybindings |
/theme |
Change color theme |
/vim |
Toggle Vim/Normal modes |
/voice |
Toggle push-to-talk voice dictation |
These skills ship with Claude Code and are invoked like slash commands:
| Skill | Purpose |
|---|---|
/batch <instruction> |
Orchestrate large-scale parallel changes using worktrees |
/claude-api |
Load Claude API reference for project language |
/debug [description] |
Enable debug logging |
/loop [interval] <prompt> |
Run prompt repeatedly on interval |
/simplify [focus] |
Review changed files for code quality |
| Command | Status |
|---|---|
/review |
Deprecated — replaced by code-review plugin |
/output-style |
Deprecated since v2.1.73 |
/fork |
Renamed to /branch (alias still works, v2.1.77) |
/forkrenamed to/branchwith/forkkept as alias (v2.1.77)/output-styledeprecated (v2.1.73)/reviewdeprecated in favor of thecode-reviewplugin/effortcommand added withmaxlevel requiring Opus 4.6/voicecommand added for push-to-talk voice dictation/schedulecommand added for creating/managing scheduled tasks/colorcommand added for prompt bar customization/modelpicker now shows human-readable labels (e.g., "Sonnet 4.6") instead of raw model IDs/resumesupports/continuealias- MCP prompts are available as
/mcp__<server>__<prompt>commands (see MCP Prompts as Commands)
Custom slash commands have been merged into skills. Both approaches create commands you can invoke with /command-name:
| Approach | Location | Status |
|---|---|---|
| Skills (Recommended) | .claude/skills/<name>/SKILL.md |
Current standard |
| Legacy Commands | .claude/commands/<name>.md |
Still works |
If a skill and a command share the same name, the skill takes precedence. For example, when both .claude/commands/review.md and .claude/skills/review/SKILL.md exist, the skill version is used.
Your existing .claude/commands/ files continue to work without changes. To migrate to skills:
Before (Command):
.claude/commands/optimize.md
After (Skill):
.claude/skills/optimize/SKILL.md
Skills offer additional features over legacy commands:
- Directory structure: Bundle scripts, templates, and reference files
- Auto-invocation: Claude can trigger skills automatically when relevant
- Invocation control: Choose whether users, Claude, or both can invoke
- Subagent execution: Run skills in isolated contexts with
context: fork - Progressive disclosure: Load additional files only when needed
Create a directory with a SKILL.md file:
mkdir -p .claude/skills/my-commandFile: .claude/skills/my-command/SKILL.md
---
name: my-command
description: What this command does and when to use it
---
# My Command
Instructions for Claude to follow when this command is invoked.
1. First step
2. Second step
3. Third step| Field | Purpose | Default |
|---|---|---|
name |
Command name (becomes /name) |
Directory name |
description |
Brief description (helps Claude know when to use it) | First paragraph |
argument-hint |
Expected arguments for auto-completion | None |
allowed-tools |
Tools the command can use without permission | Inherits |
model |
Specific model to use | Inherits |
disable-model-invocation |
If true, only user can invoke (not Claude) |
false |
user-invocable |
If false, hide from / menu |
true |
context |
Set to fork to run in isolated subagent |
None |
agent |
Agent type when using context: fork |
general-purpose |
hooks |
Skill-scoped hooks (PreToolUse, PostToolUse, Stop) | None |
Commands can receive arguments:
All arguments with $ARGUMENTS:
---
name: fix-issue
description: Fix a GitHub issue by number
---
Fix issue #$ARGUMENTS following our coding standardsUsage: /fix-issue 123 → $ARGUMENTS becomes "123"
Individual arguments with $0, $1, etc.:
---
name: review-pr
description: Review a PR with priority
---
Review PR #$0 with priority $1Usage: /review-pr 456 high → $0="456", $1="high"
Execute bash commands before the prompt using !command``:
---
name: commit
description: Create a git commit with context
allowed-tools: Bash(git *)
---
## Context
- Current git status: !`git status`
- Current git diff: !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -5`
## Your task
Based on the above changes, create a single git commit.Include file contents using @:
Review the implementation in @src/utils/helpers.js
Compare @src/old-version.js with @src/new-version.jsPlugins can provide custom commands:
/plugin-name:command-name
Or simply /command-name when there are no naming conflicts.
Examples:
/frontend-design:frontend-design
/commit-commands:commitMCP servers can expose prompts as slash commands:
/mcp__<server-name>__<prompt-name> [arguments]
Examples:
/mcp__github__list_prs
/mcp__github__pr_review 456
/mcp__jira__create_issue "Bug title" highControl MCP server access in permissions:
mcp__github- Access entire GitHub MCP servermcp__github__*- Wildcard access to all toolsmcp__github__get_issue- Specific tool access
graph TD
A["User Input: /command-name"] --> B{"Command Type?"}
B -->|Built-in| C["Execute Built-in"]
B -->|Skill| D["Load SKILL.md"]
B -->|Plugin| E["Load Plugin Command"]
B -->|MCP| F["Execute MCP Prompt"]
D --> G["Parse Frontmatter"]
G --> H["Substitute Variables"]
H --> I["Execute Shell Commands"]
I --> J["Send to Claude"]
J --> K["Return Results"]
sequenceDiagram
participant User
participant Claude as Claude Code
participant FS as File System
participant CLI as Shell/Bash
User->>Claude: Types /optimize
Claude->>FS: Searches .claude/skills/ and .claude/commands/
FS-->>Claude: Returns optimize/SKILL.md
Claude->>Claude: Parses frontmatter
Claude->>CLI: Executes !`command` substitutions
CLI-->>Claude: Command outputs
Claude->>Claude: Substitutes $ARGUMENTS
Claude->>User: Processes prompt
Claude->>User: Returns results
These example commands can be installed as skills or legacy commands.
Analyzes code for performance issues, memory leaks, and optimization opportunities.
Usage:
/optimize
[Paste your code]
Guides through PR preparation checklist including linting, testing, and commit formatting.
Usage:
/pr
Generates comprehensive API documentation from source code.
Usage:
/generate-api-docs
Creates a git commit with dynamic context from your repository.
Usage:
/commit [optional message]
Stages all changes, creates a commit, and pushes to remote with safety checks.
Usage:
/push-all
Safety Checks:
- Secrets:
.env*,*.key,*.pem,credentials.json - API Keys: Detects real keys vs. placeholders
- Large files:
>10MBwithout Git LFS - Build artifacts:
node_modules/,dist/,__pycache__/
Restructures project documentation for clarity and accessibility.
Usage:
/doc-refactor
Implements pre-commit hooks and GitHub Actions for quality assurance.
Usage:
/setup-ci-cd
Increases test coverage by targeting untested branches and edge cases.
Usage:
/unit-test-expand
Copy to your skills directory:
# Create skills directory
mkdir -p .claude/skills
# For each command file, create a skill directory
for cmd in optimize pr commit; do
mkdir -p .claude/skills/$cmd
cp 01-slash-commands/$cmd.md .claude/skills/$cmd/SKILL.md
doneCopy to your commands directory:
# Project-wide (team)
mkdir -p .claude/commands
cp 01-slash-commands/*.md .claude/commands/
# Personal use
mkdir -p ~/.claude/commands
cp 01-slash-commands/*.md ~/.claude/commands/Create .claude/skills/my-command/SKILL.md:
---
name: my-command
description: What this command does. Use when [trigger conditions].
argument-hint: [optional-args]
allowed-tools: Bash(npm *), Read, Grep
---
# Command Title
## Context
- Current branch: !`git branch --show-current`
- Related files: @package.json
## Instructions
1. First step
2. Second step with argument: $ARGUMENTS
3. Third step
## Output Format
- How to format the response
- What to includeFor commands with side effects that Claude shouldn't trigger automatically:
---
name: deploy
description: Deploy to production
disable-model-invocation: true
allowed-tools: Bash(npm *), Bash(git *)
---
Deploy the application to production:
1. Run tests
2. Build application
3. Push to deployment target
4. Verify deployment| Do | Don't |
|---|---|
| Use clear, action-oriented names | Create commands for one-time tasks |
Include description with trigger conditions |
Build complex logic in commands |
| Keep commands focused on single task | Hardcode sensitive information |
Use disable-model-invocation for side effects |
Skip the description field |
Use ! prefix for dynamic context |
Assume Claude knows current state |
| Organize related files in skill directories | Put everything in one file |
Solutions:
- Check file is in
.claude/skills/<name>/SKILL.mdor.claude/commands/<name>.md - Verify the
namefield in frontmatter matches expected command name - Restart Claude Code session
- Run
/helpto see available commands
Solutions:
- Add more specific instructions
- Include examples in the skill file
- Check
allowed-toolsif using bash commands - Test with simple inputs first
If both exist with the same name, the skill takes precedence. Remove one or rename it.
- Skills - Full reference for skills (auto-invoked capabilities)
- Memory - Persistent context with CLAUDE.md
- Subagents - Delegated AI agents
- Plugins - Bundled command collections
- Hooks - Event-driven automation
- Official Interactive Mode Documentation - Built-in commands reference
- Official Skills Documentation - Complete skills reference
- CLI Reference - Command-line options
Part of the Claude How To guide series
