Claude Code cheatsheet
Everything in one place. Cmd+F is your friend. Deep links go to the full reference.
Prompt prefixes
| Prefix | Does |
|---|---|
/ | 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
| Key | Action |
|---|---|
| Shift+Tab | Cycle permission mode: default → acceptEdits → plan |
| Esc | Interrupt the current turn |
| Esc Esc | Rewind menu (when input is empty) |
| Ctrl+O | Transcript viewer |
| Ctrl+R | Reverse history search |
| Ctrl+B | Background the current task |
| Ctrl+T | Task list |
| Ctrl+G | Edit the prompt/plan in $EDITOR |
| Alt+P / Alt+T | Switch model / toggle thinking |
| Ctrl+C / Ctrl+D | Cancel input / exit |
Full list → keyboard shortcuts.
Permission modes
| Mode | Behavior |
|---|---|
default | Reads freely; asks before edits/commands |
acceptEdits | Auto-applies file edits + in-scope fs commands (mkdir/mv/cp/rm) |
plan | Research & plan only — no edits |
auto | Runs with a server-side safety classifier (preview, v2.1.83+) |
dontAsk | Runs only pre-approved tools, asks for nothing else (CI) |
bypassPermissions | No checks — only in a sandbox (--dangerously-skip-permissions) |
Fine-grained: /permissions → allow/deny patterns like Bash(npm run test:*).
Most-used slash commands
| Command | Does |
|---|---|
/help | List everything |
/init | Generate a CLAUDE.md from the codebase |
/clear | New conversation, keep project memory (use between tasks) |
/memory | Edit persistent memory (CLAUDE.md) |
/compact [focus] | Compress the conversation, keep the essentials |
/autocompact [size] | Show/set the auto-compact window (500k, auto) → guide |
/context | Show context-window usage |
/model · /effort | Switch model · set reasoning effort |
/usage | Token use + plan limits (5h + weekly) |
/rewind | Restore code/conversation to a checkpoint |
/resume | Resume a past session |
/code-review | Review the current diff |
/doctor | Diagnose & auto-fix |
CLI flags
| Command | Does |
|---|---|
claude | Start interactive session |
claude "query" | Start with a first prompt |
claude -p "query" | Headless/print mode (exits) — for scripts/CI |
claude -c / --continue | Resume the most recent session in this dir |
claude -r <id|name> | Resume a specific session |
claude --model sonnet | Pick a model |
claude --permission-mode plan | Start in a permission mode |
claude -w / --worktree | Run in an isolated git worktree |
claude doctor | Health check |
Full list → CLI reference. Note: claude --help isn't exhaustive.
Models (pick by task)
| Alias | Use for |
|---|---|
haiku | Trivial / formatting |
sonnet | ~80% of work (default for most) |
opus | Hard multi-file refactors, tricky bugs, architecture |
opusplan | Plan with Opus, execute with Sonnet |
Details → models & effort · cost.
The core loop
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
| Want | Do |
|---|---|
| The whole session on another provider | A second config dir + base URL, key, ANTHROPIC_MODEL, the tier aliases and the two context numbers — guide |
| Know what breaks first | What stops working |
Quick wins
| Want to… | Do |
|---|---|
| Start fresh between tasks | /clear |
| Understand a repo | Ask it questions like you would a senior engineer → guide |
| Fix a bug | Paste the stack trace → "write a failing test, then fix the root cause" → guide |
| Stop being asked repeatedly | /permissions allowlist, or Shift+Tab → acceptEdits |
| Spend less | Sonnet by default; /clear often; lean CLAUDE.md → cost guide |
| Work in parallel | claude -w (worktrees) → guide |
| Automate it | claude -p headless → guide |
New here? Start with the Learning path. Want the deep dives? Browse Reference. Setting up a machine? One-command setup.