Skip to content

Claude Code โ€” Command Cheat Sheet (v2.x)

Complete command reference for Claude Code v2.x (docs current as of Aug 2026). Covers: slash commands (all), CLI subcommands, key flags, keyboard shortcuts, and input prefixes. Quick-lookup cheat sheet โ€” explanations are condensed; see the official CLI reference for details.

1. Slash Commands โ€” Session & Conversation

Command What it does Example
/add-dir <path> Grant file access to an extra working directory for this session (monorepos) /add-dir ../shared-lib
/background [prompt] Detach current session to run as a background agent, freeing the terminal /background finish the tests
/branch [name] Branch the conversation at this point to try another direction (keep the original) /branch try-approach-B
/btw [question] Ask a side question without adding to the conversation context /btw what's the convention for error types?
/cd <path> Move the session to a new working directory, keeping the conversation /cd src/api
/clear [name] Start a fresh conversation (empty context); keep project memory /clear
/compact [focus] Summarize the conversation to free context (CLAUDE.md survives) /compact focus on the auth logic
/context [all] Visualize context usage as a colored grid with optimization tips /context
/copy [N] Copy the last (or Nth-latest) assistant response to the clipboard /copy 2
/export [filename] Export the conversation as plain text (file or clipboard) /export session.txt
/focus Toggle focus view: only last prompt, tool summary, and final response /focus
/fork [prompt] Copy this conversation into a new background session and keep working here /fork run the perf analysis
/goal <condition> Keep working across turns until the condition is met /goal all tests pass
/recap Generate a one-line summary of the current session /recap
/rename [name] Rename the current session (shown on prompt bar, in /resume) /rename auth-refactor
/resume [session] Resume a conversation by ID or name, or open the picker /resume auth-refactor
/rewind Rewind conversation and/or code to a previous checkpoint (aliases: /checkpoint, /undo) /rewind
/exit Exit the CLI (in a background session: detaches, session keeps running) /exit
/teleport Pull a Claude Code web session into this terminal /teleport
/remote-control Make this session controllable from claude.ai / the Claude app /remote-control

2. Slash Commands โ€” Review & Code Quality

Command What it does Example
/code-review [level] [--fix] [pr#\|branch\|path] Review diff/PR/branch for correctness bugs + cleanups (alias: /review) /code-review high 1234 --fix
/security-review Analyze branch diff for security vulnerabilities (injection, auth, data exposure) /security-review
/simplify [target] Run 4 parallel review agents over changed code and apply cleanup fixes /simplify src/utils.ts
/ultrareview [PR\|branch] Deep multi-agent review in a cloud sandbox /ultrareview main
/diff Interactive diff viewer (current git diff + per-turn diffs) /diff
/verify Build & run your app to confirm a change works (not just tests) /verify
/run Launch and drive your project's app to see the change live /run
/run-skill-generator Write a per-project skill teaching /run and /verify how to launch your app /run-skill-generator

3. Slash Commands โ€” Planning, Model & Modes

Command What it does Example
/plan [description] Enter plan mode (think first, then propose) /plan fix the login bug
/model [model] Switch model and save as default (arrows adjust effort) /model opus
/effort [level] Set reasoning effort: lowโ†’xhigh, max, ultracode, or auto /effort high
/fast [on\|off] Toggle fast mode (skip non-essential work) /fast on
/advisor [model\|off] Enable a second model that advises at key moments (fable, opus, sonnet) /advisor opus
/autocompact [auto\|<tokens>] Set when context auto-compacts (e.g. 500k) /autocompact 500k
/permissions Manage allow/ask/deny tool-permission rules /permissions
/sandbox Toggle sandbox mode (isolated execution) /sandbox
/tui [default\|fullscreen] Switch terminal renderer (fullscreen = flicker-free) /tui fullscreen
/theme Change color theme (auto/light/dark/colorblind-safe) /theme dark
/color [color] Set the prompt-bar color (red, blue, green, yellow, purple, orange, pink, cyan) /color cyan
/statusline Configure the status line (describe what you want) /statusline show git branch
/voice [hold\|tap\|off] Toggle voice dictation /voice tap

4. Slash Commands โ€” Configuration & Admin

Command What it does Example
/init Create a CLAUDE.md project memory file (interactive walkthrough optional) /init
/memory Edit CLAUDE.md files, toggle auto memory, view entries /memory
/config [key=value...] Open Settings UI, or set values directly (v2.1.181+) /config theme=dark
/keybindings Open your keyboard shortcuts file /keybindings
/hooks View hook configurations for tool events /hooks
/ide Manage IDE integrations and status /ide
/mcp [subcommand] Manage MCP servers + OAuth (no args = interactive list) /mcp reconnect github
/plugin [subcommand] Manage plugins (list, install, enable, disable) /plugin install code-review
/reload-plugins [--force] Reload all active plugins without restarting /reload-plugins
/reload-skills Re-scan skill/command dirs without restarting /reload-skills
/skills List available skills (filter, sort by tokens) /skills
/import [codex\|gemini] Import config from Codex / Gemini CLI (aliases incl. --dry-run) /import codex --dry-run
/status Settings โ†’ Status tab: version, model, account, connectivity /status
/usage Session cost, plan limits, activity stats (aliases: /cost, /stats) /usage
/usage-credits Configure / request usage credits when hitting a limit /usage-credits
/rate-limit-options Options when a usage limit blocks a request (wait, credits, upgrade) /rate-limit-options
/login Sign in to your Anthropic account /login
/logout Sign out /logout
/privacy-settings View/update privacy settings (Pro/Max plans) /privacy-settings
/upgrade Open the upgrade page for a higher plan tier /upgrade
/terminal-setup Install Shift+Enter newline binding for your terminal/editor /terminal-setup
/setup-bedrock Configure Amazon Bedrock auth/region/model (hidden unless CLAUDE_CODE_USE_BEDROCK=1) /setup-bedrock
/setup-vertex Configure Google Cloud Agent Platform auth/region/model /setup-vertex
/web-setup Connect GitHub to Claude Code on the web via local gh CLI /web-setup
/install-github-app Install the Claude GitHub App (+ optional Actions workflow) /install-github-app
/install-slack-app Install the Claude Slack app (browser OAuth) /install-slack-app
/auto-mode-setup Draft autoMode.environment entries from project + sessions /auto-mode-setup

5. Slash Commands โ€” Agents, Parallel Work & Automation

Command What it does Example
/agents Reminder UI to create/manage subagents (edit .claude/agents/) /agents
/list-agents List subagents, teammates, and sessions Claude can message /list-agents
/subtask <task> Spawn a forked subagent (inherits full conversation, works in background) /subtask add unit tests for auth
/tasks View/manage background work + finished subagents (alias: /bashes) /tasks
/batch <instruction> Decompose large change into 5โ€“30 units; run each in its own worktree + PR /batch migrate src/ from JS to TS
/deep-research <question> Fan out web searches, cross-check sources, synthesize a cited report /deep-research best RAG stack for SMB docs
/workflows Watch, pause, resume, save running/completed workflows /workflows
/schedule [description] Create/update/list routines that execute in the cloud /schedule nightly dependency bump
/loop [interval] [prompt] Run a prompt repeatedly while the session stays open /loop 30m run the test suite
/autofix-pr [prompt] Cloud session watches the current PR and pushes fixes on CI/review failures /autofix-pr only fix lint errors
/stop Stop the current background session (keeps transcript + worktree) /stop

6. Slash Commands โ€” Skills & Extras

Command What it does Example
/help Show help and all available commands /help
/doctor Setup checkup: diagnose + fix installation issues /doctor
/debug [description] Enable debug logging and troubleshoot from the session log /debug
/bug [report] Report a bug / share conversation (consent screen first) /bug
/feedback [report] Send product feedback /feedback
/insights HTML report analyzing your recent sessions (projects, habits, failures) /insights
/team-onboarding Generate a team onboarding guide from your usage history (30 days) /team-onboarding
/dataviz [request] Chart/graph design guidance (form, colors, palettes) /dataviz revenue by quarter
/design [brief] Draft UI mockups/landing pages as artifact artboards /design landing page for AI audit tool
/design-login Authorize design-system access for /design-sync /design-login
/design-sync [hint] Upload your React design system so Claude Design uses your components /design-sync
/artifacts List/attach/share your artifacts /artifacts
/chrome Configure Claude in Chrome settings /chrome
/desktop Continue the session in the Claude Code Desktop app (alias: /app) /desktop
/mobile QR code for the Claude mobile app (aliases: /ios, /android) /mobile
/claude-api [action] Load Claude API / Managed Agents reference for your project's language /claude-api cost-optimize
/fewer-permission-prompts Scan transcripts โ†’ prioritized allowlist in project settings /fewer-permission-prompts
/workflow-authoring Load the dynamic-workflow script reference /workflow-authoring
/powerup Interactive lessons on Claude Code features /powerup
/release-notes Changelog in an interactive version picker /release-notes
/passes Share a free week of Claude Code with friends /passes
/radio Open Claude FM lo-fi radio in the browser /radio
/stickers Order Claude Code stickers /stickers

Removed/deprecated: /vim (removed v2.1.92 โ†’ use /config โ†’ Editor mode), /pr-comments (removed v2.1.91 โ†’ just ask Claude), /ultraplan (removed โ†’ use plan mode), /enable-auto-mode flag (removed v2.1.111 โ†’ auto mode is in the Shift+Tab cycle).

7. CLI Subcommands (terminal)

Command What it does Example
claude Start interactive session claude
claude "query" Start session with initial prompt claude "explain this project"
claude -p "query" Print mode: one-shot, exits when done (SDK-style) claude -p "review this diff" --max-turns 10
cat file \| claude -p "query" Process piped content cat logs.txt \| claude -p "explain"
claude -c Continue most recent conversation in this directory claude -c -p "check for type errors"
claude -r "<session>" Resume session by ID or name claude -r "auth-refactor" "finish this PR"
claude update Update to the latest version claude update
claude install [version] Install/reinstall native binary (stable, latest, or version) claude install stable
claude auth login Sign in (--email, --sso, --console for API billing) claude auth login --console
claude auth logout Sign out claude auth logout
claude auth status Show auth status (JSON; --text human-readable; exit 0/1) claude auth status
claude agents Agent view: monitor/dispatch background sessions (--json) claude agents --json
claude attach <id> Attach to a background session in this terminal claude attach 7c5dcf5d
claude logs <id> Print recent output from a background session claude logs 7c5dcf5d
claude stop <id> Stop a background session (alias: claude kill) claude stop 7c5dcf5d
claude respawn <id> Restart a background session with conversation intact claude respawn 7c5dcf5d
claude rm <id> Remove a background session from the list claude rm 7c5dcf5d
claude mcp Configure MCP servers (add/list/remove/login/logout) claude mcp add github -- npx @modelcontextprotocol/server-github
claude plugin Manage plugins (alias: claude plugins) claude plugin install code-review@claude-plugins-official
claude doctor Installation/settings diagnostics (read-only) claude doctor
claude daemon status Background-session supervisor state claude daemon status
claude import [codex\|gemini] Import config from other coding agents claude import codex --dry-run
claude setup-token Generate a long-lived OAuth token for CI (subscription required) claude setup-token
claude remote-control Start Remote Control server (control from claude.ai / app) claude remote-control --name "My Project"
claude gateway --config Self-hosted Claude apps gateway (Bedrock / Vertex / Foundry, v2.1.195+) claude gateway --config gateway.yaml
claude project purge [path] Delete all local Claude Code state for a project claude project purge ~/work/repo --dry-run
claude ultrareview [target] Non-interactive deep review (--json, --post to PR) claude ultrareview 1234 --json
claude auto-mode defaults Print built-in auto-mode classifier rules (JSON) claude auto-mode defaults
claude self-hosted-runner setup Register this machine as a self-hosted runner (v2.1.224+) claude self-hosted-runner setup

8. Key CLI Flags

Flag What it does Example
-p, --print Non-interactive one-shot mode claude -p "fix the bug"
-c, --continue / -r, --resume <id> Continue / resume a session claude -r auth-refactor
--fork-session Resume with a new session ID (keeps history) claude -r abc123 --fork-session
--model <alias> Model: sonnet, opus, haiku, fable, or full name claude --model opus
--effort <level> Reasoning depth: low / medium / high / xhigh / max / ultracode claude --effort high
--permission-mode <mode> default, acceptEdits, plan, auto, dontAsk, bypassPermissions, manual claude --permission-mode plan
--dangerously-skip-permissions Auto-approve ALL tool use claude --dangerously-skip-permissions -p "task"
--allowedTools <tools> Whitelist tools (Bash(git commit *), mcp__server__tool, โ€ฆ) claude --allowedTools "Read,Edit"
--disallowedTools <tools> Blacklist tools claude --disallowedTools "Bash(rm *)"
--tools <tools> Override the built-in tool set ("" = none, "default" = all) claude --tools "Bash,Edit,Read"
--max-turns <n> Cap agentic turns (print mode) claude -p "task" --max-turns 10
--max-budget-usd <n> Cap API spend (print mode; min ~$0.05) claude -p "task" --max-budget-usd 5
--fallback-model <m> Auto-fallback when primary model is overloaded (chain with commas) claude -p "task" --fallback-model sonnet,haiku
--output-format <fmt> text / json / stream-json (print mode) claude -p "task" --output-format json
--json-schema <schema> Force validated structured JSON output claude -p "extract funcs" --json-schema '{...}'
--input-format <fmt> text / stream-json for stdin claude -p "task" --input-format stream-json
--verbose Full turn-by-turn output claude -p "task" --verbose
--include-partial-messages Include partial streaming chunks (stream-json) claude -p "task" --output-format stream-json --include-partial-messages
--append-system-prompt <text> Append to the default system prompt claude --append-system-prompt "Always use TypeScript"
--system-prompt <text> Replace the entire system prompt claude --system-prompt "You are a Python expert"
--bare Minimal mode: skip hooks, skills, plugins, MCP, CLAUDE.md, OAuth claude --bare -p "task"
--safe-mode All customizations disabled (troubleshoot config; keeps auth/tools) claude --safe-mode
--restricted Restricted mode for eval harnesses on shared machines (v2.1.248+) claude --restricted -p "task"
--agents '<json>' Define custom subagents dynamically claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'
--mcp-config <path> / --strict-mcp-config Load MCP servers from file; ignore all other MCP configs claude --mcp-config ./mcp.json --strict-mcp-config
--add-dir <paths> Grant additional working directories claude --add-dir ../apps ../lib
-w, --worktree [name] Run in an isolated git worktree (.claude/worktrees/<name>) claude -w feature-auth
--tmux Create a tmux session for the worktree claude -w feature-auth --tmux
--bg, --background Start as a background agent, return immediately claude --bg "investigate the flaky test"
--exec Run a shell command as a PTY background job (with --bg) claude --bg --exec 'pytest -x'
--cloud Create a web session on claude.ai (or queue into existing) claude --cloud "Fix the login bug"
--from-pr <number> Session picker filtered to sessions linked to a PR claude --from-pr 123
--name <name> Display name for the session (resumable) claude -n "my-feature-work"
--session-id <uuid> Use a specific session UUID claude --session-id "550e8400-..."
--no-session-persistence Don't save session to disk (print mode; CI) claude -p "task" --no-session-persistence
--autocompact <auto\|tokens> Set auto-compact window (v2.1.221+) claude --autocompact 500k
--debug[=filter] / --debug-file <path> Debug logging (with category filter) claude --debug='mcp,startup'
--ide Auto-connect to the IDE on startup claude --ide
--chrome / --no-chrome Enable/disable Chrome browser integration claude --chrome
--version Print the version claude -v

9. Keyboard Shortcuts & Input Prefixes

Shortcut Action
Ctrl+C Interrupt / clear input (2nd press exits)
Ctrl+D Exit session
Ctrl+R Reverse-search command history
Ctrl+B Background a running task
Ctrl+V Paste image into the conversation
Ctrl+O Transcript mode โ€” see Claude's thinking
Ctrl+G / Ctrl+X Ctrl+E Open prompt in external editor
Esc Esc Rewind conversation / code state (or summarize)
Shift+Tab Cycle permission modes (Normal โ†’ Auto-Accept โ†’ Plan โ†’ Auto)
Alt+P Switch model
Alt+T Toggle thinking mode
Alt+O Toggle Fast Mode
Shift+Enter Newline
? Shortcuts help (fullscreen renderer)
Prefix Action Example
/ Slash commands /compact
! Run bash directly, bypassing the AI (! alone toggles shell mode) !npm test
@ Reference files/dirs with autocomplete @./src/api/
# Quick add to CLAUDE.md memory # Use 2-space indentation
\ + Enter Quick newline โ€”
"ultrathink" Max reasoning on this turn, regardless of /effort ultrathink: analyze this algorithm

Sources

  • Claude Code docs โ€” CLI reference (commands, flags)
  • Claude Code docs โ€” Commands (full slash-command table, 111 commands)
  • Claude Code docs โ€” Interactive mode (shortcuts, input modes)