Claude Code Slash / Commands
\n\nSlash / commands are the quick control entry points for Claude Codeβs interactive sessions. By entering commands starting with /, you can quickly invoke features, manage sessions, and customize workflows.
To view all available commands:
\n\n/help\n\n\n/help lists all built-in commands, current projectβs custom commands (Skills / Commands), and commands exposed by connected MCP servers.
Command Types:
\n\n| Type | \nTrigger Method | \nSource | \nStorage Location | \nUse Cases | \n
|---|---|---|---|---|
| Built-in Commands | \n/command | \n Installed with Claude Code | \nInternal implementation | \nSystem operations: session management, configuration, integration, etc. | \n
| Built-in Skills | \n/skill-name | \n Bundled with Claude Code | \nInternal implementation | \nPredefined AI workflows: code review, debugging, batch processing, etc. | \n
| Project Custom Skills (Recommended) | \n/skill-name | \n User-created directory + SKILL.md | \n .claude/skills/<name>/SKILL.md | \n Reusable team-shared workflows,Add to git; supports Claude auto-triggering | \n
| Project Custom Commands (Legacy format) | \n/command | \n User-created .md file | \n .claude/commands/ | \n Repeated team-shared workflows,Add to git | \n
| Personal Custom Skills | \n/skill-name | \n User-created directory + SKILL.md | \n ~/.claude/skills/<name>/SKILL.md | \n Personal workflows reusable across projects | \n
| Personal Custom Commands | \n/command | \n User-created .md file | \n ~/.claude/commands/ | \n Personal workflows reusable across projects (legacy format) | \n
| MCP Commands | \n/mcp__server__command | \n Automatically exposed by MCP servers | \nProvided by MCP servers | \nInvoke external tools: GitHub, Slack, databases, etc. | \n
! Shell Commands | \n !bash-command | \n Direct execution | \nβ | \nBypass AI processing; directly run terminal commands | \n
Command Priority (when names conflict): Enterprise-level > Personal-level > Project-level > Built-in
\n\nSkills vs Commands: Both are triggered with /, but Skills (under .claude/skills/) are the new-generation format, supporting multi-file organization, Claude auto-triggering, and richer frontmatter control. Commands (under .claude/commands/) are the legacy format, still fully compatible; new projects are recommended to use Skills directly.
\n\n
1. Common Built-in Slash Commands
\n\nBuilt-in commands are core features bundled with Claude Codeβjust type them to use. Beginners should prioritize mastering these high-frequency categories:
\n\nBasic Operation Commands
\n\n| Command | \nPurpose | \nBeginner Example | \n
|---|---|---|
/help | \n View all available commands and descriptions (including MCP commands) | \nEnter /help to quickly check the command list | \n
/exit | \n Exit the current interactive session | \nWhen you donβt want to continue chatting, type /exit to leave directly | \n
/clear | \n Clear current conversation history | \nSession too messy? Use /clear to wipe everything in one go | \n
For example, using the /help command to view help information: Tab key toggles menus, Esc exits:
Session Management Commands
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/clear | \n /clear | \n Clear all conversation history and start a fresh session | \n/clear | \n Irreversible; recommend running /export first | \n
/compact | \n /compact | \n Intelligently compresses conversation history, preserving semantics while reducing token usage | \n/compact Keep the database design section | \n Differs from /clear: retains semantic summary instead of full deletion | \n
/resume | \n /resume | \n Resume a past session; without arguments, lists all resumable sessions | \n/resume task-hub-backend | \n Works best with /rename | \n
/rewind | \n /rewind | \n Undo recent operations (including file edits and conversation content), reverting to the last checkpoint; new version adds "Revert Code Only" option to preserve conversation history | \nPress Esc twice to open the rewind menu | \n Useful when dissatisfied with Agent execution results | \n
/rename | \n /rename <name> | \n Name the current session for easier retrieval via /resume later | \n /rename auth-module-refactor | \n Recommended naming convention: feature-operation | \n
/export | \n /export | \n Export conversation to a file; without filename, copy to clipboard | \n/export debug-session.md | \n Supports Markdown format | \n
/copy NEW | \n /copy | \n Copy Claudeβs most recent reply to clipboard; if multiple code blocks exist, an interactive selector appears | \n/copy | \n Much faster than manually selecting text | \n
/btw NEW | \n /btw <question> | \n Quickly ask a temporary question without affecting the main task context; answer does not pollute the main conversation flow | \n/btw Redis What is the default port for ? | \n Useful for quick reference without disrupting current tasks | \n
/exit | \n /exit | \n Safely exit Claude Code REPL | \n/exit | \n β | \n
Context & Memory
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/context | \n /context | \n Visualize context window usage, showing proportions of history/files/system prompt/Skills | \n/context | \n Run /compact or /clear when approaching the limit | \n
/memory | \n /memory | \n Open editor to modify CLAUDE.md (project-level and global), enabling persistent project conventions across sessions | \n /memory | \n Changes apply to all subsequent sessions | \n
/add-dir | \n /add-dir <path> | \n Add extra directories to the working scope, ideal for monorepos or cross-directory operations | \n/add-dir ../packages/shared | \n Can be called multiple times to add multiple directories | \n
/todos | \n /todos | \n List TODO items recorded by Claude in the current session | \n/todos | \n β | \n
/diff NEW | \n /diff | \n View a diff summary of all file changes made during this session, helping review what Claude modified | \n/diff | \n Use with /rewind: first /diff to confirm changes, then decide whether to roll back | \n
Project & Configuration
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/init | \n /init | \n Analyze project structure and auto-generate CLAUDE.md with tech stack, build commands, and code conventions | \n /init | \n Essential first step for new projects | \n
/config | \n /config | \n Manage Claude Code global configuration via interactive UI | \n/config | \n β | \n
/status | \n /status | \n Open settings status page to view current configuration overview | \n/status | \n β | \n
/hooks | \n /hooks | \n Interactively configure lifecycle hooks (e.g., pre-commit lint, post-save formatting) | \n/hooks | \n Supports PreToolUse / PostToolUse / Notification / Stop | \n
/permissions | \n /permissions | \n View or update tool permissions (read/write files, execute commands, etc.) | \n/permissions | \n Restricting permissions enhances operational security | \n
/sandbox | \n /sandbox | \n Enable isolated sandbox environment for Bash commands to avoid affecting the host system | \n/sandbox | \n Useful for testing uncertain scripts | \n
/doctor | \n /doctor | \n Diagnose installation status: check dependencies, configuration, and network connectivity | \n/doctor | \n Run first when encountering anomalies | \n
Model & Output
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/model | \n /model | \n Switch underlying AI model; without arguments, shows interactive selection menu | \n/model claude-haiku-4-5-20251001 | \n See model reference table below | \n
/plan | \n /plan | \n Enter planning mode: Claude outputs an execution plan for confirmation before proceeding | \n/plan Refactor the authentication module and add tests | \n Recommended for complex, multi-step tasks to avoid deviation | \n
/output-style | \n /output-style | \n Set response format (code-first, explanation-first, concise mode, etc.) | \n/output-style | \n β | \n
/theme | \n /theme | \n Switch terminal color scheme | \n/theme | \n β | \n
/statusline | \n /statusline | \n Customize terminal bottom status bar content | \n/statusline | \n β | \n
/vim | \n /vim | \n Enable Vim keybindings | \n/vim | \n Recommended for Vim users | \n
/terminal-setup | \n /terminal-setup | \n Install Shift+Enter line-break binding for multi-line prompt input | \n /terminal-setup | \n Recommended configuration on first use | \n
Available Models (2026):
\n\n| Model Identifier | \nPositioning | \nUse Cases | \n
|---|---|---|
claude-sonnet-4-6 | \n Balanced (default) | \nGeneral development tasks; preferred for Pro/Max5 users | \n
claude-haiku-4-5-20251001 | \n Fast & lightweight | \nSimple queries, saving tokens in custom commands | \n
claude-opus-4-6 | \n High-capability flagship | \nComplex architecture planning, challenging code reasoning; default for Max20 users | \n
Code & Tools
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/review | \n /review | \n Perform structured Code Review on recently modified code, outputting improvement suggestions by priority | \n/review | \n β | \n
/security-review | \n /security-review | \n Conduct security-focused review of current changes (SQL injection, XSS, sensitive data leaks, etc.) | \n/security-review | \n Essential before deployment | \n
/pr-comments | \n /pr-comments | \n Pull review comments for the current branchβs associated PR and handle them directly in the terminal | \n/pr-comments | \n Requires GitHub integration setup | \n
/install-github-app | \n /install-github-app | \n Configure GitHub Actions integration for automatic Claude PR reviews | \n/install-github-app | \n Generates .github/workflows/claude-code-review.yml | \n
/agents | \n /agents | \n View, create, and manage specialized sub-agents (e.g., DB expert, security expert, QA expert) | \n/agents | \n β | \n
/bashes | \n /bashes | \n View currently running background Bash processes; interrupt or inspect output | \n/bashes | \n β | \n
/skills NEW | \n /skills | \n List all available Skills (built-in + project-level + personal-level), including descriptions and trigger methods | \n/skills | \n Some Skills may be excluded if context budget is insufficient; use this command to verify load status | \n
Integration & Extensions
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/mcp | \n /mcp | \n Manage MCP server connections (connect/disconnect/view available tools) | \n/mcp | \n See Section 7 for detailed MCP command explanation | \n
/ide | \n /ide | \n Configure integration with IDEs (e.g., VSCode, JetBrains) | \n/ide | \n β | \n
/plugin | \n /plugin | \n Manage Claude Code plugins: install, uninstall, update, browse marketplace | \n/plugin install typescript-lsp | \n Official plugin marketplace includes 36 curated plugins | \n
/teleport | \n /teleport | \n Migrate a session started on claude.ai to local terminal (cloud β local direction) | \n/teleport | \n Requires GitHub App installation; supports only GitHub-hosted repositories | \n
/plugin Subcommands:
| Subcommand | \nFunction | \n
|---|---|
/plugin install <name> | \n Install specified plugin | \n
/plugin list | \n List all installed plugins | \n
/plugin update | \n Update all installed plugins | \n
/plugin marketplace | \n Browse official plugin marketplace | \n
/plugin uninstall <name> | \n Uninstall specified plugin | \n
Statistics & Account
\n\n| Command | \nSyntax | \nFunction Description | \nUsage Example | \nNotes | \n
|---|---|---|---|---|
/cost | \n /cost | \n Display current sessionβs token consumption and estimated cost | \n/cost | \n Visible to API billing users; subscription users have tokens included in plan | \n
/usage | \n /usage | \n View current plan usage, remaining quota, and rate limit status | \n/usage | \n β | \n
/stats | \n /stats | \n Display historical usage data (daily tokens / session count) in charts | \n/stats | \n β | \n
/release-notes | \n /release-notes | \n View Claude Codeβs latest version changelog | \n/release-notes | \n β | \n
/bug | \n /bug | \n Pack current session context and submit a bug report to Anthropic | \n/bug | \n β | \n
/login | \n /login | \n Login or switch Anthropic account | \n/login | \n Useful for developers with multiple accounts | \n
/logout | \n /logout | \n Logout current account | \n/logout | \n β | \n
/privacy-settings | \n /privacy-settings | \n Manage data usage preferences (e.g., whether to allow conversations for model training) | \n/privacy-settings | \n β | \n
/remote-env | \n /remote-env | \n Configure environment variables for remote sessions | \n/remote-env | \n β | \n
\n\n
2. Built-in Skills NEW
\n\nBuilt-in Skills are pre-configured AI workflows bundled with Claude Code. Unlike built-in commands, they load detailed prompts and rely on Claudeβs reasoning to produce richer analysis and operational resultsβalso triggered with /.
Distinction: Built-in Commands vs Built-in Skills
\n\n- \n
- Built-in commands (e.g.,
/clear,/compact) execute fixed logic without AI reasoning and are extremely fast. \n - Built-in Skills (e.g.,
/debug,/simplify) load prompts and rely on Claudeβs reasoning to produce richer, more detailed outputsβideal for complex analysis tasks. \n
| Command | \nFunction Description | \nUse Cases | \n
|---|---|---|
/simplify | \n Simplify specified code or text to improve readability and eliminate unnecessary complexity | \nRefactoring overly verbose functions, simplifying over-engineered code | \n
/debug | \n Systematically analyze error messages or anomalous behavior to identify root causes and propose fixes | \nLocating elusive bugs that are hard to reproduce | \n
/batch | \n Execute the same task across multiple files or targets in parallel (e.g., bulk rename, add type annotations) | \nLarge-scale repetitive code modifications | \n
/loop | \n Repeatedly execute an operation in a loop until an exit condition is met (e.g., retry tests until passing) | \nAutomating CI fix loops | \n
/claude-api | \n Quickly generate example code for calling the Anthropic API, supporting specified models and task types | \nBuilding Claude API integration prototypes | \n
\n\n
3. Command Prefix Syntax
\n\n| Prefix | \nSyntax | \nFunction Description | \nExample | \nComparison | \n
|---|---|---|---|---|
/ | \n /command | \n Trigger built-in commands, built-in Skills, or custom Skills/Commands | \n/review | \n β | \n
! | \n !<bash-command> | \n Directly execute shell commands, bypassing AI processing to save tokens | \n!ls -la | \n β | \n
YouTip