Skip to content

Claude Code cheatsheet

Everything in one place. Cmd+F is your friend. Deep links go to the full reference.

Prompt prefixes

PrefixDoes
/Run a slash command or skill (type / to list)
@Mention a file/folder or MCP resource (@src/auth.ts)
!Run a shell command; output goes into context

Essential keys

KeyAction
Shift+TabCycle permission mode: default → acceptEdits → plan
EscInterrupt the current turn
Esc EscRewind menu (when input is empty)
Ctrl+OTranscript viewer
Ctrl+RReverse history search
Ctrl+BBackground the current task
Ctrl+TTask list
Ctrl+GEdit the prompt/plan in $EDITOR
Alt+P / Alt+TSwitch model / toggle thinking
Ctrl+C / Ctrl+DCancel input / exit

Full list → keyboard shortcuts.

Permission modes

ModeBehavior
defaultReads freely; asks before edits/commands
acceptEditsAuto-applies file edits + in-scope fs commands (mkdir/mv/cp/rm)
planResearch & plan only — no edits
autoRuns with a server-side safety classifier (preview, v2.1.83+)
dontAskRuns only pre-approved tools, asks for nothing else (CI)
bypassPermissionsNo checks — only in a sandbox (--dangerously-skip-permissions)

Fine-grained: /permissions → allow/deny patterns like Bash(npm run test:*).

Most-used slash commands

CommandDoes
/helpList everything
/initGenerate a CLAUDE.md from the codebase
/clearNew conversation, keep project memory (use between tasks)
/memoryEdit persistent memory (CLAUDE.md)
/compact [focus]Compress the conversation, keep the essentials
/autocompact [size]Show/set the auto-compact window (500k, auto) → guide
/contextShow context-window usage
/model · /effortSwitch model · set reasoning effort
/usageToken use + plan limits (5h + weekly)
/rewindRestore code/conversation to a checkpoint
/resumeResume a past session
/code-reviewReview the current diff
/doctorDiagnose & auto-fix

CLI flags

CommandDoes
claudeStart interactive session
claude "query"Start with a first prompt
claude -p "query"Headless/print mode (exits) — for scripts/CI
claude -c / --continueResume the most recent session in this dir
claude -r <id|name>Resume a specific session
claude --model sonnetPick a model
claude --permission-mode planStart in a permission mode
claude -w / --worktreeRun in an isolated git worktree
claude doctorHealth check

Full list → CLI reference. Note: claude --help isn't exhaustive.

Models (pick by task)

AliasUse for
haikuTrivial / formatting
sonnet~80% of work (default for most)
opusHard multi-file refactors, tricky bugs, architecture
opusplanPlan with Opus, execute with Sonnet

Details → models & effort · cost.

The core loop

The core loop: Explore to Plan to Code to Verify; if it fails, back to Code; if it passes, Commit.

TIP

Give Claude a check it can run — tests, a build, a screenshot. That's the difference between a session you watch and one you walk away from.

Another model

WantDo
The whole session on another providerA second config dir + base URL, key, ANTHROPIC_MODEL, the tier aliases and the two context numbers — guide
Know what breaks firstWhat stops working

Quick wins

Want to…Do
Start fresh between tasks/clear
Understand a repoAsk it questions like you would a senior engineer → guide
Fix a bugPaste the stack trace → "write a failing test, then fix the root cause" → guide
Stop being asked repeatedly/permissions allowlist, or Shift+Tab → acceptEdits
Spend lessSonnet by default; /clear often; lean CLAUDE.mdcost guide
Work in parallelclaude -w (worktrees) → guide
Automate itclaude -p headless → guide

New here? Start with the Learning path. Want the deep dives? Browse Reference. Setting up a machine? One-command setup.

Released under the MIT License.