Claude Code

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

CommandPurpose
claudeStart 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.txtPass stdin contents to Claude
claude -cContinue 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 updateUpdate Claude Code
claude install stableInstall or reinstall a selected release
claude doctorCheck installation, configuration, and authentication
claude --safe-modeStart with customizations disabled for troubleshooting

#Common CLI flags

FlagPurpose
--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-configUse 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 jsonOutput JSON in print mode
--input-format stream-jsonAccept streaming JSON input
--json-schema <schema>Constrain structured output
--worktree <name>Run in an isolated git worktree; see Worktrees
--fork-sessionBranch 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,localSelect settings sources to load
--remote-controlStart 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

CommandPurpose
claude auth loginLog in to an Anthropic account; accepts --console
claude auth logoutLog out
claude auth statusPrint authentication status
claude mcpManage MCP servers
claude mcp login <name>Start MCP OAuth from the CLI
claude mcp logout <name>Clear MCP OAuth credentials
claude agentsOpen agent view or list background sessions as JSON
claude attach <id>Attach to a background session
claude daemon statusCheck the background session supervisor
claude daemon stop --anyStop 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 pluginManage plugins
claude pluginsAlias for claude plugin
claude plugin init <name>Initialize a plugin in the skills directory
claude gatewayStart the Claude apps gateway as an administrator
claude project purgeClear local Claude Code project state
claude auto-mode defaultsPrint built-in auto mode classification rules
claude auto-mode configPrint effective auto mode configuration
claude setup-tokenGenerate a long-lived OAuth token for scripts
claude remote-controlStart Remote Control in server mode

#In-session commands: project setup

CommandPurpose
/initGenerate or improve the project's CLAUDE.md
/memoryOpen and edit memory files
/mcpView, authenticate, and manage MCP servers
/permissionsManage allow/ask/deny rules
/configOpen settings or change them with key=value; see Output styles
/statusOpen the status page
/doctorDiagnose installation, login, and configuration issues
/debugOpen debugging information
/hooksInspect hook configuration and execution status
/skillsList, filter, sort, and toggle skill visibility
/plugin listList installed plugins
/reload-pluginsReload plugin changes
/themeChange the terminal theme
/statuslineConfigure the status line
/chromeConfigure Claude in Chrome
/claude-api [migrate]Load Claude API/Managed Agents references or migrate code

#In-session commands: active tasks

CommandPurpose
/planEnter plan mode to research before editing files
/advisor [model|off]Enable or disable the advisor tool
/modelChange models, causing a cache miss
/effortAdjust reasoning effort, causing a cache miss
/fastToggle 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
/rewindRewind conversation and file checkpoints; see Checkpoints and rewind
/recapGenerate a viewable summary without replacing history
/btw <question>Ask a side question outside conversation history
/copy [N]Copy the latest or a selected response
/exportExport the current session
/rename <name>Name the current session
/color [color|default]Set the session prompt bar color
/usageView session cost, plan usage, and activity statistics
/costAlias for /usage
/statsAlias for /usage
/usage-creditsConfigure usage credits beyond plan limits

#In-session commands: parallel and background work

CommandPurpose
/tasksView background tasks in the current session; also /bashes
/background [prompt]Move the current session to a background agent
/bgAlias for /background
/stopStop the currently attached background session
/batch <instruction>Split a large change across parallel worktrees/subagents
/branch [name]Branch the session from the current point
/forkDelegate the current context to a background subtask
/agentsShow guidance for or manage subagent configuration
/workflowsView dynamic workflow progress
/goalSet a completion condition for continued work
/loopRepeated 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

CommandPurpose
/diffInspect current changes
/code-review [level] [--fix]Review the current diff and optionally fix findings
/reviewRead-only review of a GitHub PR
/security-reviewDeeper security review
/simplify [target]Cleanup-only review and fixes
/verifyBuild, run, and observe whether the app actually works
/ultrareviewDeep 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

CommandPurpose
/resumeResume a previous session
/cd <path>Move the current session to another working directory
/add-dir <path>Add an accessible directory
/teleportBring a web session into the current terminal
/remote-controlAllow the Claude app or claude.ai to control a local session
/web-setupConnect GitHub to Claude Code on the web
/scheduleSchedule one-time or recurring tasks; see Routines and /loop scheduling
/terminal-setupConfigure terminal shortcuts
/tui [default/fullscreen]Switch the terminal UI renderer
/voice [hold/tap/off]Voice input
/desktopOpen or connect desktop capabilities; varies by platform and authentication
/upgradeOpen the upgrade entry point; varies by plan
/feedbackReport 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.

CommandPurposeAvailability and boundaries
/helpShow commands available in the current environmentThe most reliable immediate command source, closer to your version than static documentation
/loginLog in to Anthropic or ClaudeUsually unnecessary with the Passion8 custom Base URL; use when troubleshooting official account features
/logoutLog out of the current accountAffects subsequent official features; not a routine cache optimization command
/ideManage IDE integration and connectionMainly VS Code, JetBrains, and other IDE environments
/desktop, /appHand the session to Claude Code DesktopmacOS/Windows with Claude subscription authentication
/mobile, /qrGenerate a mobile connection QR codeContinue remotely through Claude mobile or Web
/remote-envSelect the default cloud agent environmentAffects future cloud sessions; differs from local /cd
/install-github-appInstall the Claude GitHub App, then configure Actions and secretsRequires GitHub permissions and gh state; for repository automation
/install-slack-appInstall the Claude Slack appRequires Slack workspace permissions
/design-loginAuthorize design system access for /design-syncDepends on claude.ai account capabilities
/design-sync [hint]Upload a React design system to Claude DesignAvailable on Anthropic API; unavailable on Bedrock, Google Cloud Agent Platform, or Foundry when underlying tools cannot reach claude.ai
/powerupLearn Claude Code features interactivelyTutorial entry point, not a production workflow command
/fewer-permission-promptsScan history and suggest an allowlist to reduce promptsChanges permission behavior; use after confirming project isolation
/focusToggle a quieter fullscreen focus viewVisual mode requiring fullscreen/TUI support
/scroll-speedAdjust fullscreen scrolling speedMainly relevant to the fullscreen renderer
/keybindingsInspect or configure keybindingsSupport depends on the terminal and host editor
/exitExit or detach from the current interfaceMeaning varies in background sessions, fullscreen, and other views
/runStart and drive the app using its project recipeDepends on a project skill or build instructions from /run-skill-generator
/run-skill-generatorGenerate a project run/verification skillRerun after the project build workflow changes
/sandboxToggle sandbox modeRequires a supported OS, installation, and permission policy
/release-notesRead release notesCheck whether commands were added, renamed, or removed
/reload-skillsReload skillsDistinct from /reload-plugins; focuses on skill visibility and content
/insightsGenerate a session usage and friction reportReads history/usage data and can produce a long report
/heapdumpGenerate a diagnostic heap snapshotFor memory troubleshooting, not routine workflows
/privacy-settingsOpen Pro/Max privacy settingsOnly for applicable accounts and plans
/passesManage passes or allowance-related featuresAccount-specific, not a core development command
/pr-commentsAccess or process PR commentsRequires GitHub/PR context
/setup-bedrockConfigure Amazon BedrockShown for Bedrock environment variables or setup wizard entry points
/setup-vertexConfigure Google Vertex AIShown for Vertex environment variables or setup wizard entry points
/team-onboardingGenerate team onboarding docs from recent usageReads local usage history; useful for team adoption
/stickersOrder Claude Code stickersNon-core feature depending on account and region
/radioOpen Claude Code radioEntertainment or experimental feature; does not affect core development
/vimOld Vim mode commandRemoved in v2.1.92; use Editor mode in /config

#Input shortcuts

InputPurpose
/Open command completion
!Shell mode: run a command and include output in context
@Reference files, directories, or resources
#Quickly write to memory
Paste an imageAdd a screenshot or design image to context

#Common keyboard shortcuts

ShortcutPurpose
Ctrl+CCancel input or interrupt
Ctrl+DExit
Ctrl+LClear the screen without clearing context
Ctrl+RSearch history
Ctrl+OExpand/collapse the transcript
Ctrl+BAccess background task/session features
Ctrl+TToggle the TODO view
EscInterrupt the current response
Esc twiceRewind and edit the previous message
Shift+TabCycle permission modes
Option+PAccess plan-related actions
Option+TOpen the task view
Option+OOpen 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

ModeDescription
defaultDefault; commands and file writes require confirmation
acceptEditsAutomatically accepts edits
planRead-only research without source changes
autoAutomatic approval research preview
dontAskRejects anything not preapproved
bypassPermissionsSkips most prompts; use only in isolated environments

See Permissions and modes.

#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 actionCache effectHow to interpret 5m / 1h
Normal follow-upUsually hits the old prefix and processes only new contentContinued conversation within 5m or 1h refreshes TTL
/modelModel is a cache key; full miss next turnLonger TTL cannot share cache across models
/effortEffort is a cache key; full miss next turnChoose effort early and avoid mid-task changes
/fastFirst activation may miss due to header or model changesMost expensive when enabled midway through a long session
/compactSummary request reads the old cache, then rebuilds a shorter history cacheUse at natural breaks, not every turn
/clearNew session reloads project contextThe old session remains available through /resume
/rewindReturns to an earlier prefix and can usually hit old cacheBetter suited than compact for abandoning a wrong direction
/recapAdds summary output without replacing historyCache-friendly, but does not free context
/cdOfficial behavior attempts to preserve conversation cacheNew directory CLAUDE.md is appended as a message
Change outputStyle in /configUsually does not replace the current system prompt immediately; applies after /clear or a new sessionFirst turn after applying it usually fully misses
/statuslineSetup is ordinary conversation; script refreshes do not call the modelRuns locally without consuming 5m/1h cache
/usage / /cost / /statsShows usage without changing the prompt prefixViewing usage does not invalidate cache
/themeChanges terminal UI without changing the model promptNo effect on 5m/1h hits
/advisorTool definition follows the cache breakpoint, usually preserving the old prefixEnable per task, subject to provider support
/batchAdds a plan to the parent; background subagents build their own cachesParallel work increases total tokens but keeps the parent context focused
/background / /bgContinues the same session in the backgroundTTL is not refreshed while the background session is stopped
/goalSetting a goal does not change the system prefixSubsequent automatic turns refresh TTL normally
/loop / /scheduleTriggers new turns periodicallyIntervals over 5m can leave 5m cache cold; 1h is more resilient
Connect/disconnect a server in /mcpMay fully miss when tool schemas are supplied upfrontTool search/deferred tools are more cache-friendly
/reload-pluginsSkills/hooks/agents usually append; MCP depends on tool searchThe first turn after reload shows the cost
Edit CLAUDE.mdDoes not immediately apply or invalidate the current sessionLoaded after /clear, /compact, or restart
Change permission modeUsually does not affect the promptPlan with opusplan can miss due to model switching
SubagentsHave independent context and cacheOfficial docs specify 5m TTL for subagents; parent session is unaffected
/branch or forkCopies an existing prefix and can read the parent cacheMore 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:

.claude/commands/review.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 module

MCP 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.