Command reference
Current Claude Code command reference covering CLI flags, slash commands, background agents, reviews, permission modes, and interactive shortcuts.
Claude Code has two kinds of commands: claude ... startup commands in your terminal, and slash commands beginning with / inside a session. Commands change across releases; check /help and claude --help whenever uncertain.
For the effect of each command on 5-minute/1-hour caching, see Commands and cache effects.
To organize these commands into daily development, see Best practices and workflows.
For keyboard shortcuts, Vim mode, shell mode, background Bash, tmux, fullscreen, and voice input, see Interactive mode and terminal experience.
The old /vim command has been removed. Switch between Vim and normal input using Editor mode in /config.
Not every command appears in your / menu. Official commands are shown dynamically based on Claude Code version, platform, authentication, plan, provider, and environment variables. Your current /help, / menu, and claude --help remain the most reliable immediate references.
#CLI startup commands
| Command | Purpose |
|---|---|
claude | Start an interactive session |
claude "query" | Start interactively with an initial prompt |
claude -p "query" | Print mode: run once and exit; see Headless automation |
claude -c -p "query" | Continue the latest session with a print-mode follow-up |
claude -p "Explain the error" < logs.txt | Pass stdin contents to Claude |
claude -c | Continue the latest session in the current directory |
claude -r "<session>" | Resume a session by ID or name |
claude -n "<name>" | Name the session at startup |
claude update | Update Claude Code |
claude install stable | Install or reinstall a selected release |
claude doctor | Check installation, configuration, and authentication |
claude --safe-mode | Start with customizations disabled for troubleshooting |
#Common CLI flags
| Flag | Purpose |
|---|---|
--model <model> | Select a model |
--effort <level> | Set reasoning effort |
--permission-mode <mode> | Start with a specific permission mode |
--add-dir <path> | Grant access to another directory |
--settings <json/path> | Apply temporary settings overrides |
--mcp-config <path> | Load additional MCP configuration |
--strict-mcp-config | Use only the specified MCP configuration |
--tools "Bash,Edit,Read" | Restrict the built-in tool set |
--allowedTools "Read,Edit" | Preapprove tools; does not restrict the tool set |
--disallowedTools "mcp__*" | Disable tools or MCP tools |
--output-format json | Output JSON in print mode |
--input-format stream-json | Accept streaming JSON input |
--json-schema <schema> | Constrain structured output |
--worktree <name> | Run in an isolated git worktree; see Worktrees |
--fork-session | Branch a continued or resumed session |
--plugin-dir <path> | Temporarily load a local plugin directory |
--append-system-prompt <text> | Append a one-time system instruction |
--system-prompt <text> | Replace the default system prompt; use carefully |
--setting-sources user,project,local | Select settings sources to load |
--remote-control | Start or connect Remote Control |
--allowedTools means “preapprove,” not “allow only.” Use --tools to restrict which built-in tools Claude can see. Use --disallowedTools or permissions deny to prohibit tools.
#Subcommands
| Command | Purpose |
|---|---|
claude auth login | Log in to an Anthropic account; accepts --console |
claude auth logout | Log out |
claude auth status | Print authentication status |
claude mcp | Manage MCP servers |
claude mcp login <name> | Start MCP OAuth from the CLI |
claude mcp logout <name> | Clear MCP OAuth credentials |
claude agents | Open agent view or list background sessions as JSON |
claude attach <id> | Attach to a background session |
claude daemon status | Check the background session supervisor |
claude daemon stop --any | Stop the background supervisor |
claude logs <id> | View background session logs |
claude stop <id> | Stop a background session |
claude respawn <id> | Restart a background session |
claude rm <id> | Remove a background session from the list |
claude plugin | Manage plugins |
claude plugins | Alias for claude plugin |
claude plugin init <name> | Initialize a plugin in the skills directory |
claude gateway | Start the Claude apps gateway as an administrator |
claude project purge | Clear local Claude Code project state |
claude auto-mode defaults | Print built-in auto mode classification rules |
claude auto-mode config | Print effective auto mode configuration |
claude setup-token | Generate a long-lived OAuth token for scripts |
claude remote-control | Start Remote Control in server mode |
#In-session commands: project setup
| Command | Purpose |
|---|---|
/init | Generate or improve the project's CLAUDE.md |
/memory | Open and edit memory files |
/mcp | View, authenticate, and manage MCP servers |
/permissions | Manage allow/ask/deny rules |
/config | Open settings or change them with key=value; see Output styles |
/status | Open the status page |
/doctor | Diagnose installation, login, and configuration issues |
/debug | Open debugging information |
/hooks | Inspect hook configuration and execution status |
/skills | List, filter, sort, and toggle skill visibility |
/plugin list | List installed plugins |
/reload-plugins | Reload plugin changes |
/theme | Change the terminal theme |
/statusline | Configure the status line |
/chrome | Configure Claude in Chrome |
/claude-api [migrate] | Load Claude API/Managed Agents references or migrate code |
#In-session commands: active tasks
| Command | Purpose |
|---|---|
/plan | Enter plan mode to research before editing files |
/advisor [model|off] | Enable or disable the advisor tool |
/model | Change models, causing a cache miss |
/effort | Adjust reasoning effort, causing a cache miss |
/fast | Toggle fast mode |
/dataviz [request] | Bundled skill for charts, dashboards, and data visualization design |
/deep-research <question> | Bundled workflow for parallel searches and cross-checking sources |
/clear [name] | Clear context and start a conversation; optionally name the old session |
/compact [instructions] | Summarize history to free context |
/context [all] | Inspect context window usage |
/rewind | Rewind conversation and file checkpoints; see Checkpoints and rewind |
/recap | Generate a viewable summary without replacing history |
/btw <question> | Ask a side question outside conversation history |
/copy [N] | Copy the latest or a selected response |
/export | Export the current session |
/rename <name> | Name the current session |
/color [color|default] | Set the session prompt bar color |
/usage | View session cost, plan usage, and activity statistics |
/cost | Alias for /usage |
/stats | Alias for /usage |
/usage-credits | Configure usage credits beyond plan limits |
#In-session commands: parallel and background work
| Command | Purpose |
|---|---|
/tasks | View background tasks in the current session; also /bashes |
/background [prompt] | Move the current session to a background agent |
/bg | Alias for /background |
/stop | Stop the currently attached background session |
/batch <instruction> | Split a large change across parallel worktrees/subagents |
/branch [name] | Branch the session from the current point |
/fork | Delegate the current context to a background subtask |
/agents | Show guidance for or manage subagent configuration |
/workflows | View dynamic workflow progress |
/goal | Set a completion condition for continued work |
/loop | Repeated checks or scheduled prompts with schedule/monitor; see Routines and /loop scheduling |
For choosing between agents, background sessions, and workflows, see Parallel agents, background work, and workflows.
#In-session commands: review and release preparation
| Command | Purpose |
|---|---|
/diff | Inspect current changes |
/code-review [level] [--fix] | Review the current diff and optionally fix findings |
/review | Read-only review of a GitHub PR |
/security-review | Deeper security review |
/simplify [target] | Cleanup-only review and fixes |
/verify | Build, run, and observe whether the app actually works |
/ultrareview | Deep cloud review; /code-review ultra is the recommended newer form |
/ultraplan <prompt> | Draft a deeper plan in the cloud, then execute in the terminal |
/autofix-pr [prompt] | Have Claude Code on the web monitor and fix PR failures and comments |
#Sessions and remote access
| Command | Purpose |
|---|---|
/resume | Resume a previous session |
/cd <path> | Move the current session to another working directory |
/add-dir <path> | Add an accessible directory |
/teleport | Bring a web session into the current terminal |
/remote-control | Allow the Claude app or claude.ai to control a local session |
/web-setup | Connect GitHub to Claude Code on the web |
/schedule | Schedule one-time or recurring tasks; see Routines and /loop scheduling |
/terminal-setup | Configure terminal shortcuts |
/tui [default/fullscreen] | Switch the terminal UI renderer |
/voice [hold/tap/off] | Voice input |
/desktop | Open or connect desktop capabilities; varies by platform and authentication |
/upgrade | Open the upgrade entry point; varies by plan |
/feedback | Report an issue with session context |
For Web, Remote Control, /teleport, and Passion8 custom Base URL boundaries, see Web, Remote Control, and mobile. For scheduling details, see Routines and /loop scheduling.
#Environment-dependent official commands
These commands are not available to every account, platform, or provider. Availability commonly depends on Claude Code version, authentication, Claude subscription, operating system, Anthropic API/Bedrock/Vertex/Foundry routing, GitHub/Slack permissions, and terminal capabilities.
| Command | Purpose | Availability and boundaries |
|---|---|---|
/help | Show commands available in the current environment | The most reliable immediate command source, closer to your version than static documentation |
/login | Log in to Anthropic or Claude | Usually unnecessary with the Passion8 custom Base URL; use when troubleshooting official account features |
/logout | Log out of the current account | Affects subsequent official features; not a routine cache optimization command |
/ide | Manage IDE integration and connection | Mainly VS Code, JetBrains, and other IDE environments |
/desktop, /app | Hand the session to Claude Code Desktop | macOS/Windows with Claude subscription authentication |
/mobile, /qr | Generate a mobile connection QR code | Continue remotely through Claude mobile or Web |
/remote-env | Select the default cloud agent environment | Affects future cloud sessions; differs from local /cd |
/install-github-app | Install the Claude GitHub App, then configure Actions and secrets | Requires GitHub permissions and gh state; for repository automation |
/install-slack-app | Install the Claude Slack app | Requires Slack workspace permissions |
/design-login | Authorize design system access for /design-sync | Depends on claude.ai account capabilities |
/design-sync [hint] | Upload a React design system to Claude Design | Available on Anthropic API; unavailable on Bedrock, Google Cloud Agent Platform, or Foundry when underlying tools cannot reach claude.ai |
/powerup | Learn Claude Code features interactively | Tutorial entry point, not a production workflow command |
/fewer-permission-prompts | Scan history and suggest an allowlist to reduce prompts | Changes permission behavior; use after confirming project isolation |
/focus | Toggle a quieter fullscreen focus view | Visual mode requiring fullscreen/TUI support |
/scroll-speed | Adjust fullscreen scrolling speed | Mainly relevant to the fullscreen renderer |
/keybindings | Inspect or configure keybindings | Support depends on the terminal and host editor |
/exit | Exit or detach from the current interface | Meaning varies in background sessions, fullscreen, and other views |
/run | Start and drive the app using its project recipe | Depends on a project skill or build instructions from /run-skill-generator |
/run-skill-generator | Generate a project run/verification skill | Rerun after the project build workflow changes |
/sandbox | Toggle sandbox mode | Requires a supported OS, installation, and permission policy |
/release-notes | Read release notes | Check whether commands were added, renamed, or removed |
/reload-skills | Reload skills | Distinct from /reload-plugins; focuses on skill visibility and content |
/insights | Generate a session usage and friction report | Reads history/usage data and can produce a long report |
/heapdump | Generate a diagnostic heap snapshot | For memory troubleshooting, not routine workflows |
/privacy-settings | Open Pro/Max privacy settings | Only for applicable accounts and plans |
/passes | Manage passes or allowance-related features | Account-specific, not a core development command |
/pr-comments | Access or process PR comments | Requires GitHub/PR context |
/setup-bedrock | Configure Amazon Bedrock | Shown for Bedrock environment variables or setup wizard entry points |
/setup-vertex | Configure Google Vertex AI | Shown for Vertex environment variables or setup wizard entry points |
/team-onboarding | Generate team onboarding docs from recent usage | Reads local usage history; useful for team adoption |
/stickers | Order Claude Code stickers | Non-core feature depending on account and region |
/radio | Open Claude Code radio | Entertainment or experimental feature; does not affect core development |
/vim | Old Vim mode command | Removed in v2.1.92; use Editor mode in /config |
#Input shortcuts
| Input | Purpose |
|---|---|
/ | Open command completion |
! | Shell mode: run a command and include output in context |
@ | Reference files, directories, or resources |
# | Quickly write to memory |
| Paste an image | Add a screenshot or design image to context |
#Common keyboard shortcuts
| Shortcut | Purpose |
|---|---|
Ctrl+C | Cancel input or interrupt |
Ctrl+D | Exit |
Ctrl+L | Clear the screen without clearing context |
Ctrl+R | Search history |
Ctrl+O | Expand/collapse the transcript |
Ctrl+B | Access background task/session features |
Ctrl+T | Toggle the TODO view |
Esc | Interrupt the current response |
Esc twice | Rewind and edit the previous message |
Shift+Tab | Cycle permission modes |
Option+P | Access plan-related actions |
Option+T | Open the task view |
Option+O | Open output/transcript features |
Support for Option, Shift+Enter, and image pasting varies by terminal. Run /terminal-setup first if these are unreliable.
#Permission modes at a glance
| Mode | Description |
|---|---|
default | Default; commands and file writes require confirmation |
acceptEdits | Automatically accepts edits |
plan | Read-only research without source changes |
auto | Automatic approval research preview |
dontAsk | Rejects anything not preapproved |
bypassPermissions | Skips most prompts; use only in isolated environments |
#Commands and cache effects
This table relates common commands to 5-minute/1-hour caching. TTL determines expiry after inactivity; it does not change which actions hit or invalidate the cache. See Commands and cache effects for the full command-by-command table.
| Command or action | Cache effect | How to interpret 5m / 1h |
|---|---|---|
| Normal follow-up | Usually hits the old prefix and processes only new content | Continued conversation within 5m or 1h refreshes TTL |
/model | Model is a cache key; full miss next turn | Longer TTL cannot share cache across models |
/effort | Effort is a cache key; full miss next turn | Choose effort early and avoid mid-task changes |
/fast | First activation may miss due to header or model changes | Most expensive when enabled midway through a long session |
/compact | Summary request reads the old cache, then rebuilds a shorter history cache | Use at natural breaks, not every turn |
/clear | New session reloads project context | The old session remains available through /resume |
/rewind | Returns to an earlier prefix and can usually hit old cache | Better suited than compact for abandoning a wrong direction |
/recap | Adds summary output without replacing history | Cache-friendly, but does not free context |
/cd | Official behavior attempts to preserve conversation cache | New directory CLAUDE.md is appended as a message |
Change outputStyle in /config | Usually does not replace the current system prompt immediately; applies after /clear or a new session | First turn after applying it usually fully misses |
/statusline | Setup is ordinary conversation; script refreshes do not call the model | Runs locally without consuming 5m/1h cache |
/usage / /cost / /stats | Shows usage without changing the prompt prefix | Viewing usage does not invalidate cache |
/theme | Changes terminal UI without changing the model prompt | No effect on 5m/1h hits |
/advisor | Tool definition follows the cache breakpoint, usually preserving the old prefix | Enable per task, subject to provider support |
/batch | Adds a plan to the parent; background subagents build their own caches | Parallel work increases total tokens but keeps the parent context focused |
/background / /bg | Continues the same session in the background | TTL is not refreshed while the background session is stopped |
/goal | Setting a goal does not change the system prefix | Subsequent automatic turns refresh TTL normally |
/loop / /schedule | Triggers new turns periodically | Intervals over 5m can leave 5m cache cold; 1h is more resilient |
Connect/disconnect a server in /mcp | May fully miss when tool schemas are supplied upfront | Tool search/deferred tools are more cache-friendly |
/reload-plugins | Skills/hooks/agents usually append; MCP depends on tool search | The first turn after reload shows the cost |
Edit CLAUDE.md | Does not immediately apply or invalidate the current session | Loaded after /clear, /compact, or restart |
| Change permission mode | Usually does not affect the prompt | Plan with opusplan can miss due to model switching |
| Subagents | Have independent context and cache | Official docs specify 5m TTL for subagents; parent session is unaffected |
/branch or fork | Copies an existing prefix and can read the parent cache | More likely to hit within TTL |
See Commands and cache effects, Prompt caching, Models, effort, and fast mode, Context window, Output styles, Status line, Subagents, and Worktrees.
#Custom commands
Save reusable prompts in .claude/commands/<name>.md:
---
description: Review current changes and identify issues
argument-hint: [optional: target files or focus area]
---
Review the current git changes, focusing on $ARGUMENTS.
Start with `git diff --stat`, then list potential bugs, risks, and recommendations.Invoke it:
/review authentication moduleMCP servers can also expose prompts, with names such as /mcp__<server>__<prompt>.
#Official references
Support
Need help?
For setup, billing, or model issues, email us. Check the status page for uptime.
WeChat / QQ support is available at the bottom right.

