Claude Code Cheat Sheet

100%
Claude Code v2.1.114 Last updated: April 18, 2026
⌨️ Keyboard Shortcuts
General Controls
CtrlC Cancel input/generation
CtrlD Exit session
CtrlL Clear prompt input + force full screen redraw
CtrlO Toggle transcript viewer (verbose tool usage); cycles focus view in fullscreenNEW
CtrlU Clear entire input buffer
CtrlY Restore cleared input buffer
CtrlG Open in editor (same as Ctrl+X Ctrl+E)
CtrlR Reverse search history
CtrlX CtrlK Kill all background agents (press twice to confirm)
CtrlB Background running tasks
CtrlT Toggle task list
EscEsc Rewind or summarize
Mode Switching
TabShiftTab Cycle permission modes (default → acceptEdits → plan → …)
Mac Option Keys (configure Option as Meta)
Windows Alt Keys
PAltP Switch model
TAltT Toggle extended thinking
OAltO Toggle fast mode
Input
\Enter Newline
Prefixes
/ Slash command
! Direct bash
@ File mention + autocomplete
Platform Notes
Terminal Terminal.app or iTerm2 — run /terminal-setup after install
Install brew install claude-code or npm install -g @anthropic-ai/claude-code
Terminal Windows Terminal (recommended) — PowerShell, cmd, or WSL
Install winget install Anthropic.ClaudeCode or npm install -g @anthropic-ai/claude-code
WSL Recommended for Linux-style tooling and /etc/claude-code/ managed policy
🔌 MCP Servers
Add Servers
--transport http Remote HTTP (recommended)
--transport stdio Local process
--transport sse Remote SSE
Scopes
Local ~/.claude.json (you only)
Project .mcp.json (shared/VCS)
User ~/.claude.json (global)
Manage
/mcp Interactive UI
claude mcp list List all servers
maxResultSizeChars _meta["anthropic/maxResultSizeChars"] raises per-tool text threshold (up to 500K chars)NEW
⚡ Slash Commands
Session
/clear Clear conversation
/compact [focus] Compact context
/branch [name] Branch conversation (/fork alias)
/cost Token usage (per-model + cache breakdown)NEW
/context Visualize context (grid)
/diff Interactive diff viewer
/copy [N] Copy last (or Nth) response
/recap Summarize session context when returningNEW
/undo Alias for /rewindNEW
/rewind Rewind conv / code checkpoint
/export Export conversation
/plan [desc] Enter plan mode directly
/resume [session] Resume by ID/name
/focus Toggle focus view (fullscreen only)NEW
Config
/model [model] Switch model (←→ effort)NEW
/fast [on|off] Toggle fast mode
/theme Change color theme — includes "Auto (match terminal)" dark/light option
/permissions View/update permissions
/effort [level] Set effort (low/medium/high/xhigh/max); opens interactive slider with arrow keys when called without args
/color [color] Set prompt-bar color
/keybindings Customize keyboard shortcuts
/terminal-setup Configure terminal keybindings
Tools
/init Create CLAUDE.md
/memory Edit CLAUDE.md files, toggle auto memory, view entries
/mcp Manage MCP servers
/hooks Manage hooks
/skills List available skills
/agents Manage agent configurationsNEW
/review [PR] Review PR locally
/ultrareview [PR#] Cloud code review — parallel multi-agent analysis
/simplify [focus] Code review + fix (3 agents)NEW
/security-review Scan diff for vulnerabilities
/less-permission-prompts Add allowlist to reduce promptsNEW
/loop [interval] [prompt] Recurring task (/proactive alias)NEW
/chrome Chrome integration
/ide IDE integrations status
/reload-plugins Hot-reload plugins
/add-dir <path> Add working directory
Special
/btw <question> Ask a side question without adding to the conversation
/extra-usage Extra usage when rate limited
/voice Toggle push-to-talk voice dictation
/doctor Diagnose installation
/insights Analyze sessions report
/desktop Continue in Desktop app
/rename [name] Rename current session
/help Show help + commands
/feedback Submit feedback (alias: /bug)
📁 Memory & Files
CLAUDE.md Locations
./CLAUDE.md or ./.claude/CLAUDE.md Project (team-shared)
./CLAUDE.local.md Local personal project notes (gitignored)
~/.claude/CLAUDE.md Personal (all projects) — /Users/<you>/.claude/
%USERPROFILE%\.claude\CLAUDE.md Personal (all projects) — C:\Users\<you>\.claude\
/etc/claude-code/CLAUDE.md Managed policy (macOS, org-wide)
%ProgramData%\ClaudeCode\CLAUDE.md Managed policy (Windows) or /etc/claude-code/ under WSL
Rules & Import
.claude/rules/*.md Project rules
~/.claude/rules/*.md User rules
%USERPROFILE%\.claude\rules\*.md User rules
paths: frontmatter Path-specific rules
@path/to/file Import in CLAUDE.md
Auto Memory
~/.claude/projects/<proj>/memory/ Project memory dir
%USERPROFILE%\.claude\projects\<proj>\memory\ Project memory dir
MEMORY.md auto-loads at startup (first 25KB or 200 lines); topic files load on demand
🧠 Workflows & Tips
Plan Mode
TabShiftTab Normal → Auto-Accept → Plan
--permission-mode plan Start in plan mode
Plan file naming Files named after your prompt (e.g. fix-auth-race-snug-otter.md)
Thinking & Effort
TAltT Toggle thinking on/off
"ultrathink" Max effort for turn
CtrlO See thinking (verbose)
/effort ○ low · ◐ medium · ● high · ★ xhigh · ★★ max
Auto Mode Denied
/permissions → Recent Retry denied with RNEW
Git Worktrees
--worktree name Isolated branch per feature
isolation: worktree Agent in own worktree
sparsePaths Checkout only needed dirs
workspace.git_worktree Status line JSON: linked worktree pathNEW
/batch Auto-creates worktrees
Voice Mode
/voice Enable push-to-talk
Space (hold) Record, release to send
20 languages EN, ES, FR, DE, CZ, PL…
Context Management
/context Usage + optimization tips
/compact [focus] Compress with focus
Auto-compact ~95% capacity (thrash detection: 3x)NEW
1M context Opus 4.6 (Max/Team/Ent)
CLAUDE.md Survives compaction!
Session Power Moves
claude -c Continue last conv
claude -r "name" Resume by name
/btw question Side Q, no context cost
SDK / Headless
claude -p "query" Non-interactive
--output-format json Structured output
--max-budget-usd 5 Cost cap
cat file | claude -p Pipe input
type file | claude -p Pipe input (PowerShell: Get-Content file | claude -p)
Scheduling & Remote
/loop 5m msg Recurring task
--remote Web session on claude.ai
⚙️ Config & Env
Config Files
~/.claude/settings.json User settings
%USERPROFILE%\.claude\settings.json User settings
.claude/settings.json Project (shared)
.claude/settings.local.json Local only
~/.claude.json OAuth, MCP, state
%USERPROFILE%\.claude.json OAuth, MCP, state
.mcp.json Project MCP servers
managed-settings.d/ Drop-in policy fragments
Key Settings
modelOverrides Map model picker → custom IDs
autoMemoryDirectory Custom memory dir
worktree.sparsePaths Sparse checkout dirs
sandbox.failIfUnavailable Exit if sandbox fails
hooks: if Conditional hooks (permission rule syntax)
DISABLE_PROMPT_CACHING* Startup warning when prompt caching is disabledNEW
Monitor tool Stream events from background scriptsNEW
PermissionDenied Hook: auto-mode denialNEW
showThinkingSummaries Opt-in (off by default now)NEW
allowedChannelPlugins Admin channel plugin allowlist
hooks: "defer" Pause headless → resume later
disableSkillShellExec Block !`cmd`NEW
forceRemoteSettings… Block until freshNEW
refreshInterval Re-run custom status line every N secNEW
Key Env Vars
export VAR=value Set env in ~/.zshrc or ~/.bash_profile
setx VAR value Persist env (PowerShell: $env:VAR="value" for session)
ANTHROPIC_API_KEY
ANTHROPIC_MODEL
ANTHROPIC_BASE_URL Proxy/gateway override
ANTHROPIC_BETAS Additional beta headers
ANTHROPIC_CUSTOM_MODEL_OPTION Custom /model entry
MAX_THINKING_TOKENS 0=off
ENABLE_PROMPT_CACHING_1H Opt into 1h prompt cache TTLNEW
FORCE_PROMPT_CACHING_5M Force 5-min prompt cache TTLNEW
CLAUDE_CODE_ENABLE_AWAY_SUMMARY Force recap when telemetry disabledNEW
CLAUDECODE Detect CC shell (=1)
CLAUDE_CODE_DISABLE_CRON Disable scheduled tasks
API_TIMEOUT_MS API timeout (default: 600000ms)
MCP_TIMEOUT MCP server startup timeout (ms)
CLAUDE_CODE_USE_POWERSHELL_TOOL Use PowerShell tool instead of Bash on Windows
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE
CLAUDE_CODE_AUTO_COMPACT_WINDOW
CLAUDE_CODE_DISABLE_AUTO_MEMORY
CLAUDE_CODE_DISABLE_1M_CONTEXT
🔧 Skills & Agents
Built-in Skills
Skill tool Discovers built-in slash commands (/init, /review, /security-review…)NEW
/simplify Code review (3 parallel agents)
/batch Large parallel changes (5-30 worktrees)
/debug [desc] Troubleshoot from debug log
/loop [interval] Recurring scheduled task
/claude-api Load API + SDK reference
Custom Skill Locations
.claude/skills/<name>/ Project skills
~/.claude/skills/<name>/ Personal skills
%USERPROFILE%\.claude\skills\<name>\ Personal skills
Skill Frontmatter
description Auto-invocation trigger
allowed-tools Skip permission prompts
model Override model for skill
effort Override effort level
paths: [globs] Path-specific (YAML list)NEW
context: fork Run in subagent
$ARGUMENTS User input placeholder
${CLAUDE_SKILL_DIR} Skill's own directory
!`cmd` Dynamic context injection
plugin bin/ Ship executables for Bash toolNEW
Built-in Agents
Explore Fast read-only (Haiku)
Plan Research for plan mode
General Full tools, complex tasks
Bash Terminal separate context
Bash / PowerShell Terminal separate context (PowerShell when CLAUDE_CODE_USE_POWERSHELL_TOOL=1)
Agent Frontmatter
permissionMode default/acceptEdits/plan/dontAsk/bypassPermissions
isolation: worktree Run in git worktree
memory: user|project|local Persistent memory
background: true Background task
maxTurns Limit agentic turns
initialPrompt Auto-submit first turn
SendMessage Resume agents (replaces resume)
@agent-name Mention named subagentsNEW
🖥️ CLI & Flags
Core Commands
claude Interactive
claude "q" With prompt
claude -p "q" Headless (SDK)
claude -c Continue last
claude -r "n" Resume by ID/name
claude update Update
claude auth login Sign in (--sso, --console)
claude agents List agents
claude mcp MCP config
claude plugin Plugin management
Key Flags
--model Set model
-n / --name Session name
--resume, -r Resume session
--continue, -c Continue most recent
--add-dir Add working dir
--agent Use agent
--agents Define agents via JSON
--allowedTools Pre-approve tools
--disallowedTools Remove tools
--allow-danger… Add bypassPerms to ⇧Tab cycle
--output-format text/json/stream-json
--json-schema Structured output
--max-turns Limit turns
--max-budget-usd Cost cap
--exclude-dyn… Better prompt cachingNEW
--bare Minimal (no hooks/MCP/memory)
--channels MCP push notifications
--remote Web session on claude.ai
--rc / --remote-control Remote Control mode
--effort low/medium/high/xhigh/max
--permission-mode default/acceptEdits/plan/auto/dontAsk/bypassPermissions
--dangerously-skip-permissions Skip all prompts ⚠️
--chrome / --no-chrome Chrome on/off
--debug [filter] Debug logging
--system-prompt Custom system prompt
--settings <file> Load settings JSON