Claude Code Commands Cheatsheet

Every Claude Code command worth knowing on one page: slash commands grouped by job, bundled skills, CLI subcommands and flags, keyboard shortcuts, input prefixes, MCP and plugin commands, and the configuration files they act on.

On this page

Simple definition#

You drive Claude Code three ways: slash commands inside a session (/compact, /rewind), CLI subcommands and flags from your shell (claude -p, claude mcp add), and keyboard shortcuts (Esc, Shift+Tab). Some slash commands are bundled skills (/code-review, /loop, /batch) — prompts Claude follows rather than fixed built-ins. Type / in a session to see everything available, including your own skills and plugin commands.

The ten you’ll use daily#

Command What it does
Esc Stop Claude mid-action; work so far is kept
Esc Esc / /rewind Roll back code and/or conversation to an earlier prompt
Shift+Tab Cycle permission modes (Manual, acceptEdits, plan, auto)
/clear [name] Fresh context for a new task (names the old one for /resume)
/compact [focus] Summarise the conversation to free context
/context See what is filling the context window
/usage Session cost, plan limits and where usage went (/cost, /stats are aliases)
/model, /effort Switch model; set effort low…max
/plan [task] Enter plan mode — research and propose, no edits
/code-review Review the current diff in a fresh context

Slash commands by job#

Session and context#

Command Purpose
/clear [name] New conversation, empty context
/compact [instructions] Summarise history with an optional focus
/autocompact [auto|<tokens>] Set how full the window gets before auto-compaction
/context [all] Coloured grid of context usage with optimisation hints
/btw [question] Side question that doesn’t enter history
/recap One-line summary of the session
/rewind Checkpoint menu (aliases /checkpoint, /undo)
/branch [name] Branch the conversation to try another direction
/fork [prompt] Copy the session into a new background session
/subtask <task> Forked sub-agent that inherits the conversation and reports back
/resume [session] Resume by ID or name, or open the picker
/rename [name] Name the session (shown in /resume)
/export [file] Export the conversation as text
/copy [N] Copy the last (or Nth-latest) response or a code block
/diff Review working-tree changes, including Claude’s edits
/cd <path>, /add-dir <path> Move the session, or add a working directory
/exit Quit (detaches from a background session)

Model, effort and speed#

Command Purpose
/model [model] Pick opus, sonnet, haiku, fable, opusplan; arrows adjust effort
/effort [low…xhigh|max|auto|status] Set effort; ultracode toggles a dedicated mode
/fast [on|off] Fast mode on Opus
/advisor [model|off] Consult a second model at key moments
ultrathink (in a prompt) Deeper reasoning for that one turn only

Permissions and safety#

Command Purpose
/permissions Allow / ask / deny rules by scope; Recently blocked auto-mode actions
/sandbox Toggle OS-level sandbox; Overrides tab enables strict mode
/auto-mode-setup Draft autoMode.environment entries from your project
/fewer-permission-prompts Add an allowlist of common read-only commands
/hooks View configured hooks
/security-review Security review of the branch diff against origin’s default branch

Memory, configuration and extensions#

Command Purpose
/init Draft a CLAUDE.md (CLAUDE_CODE_NEW_INIT=1 for skills, hooks too)
/memory Edit CLAUDE.md files; toggle and view auto memory
/config [key=value] Settings UI, or set values directly
/update-config [request] Describe a settings change; Claude edits settings.json
/status Version, model, account, setting sources
/doctor [prompt-audit] Diagnose install, settings, extensions, stale CLAUDE.md lines
/skills, /reload-skills, /skill-doctor List skills; rescan disk; see each skill’s context cost and use
/agents Where sub-agent files live (.claude/agents/)
/mcp [reconnect|enable|disable] Manage MCP connections and OAuth
/plugin [subcommand], /reload-plugins Install, enable, disable plugins; apply changes
/output-style [style] Switch response style
/statusline, /theme, /keybindings, /terminal-setup, /tui Personalise the terminal
/import [codex|gemini|cursor] Bring configuration from other coding agents

Verify and review (bundled skills)#

Command Purpose
/code-review [level] [--fix] [--comment] [target] Review diff, PR, branch or path; /review is an alias
/code-review ultra, /ultrareview Deep multi-agent cloud review (billed; user-triggered)
/simplify [target] Four parallel agents find and apply cleanup
/verify Build, run and observe the app to confirm a change
/run, /run-skill-generator Launch your app; teach Claude how to launch it
/debug [description] Turn on debug logging and read the log

Long-running, parallel and scheduled work#

Command Purpose
/goal [condition|clear] Keep working across turns until an evaluator confirms the condition
/loop [interval] [prompt] Repeat a prompt while the session is open (5m, 2h, or self-paced)
/schedule [description] Cloud scheduled task — runs with your laptop closed
/batch <instruction> Split a big change into 5–30 worktree-isolated units, one PR each
/background [prompt] Detach this session as a background agent
/tasks Background work in this session (alias /bashes)
/workflows, /deep-research <q> Watch dynamic workflows; run the bundled research workflow
/list-agents Sub-agents, teammates and sessions Claude can message
/stop Stop the background session you’re attached to

Remote, cloud and integrations#

Command Purpose
/remote-control Continue this session from claude.ai or the mobile app
/teleport (/tp) Pull a cloud session into this terminal
/remote-env, /web-setup Default cloud environment; connect GitHub for cloud sessions
/autofix-pr [prompt] Cloud session that watches the PR and pushes fixes for CI failures and comments
/desktop, /ide, /chrome Move to desktop app; IDE integration; Claude in Chrome
/install-github-app, /install-slack-app Set up GitHub Actions and the Slack app
/team-onboarding Generate an onboarding guide from your last 30 days of usage
/insights HTML report on how you use Claude Code
/artifacts List, open or attach published artifacts

Account and help#

/help, /login, /logout, /privacy-settings, /usage-credits, /rate-limit-options, /upgrade, /release-notes, /feedback (/bug), /powerup (interactive lessons).

Input prefixes#

Type Does
/ Command or skill
! Shell mode — run a command and add its output to the conversation
@ File path mention (includes the file)
? on empty input Shortcut help panel

Keyboard shortcuts#

Keys Action
Esc Interrupt Claude, or close a dialog
Esc Esc Clear the draft (text present) or open rewind (empty)
Shift+Tab (Alt+M on some Windows terminals) Cycle permission modes
Ctrl+C Interrupt; press twice on empty input to exit
Ctrl+D Exit (press twice)
Ctrl+B Send running Bash or agent to the background
Ctrl+O Transcript viewer with full tool detail
Ctrl+T Toggle Claude’s task checklist
Ctrl+R Reverse-search prompt history
Ctrl+G / Ctrl+X Ctrl+E Edit the prompt in your $EDITOR
Ctrl+S Stash or restore the current prompt
Ctrl+V (Alt+V on Windows) Paste an image
Ctrl+Enter Send queued messages now
Ctrl+L Redraw the screen
Alt+P / Option+P Switch model without clearing the prompt
Alt+O / Option+O Toggle fast mode
Ctrl+X Ctrl+K Stop all background sub-agents
Shift+Enter (after /terminal-setup) or \ + Enter New line
Ctrl+A/Ctrl+E, Ctrl+K/Ctrl+U/Ctrl+W, Ctrl+Y Readline-style editing

Vim editing is under /config → Editor mode. Remap anything in ~/.claude/keybindings.json via /keybindings.

CLI: starting and resuming#

Command Does
claude Interactive session
claude "query" Interactive session with a first prompt
claude -p "query" Print mode: run once and exit (scripts, CI)
cat log | claude -p "explain" Pipe content in
claude -c Continue the latest conversation in this directory
claude -r <name|id> ["query"] Resume a named or specific session
claude --from-pr 123 Sessions linked to a PR
claude -n auth-refactor Name the session at start
claude -w feature-auth [--tmux] Start in a new git worktree
claude --cloud "task" / --teleport Start a cloud session / pull one local
claude --bg "task" Start as a background agent
claude --permission-mode plan|auto|dontAsk|… Start in a permission mode
claude --model sonnet --effort high Model and effort for this session
claude --safe-mode Start with all customisations off (troubleshooting)

CLI: flags for scripts and CI#

Flag Use
-p, --print Non-interactive
--bare Skip hooks, skills, plugins, MCP, CLAUDE.md — reproducible runs
--output-format text|json|stream-json Parseable output (stream-json with --verbose)
--input-format stream-json Stream messages in
--json-schema <schema> Validated structured result
--allowedTools "Read,Edit,Bash(npm test)" Pre-approve tools
--disallowedTools "Bash(git push *)" Deny tools
--tools "Bash,Edit,Read" Restrict built-in tools
--permission-mode dontAsk Refuse anything not pre-approved
--max-turns N, --max-budget-usd N Stop runaway runs
--append-system-prompt[-file], --system-prompt[-file] Add to or replace the system prompt
--settings <file|json>, --setting-sources user,project Settings for this run
--mcp-config <file>, --strict-mcp-config MCP servers for this run only
--agents '<json>', --agent <name> Define or select sub-agents
--add-dir <path> Extra working directories
--fallback-model <model> Use when the primary is overloaded
--no-session-persistence Don’t save the session
--debug=mcp,hooks, --verbose Diagnose

CLI: subcommands#

Command Does
claude update, claude install [version] Update or pin the native binary
claude doctor Read-only install and settings diagnostics
claude auth login [--sso|--console], auth status, auth logout Authentication
claude setup-token Long-lived OAuth token for CI (subscription)
claude mcp add|list|get|remove|login Manage MCP servers
claude plugin … Manage plugins and marketplaces
claude agents Agent view: dispatch and watch background sessions
claude attach|logs|stop|respawn|rm <id> Manage background sessions
claude auto-mode defaults|reset Inspect or reset auto-mode rules
claude ultrareview [target] Non-interactive deep review
claude remote-control Remote Control server mode
claude purge [path] Delete all local state for a project

MCP in four lines#

claude mcp add --transport http sentry https://mcp.sentry.dev/mcp            # remote HTTP server
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub --dsn "$DSN"    # local process
claude mcp add --transport http shared --scope project https://example.com/mcp # team: .mcp.json
claude mcp list                                                              # then /mcp to auth

Scopes: local (default, you + this project), project (.mcp.json, committed), user (you, all projects).

Files the commands act on#

Path Holds
CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md Project and personal memory
.claude/rules/*.md Rules, optionally paths:-scoped
.claude/settings.json / settings.local.json Team / personal permissions, hooks, env
~/.claude/settings.json User settings, autoMode
.claude/skills/<name>/SKILL.md Skills (/name)
.claude/agents/<name>.md Sub-agents
.mcp.json Project MCP servers
.worktreeinclude Gitignored files copied into new worktrees
~/.claude/keybindings.json Custom shortcuts
~/.claude.json Local-scope MCP and per-project state

Removed or renamed — don’t be confused by old guides#

Old Now
/pr-comments Ask Claude to read PR comments (uses gh)
/vim /config → Editor mode
/ultraplan Plan mode
--enable-auto-mode --permission-mode auto (auto is in the Shift+Tab cycle)
--remote --cloud
/agents interactive builder Ask Claude, or edit .claude/agents/

Review questions#

How do you run Claude Code reproducibly in CI, ignoring whatever is configured on the runner? claude --bare -p "…" with --allowedTools, --permission-mode dontAsk, --max-turns, and --output-format json; pass what the run needs with --settings, --mcp-config and --append-system-prompt.

What is the difference between /fork, /subtask and /branch? /branch branches the conversation in place; /subtask starts a forked sub-agent that reports back to this session; /fork copies the session into a separate background session.

Which commands repeat work, and which keep a session going until done? /loop repeats on an interval; /goal continues turn after turn until an evaluator confirms a condition; /schedule runs cloud tasks independent of any open session.

References#