Reference

Claude Code Cheat Sheet

Keyboard shortcuts, slash commands, MCP, memory paths, and CLI flags β€” formatted for quick lookup on tylerperez.com.

Recent changes

  • Agent View (Research Preview): `claude agents` shows all sessions in a single list (v2.1.139)
  • New `/goal` command: set completion goal; Claude works until met with live progress overlay (v2.1.139)
  • `claude plugin details` shows component inventory and projected token cost (v2.1.139)
  • Transcript navigation: `?` for shortcuts, `{`/`}` to jump between prompts (v2.1.139)
  • New `continueOnBlock` hook config: Claude keeps running after a blocked tool call (v2.1.139)
  • MCP stdio servers now receive `CLAUDE_PROJECT_DIR` env var (v2.1.139)

Keyboard shortcuts

General controls

Ctrl+CCancel input/generation
Ctrl+DExit session
Ctrl+LClear prompt input + force full screen redraw
Ctrl+OToggle transcript viewer (verbose tool usage); cycles focus view in fullscreen
Ctrl+UClear entire input buffer
Ctrl+YRestore cleared input buffer
Ctrl+GOpen in editor (same as Ctrl+X Ctrl+E)
Ctrl+RReverse search history
Ctrl+X Ctrl+KKill all background agents (press twice to confirm)
Ctrl+BBackground running tasks
Ctrl+TToggle task list
Esc EscRewind or summarize

Mode switching

Shift+TabCycle permission modes (default β†’ acceptEdits β†’ plan β†’ …)

Mac option keys (Option as Meta)

βŒ₯PSwitch model
βŒ₯TToggle extended thinking
βŒ₯OToggle fast mode

Input

\ EnterNewline
vVim visual mode (char selection + operators)
VVim visual-line mode

Prefixes

/Slash command
!Direct bash
@File mention + autocomplete

MCP servers

Add servers

--transport httpRemote HTTP (recommended)
--transport stdioLocal process
--transport sseRemote SSE

Scopes

Local ~/.claude.jsonYou only
Project .mcp.jsonShared / VCS
User ~/.claude.jsonGlobal

Manage

/mcpInteractive UI
claude mcp listList all servers
alwaysLoad: trueKeep server connected across all sessions (server config)
maxResultSizeChars`_meta["anthropic/maxResultSizeChars"]` raises per-tool text threshold (up to 500K chars)

Slash commands

Session

  • /clearClear conversation
  • /compact [focus]Compact context
  • /branch [name]Branch conversation (/fork alias)
  • /usageToken usage, cost and cache breakdown (replaces /cost /stats)
  • /contextVisualize context (grid)
  • /diffInteractive diff viewer
  • /copy [N]Copy last (or Nth) response
  • /recapSummarize session context when returning
  • /undoAlias for /rewind
  • /rewindRewind conv / code checkpoint
  • /exportExport conversation
  • /plan [desc]Enter plan mode directly
  • /resume [session]Resume by ID/name
  • /focusToggle focus view (fullscreen only)
  • /goal [desc]Set completion goal; live progress overlay

Config

  • /config [key [value]]View/set settings (~/.claude/settings.json)
  • /model [model]Switch model (←→ effort)
  • /fast [on|off]Toggle fast mode
  • /theme [name]Named themes; includes "Auto (match terminal)" dark/light
  • /permissionsView/update permissions
  • /effort [level]low/medium/high/xhigh/max; interactive slider without args
  • /color [color]Prompt-bar color
  • /keybindingsCustomize shortcuts
  • /scroll-speed [speed]Output scroll speed
  • /terminal-setupConfigure terminal keybindings

Tools

  • /initCreate CLAUDE.md
  • /memoryEdit CLAUDE.md files, toggle auto memory, entries
  • /mcpManage MCP servers
  • /hooksManage hooks
  • /skillsList skills
  • /agentsManage agent configurations
  • /review [PR]Review PR locally
  • /ultrareview [PR#]Cloud code review β€” parallel multi-agent
  • /simplify [focus]Code review + fix (3 agents)
  • /security-reviewScan diff for vulnerabilities
  • /less-permission-promptsAdd allowlist to reduce prompts
  • /loop [interval] [prompt]Recurring task (/proactive alias)
  • /chromeChrome integration
  • /ideIDE integrations status
  • /reload-pluginsHot-reload plugins
  • /add-dirAdd working directory

Special

  • /btwSide question without adding to conversation
  • /extra-usageExtra usage when rate limited
  • /voicePush-to-talk voice dictation
  • /doctorDiagnose installation
  • /insightsAnalyze sessions report
  • /desktopContinue in Desktop app
  • /rename [name]Rename current session
  • /helpHelp + commands
  • /feedbackSubmit feedback (alias: /bug)

Memory & files

CLAUDE.md locations

./CLAUDE.md or ./.claude/CLAUDE.mdProject (team-shared)
./CLAUDE.local.mdLocal personal project notes (gitignored)
~/.claude/CLAUDE.mdPersonal (all projects)
/etc/claude-code/CLAUDE.mdManaged policy (Linux/WSL, org-wide)

Rules & import

  • .claude/rules/*.md β€” project rules
  • ~/.claude/rules/*.md β€” user rules
  • `paths:` frontmatter β€” path-specific rules
  • @path/to/file β€” import in CLAUDE.md

Auto memory

  • ~/.claude/projects/ … /memory/
  • `MEMORY.md` auto-loads at startup (first 25KB or 200 lines); topic files on demand

Workflows & tips

  • Plan mode: Shift+Tab Normal β†’ Auto-Accept β†’ Plan; `--permission-mode plan`
  • Plan files named after prompt (e.g. fix-auth-race-snug-otter.md)
  • Thinking: βŒ₯T toggle; "ultrathink" max effort; Ctrl+O verbose
  • /effort β—‹ low Β· ◐ medium Β· ● high Β· β˜… xhigh Β· β˜…β˜… max
  • Denied tools: /permissions β†’ Recent Retry with R
  • Git worktrees: `--worktree name`; `isolation: worktree`; `sparsePaths`; `/batch`
  • Voice: /voice; Space hold record; 20+ languages
  • Context: /context; /compact [focus]; auto-compact ~95%; CLAUDE.md survives compaction
  • Headless: `claude -p "…"`; `--output-format json`; `--max-budget-usd`; pipe stdin
  • Scheduling: `/loop 5m msg`; `--remote` web session

Config & env

Config files

  • ~/.claude/settings.json β€” user
  • .claude/settings.json β€” project
  • .claude/settings.local.json β€” local only
  • ~/.claude.json β€” OAuth, MCP, state
  • .mcp.json β€” project MCP servers
  • managed-settings.d/ β€” policy fragments

Key environment variables

ANTHROPIC_API_KEYANTHROPIC_MODELANTHROPIC_BASE_URLANTHROPIC_BETASANTHROPIC_CUSTOM_MODEL_OPTIONMAX_THINKING_TOKENSENABLE_PROMPT_CACHING_1HFORCE_PROMPT_CACHING_5MCLAUDE_CODE_ENABLE_AWAY_SUMMARYCLAUDECODECLAUDE_CODE_DISABLE_CRONCLAUDE_CODE_FORK_SUBAGENTDISABLE_UPDATESAPI_TIMEOUT_MSMCP_TIMEOUTCLAUDE_CODE_SESSION_IDCLAUDE_CODE_DISABLE_ALTERNATE_SCREENCLAUDE_CODE_DISABLE_AUTO_MEMORYCLAUDE_CODE_DISABLE_1M_CONTEXTCLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE

Many more settings exist in JSON and hooks β€” see official docs.

Skills & agents

Skills

  • Built-in: Skill tool discovers slash commands (/init, /review, …)
  • /simplify, /batch, /debug, /loop, /claude-api
  • Custom: .claude/skills/, ~/.claude/skills/
  • Frontmatter: description, allowed-tools, model, effort, paths:, context: fork
  • ${CLAUDE_SKILL_DIR}, ${CLAUDE_EFFORT}, !`cmd`, plugin bin/

Agents

  • Explore / Plan / General / Bash built-ins
  • Frontmatter: permissionMode, isolation: worktree, memory, background, maxTurns, initialPrompt
  • SendMessage resume agents; @agent-name mentions

CLI & flags

Core commands

  • claude β€” interactive
  • claude "q" β€” with prompt
  • claude -p "q" β€” headless (SDK)
  • claude -c β€” continue last
  • claude -r "name" β€” resume
  • claude update
  • claude auth login (--sso, --console)
  • claude agents β€” list agents
  • claude mcp β€” MCP config
  • claude plugin β€” plugin management
  • claude plugin prune β€” remove orphans
  • claude project purge [path] β€” delete project state
  • claude ultrareview [target] β€” non-interactive review

Key flags

  • --model
  • -n / --name β€” session name
  • --resume / -r
  • --continue / -c
  • --add-dir
  • --agent / --agents JSON
  • --allowedTools / --disallowedTools
  • --plugin-url β€” fetch plugin .zip
  • --output-format text/json/stream-json
  • --json-schema
  • --max-turns
  • --max-budget-usd
  • --bare β€” minimal
  • --remote / --rc remote control
  • --effort
  • --permission-mode
  • --dangerously-skip-permissions ⚠️
  • --chrome / --no-chrome
  • --debug
  • --system-prompt
  • --settings
  • --from-pr β€” PR context

Content adapted from the community Claude Code cheat sheet at https://cc.storyfox.cz/. Claude Code changes quickly β€” confirm details in Anthropic's documentation before relying on this page in production.