Claude Code Cheat Sheet

Every shortcut, command, and config — on one page.
v2.1.101 · Updated April 2026

Glossary
Session — One run of claude in a directory, from launch to exit. Each session has its own conversation history; project memory persists across sessions.
Context window — The total text the model can hold in mind at once. When it fills up, older content is compacted or dropped.
Token — The unit models use to measure text (~ ¾ of a word). Usage limits and billing are counted in tokens.
CLAUDE.md — A markdown file Claude reads at every session start. Holds your project’s conventions, commands, and constraints.
Plan Mode — Read-only mode: Claude explores and proposes but won’t edit files or run commands.
Accept Edits — Auto-approves file edits for the session; shell commands still prompt for approval.
Permissions — Rules governing which actions Claude can take without asking. By default it asks for everything. With "accept edits on" only the file can be changed by Claude without approbation, every tools use needs user approval (unless approved in /permissions)
Tool — A capability Claude can invoke: reading a file, editing, running bash, searching the web. Each call appears in the transcript.
MCP — Model Context Protocol — an open standard for plugging external systems (GitHub, Jira, databases) into Claude as tools.
Subagent — A secondary Claude instance spawned for a focused subtask (tests, search, review) in its own isolated context.
Hook — A shell command that runs automatically at a defined point in Claude’s lifecycle (before a tool, after an edit, on session start).
Skill — Packaged instructions that teach Claude a specific workflow. Loaded on demand, not always in context.
Slash command — Any input starting with /. Built-in ones control the session; custom ones are prompt templates in .claude/skills/.
When to use? Stay in flow without lifting hands from the keyboard. Learn ⇧Tab, ⌥T, and CtrlO first — they save the most time.
Context: Main chat Key: Fast, muscle-memory driven
General Controls
CtrlCCancel input/generation
CtrlDExit session
CtrlLClear prompt input
CtrlOToggle transcript viewer / focus view NEW
CtrlRReverse search history
CtrlGOpen prompt in editor
CtrlX CtrlEOpen in editor (alias)
CtrlBBackground running task
CtrlTToggle task list
CtrlVPaste image ([Image #N] chip)
CtrlX CtrlKKill background agents
EscEscRewind or summarize
Mode Switching
⌥PSwitch model
⌥TToggle thinking
Input
\\EnterNewline (quick)
CtrlJNewline (control seq)
Prefixes
/Slash command
!Direct bash
@File mention + autocomplete
Transcript / Focus View (CtrlO)
CtrlEToggle show all
Q / CtrlC / EscExit transcript
When to use? When Claude needs to connect to external systems — databases, APIs, Jira, Slack, Google Drive. Project scope (.mcp.json) shares with team; local scope is personal only.
Context: Injects external data Key: Standardized integration protocol
Add Servers
--transport httpRemote HTTP (recommended)
--transport stdioLocal process
--transport sseRemote SSE
Scopes
Local~/.claude.json (you only)
Project.mcp.json (shared/VCS)
User~/.claude.json (global)
Manage
/mcpInteractive UI
claude mcp listList all servers
claude mcp serveRun Claude Code itself as a stdio MCP server
Limits & Features
ElicitationServers can request user input mid-task
2KB eachTool descriptions and server instructions are each truncated at 2KB
maxResultSizeChars_meta["anthropic/maxResultSizeChars"] raises per-tool text threshold (up to 500K chars) NEW
When to use? Specialized commands you invoke manually when you need quick, parameterized shortcuts. Use them when you specifically know you’ll want to trigger something at certain moments. Top 3: /compact, /context, /plan.
Trigger: Manual /command Context: Shared with main chat Key: Fast, user-controlled
Session
/clearClear conversation
/compact [focus]Compact context
/resumeResume/switch session
/rename [name]Name current session
/branch [name]Branch conversation (/fork alias)
/costToken usage (per-model + cache breakdown) NEW
/diffInteractive diff viewer
/copy [N]Copy last (or Nth) response
/exportExport conversation
Config
/configOpen settings
/model [model]Switch model
/fast [on|off]Toggle fast mode
/themeChange color theme
/effort [level]Set effort (low/medium/high/max/auto)
/color [color]Set prompt-bar color
/terminal-setupConfigure terminal keybindings
Tools
/initCreate CLAUDE.md
/reload-pluginsHot-reload plugins
/add-dir <path>Add working directory
Special
/powerupInteractive feature lessons NEW
/btw <question>Ask a side question without adding to the conversation
/plan [desc]Plan mode (+ auto-start)
/loop [interval]Schedule recurring task
/doctorDiagnose installation
/statsUsage streaks & prefs
/insightsAnalyze sessions report
/remote-controlBridge to claude.ai/code (/rc)
/usagePlan limits & rate status
/ultraplan <prompt>Draft a plan in a browser session; auto-creates a default cloud environment if needed NEW
/security-reviewSecurity analysis of changes
/helpShow help + commands
/feedbackSubmit feedback (alias: /bug)
/stickersOrder stickers!
When to use? To give Claude persistent instructions across sessions. CLAUDE.md is your “project brain” — it survives compaction and is loaded every session. Use rules for filetype-specific memory.
Context: Always in context, survives compaction Key: Persistent project knowledge
CLAUDE.md Locations
./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)
.claude/rules/*.mdProject rules
~/.claude/rules/*.mdUser rules
paths: frontmatterPath-specific rules
@path/to/fileImport in CLAUDE.md
Auto Memory
~/.claude/projects/<proj>/memory/MEMORY.md auto-loads at startup (first 25KB or 200 lines); topic files load on demand
When to use? When looking for the best pattern for a specific task. Plan mode for safe analysis, worktrees for parallel features, headless for CI.
Context: Varies per workflow Key: Patterns for common tasks
⇧TabNormal → Auto-Accept → Plan
--permission-mode planStart in plan mode
Thinking & Effort
⌥TToggle thinking on/off
"ultrathink"Max effort for turn
CtrlOSee thinking (verbose)
/effort○ low · ◐ medium · ● high · ★ max
Auto Mode Denied
/permissions → RecentRetry denied with R NEW
Git Worktrees
--worktree nameIsolated branch per feature
isolation: worktreeAgent in own worktree
sparsePathsCheckout only needed dirs
workspace.git_worktreeStatus line JSON: linked worktree path NEW
/batchAuto-creates worktrees
/voiceEnable push-to-talk
Space (hold)Record, release to send
20 languagesEN, ES, FR, DE, CZ, PL…
/contextUsage + optimization tips
/compact [focus]Compress with focus
Auto-compact~95% capacity (thrash detection: 3x) NEW
1M contextOpus 4.6 (Max/Team/Ent)
CLAUDE.mdSurvives compaction!
Session Power Moves
claude -cContinue last conv
claude -r "name"Resume by name
/btw questionSide Q, no context cost
claude -p "query"Non-interactive
--output-format jsonStructured output
--max-budget-usd 5Cost cap
cat file | claude -pPipe input
Scheduling & Remote
/loop 5m msgRecurring task
/rcRemote control (hostname prefix default) NEW
/ultraplanDraft plan in browser, auto-create default cloud env if needed NEW
--remoteWeb session on claude.ai
When to use? To customize Claude Code’s behavior globally or per-project. Settings cascade: managed > user > project > local. Env vars override everything.
Context: Loaded at startup Key: Cascading settings hierarchy
~/.claude/settings.jsonUser settings
.claude/settings.jsonProject (shared)
.claude/settings.local.jsonLocal only
~/.claude.jsonOAuth, MCP, state
.mcp.jsonProject MCP servers
managed-settings.d/Drop-in policy fragments
Key Settings
modelOverridesMap model picker → custom IDs
autoMemoryDirectoryCustom memory dir
worktree.sparsePathsSparse checkout dirs
sandbox.failIfUnavailableExit if sandbox fails
hooks: ifConditional hooks (permission rule syntax)
Monitor toolStream events from background scripts NEW
PermissionDeniedHook: auto-mode denial NEW
showThinkingSummariesOpt-in (off by default now) NEW
allowedChannelPluginsAdmin channel plugin allowlist
hooks: "defer"Pause headless → resume later
disableSkillShellExecBlock !`cmd` in skills/plugins NEW
forceRemoteSettingsRefreshFail-closed: block startup until fresh NEW
refreshIntervalRe-run custom status line every N sec NEW
ANTHROPIC_API_KEYAPI key
ANTHROPIC_MODELModel override
CLAUDE_CODE_EFFORT_LEVELlow/medium/high/max/auto
MAX_THINKING_TOKENS0=off
ANTHROPIC_CUSTOM_MODEL_OPTIONCustom /model entry
CLAUDE_CODE_SUBPROCESS_ENV_SCRUBStrip creds from Bash, hooks, MCP subprocesses; Linux isolates PID namespace NEW
CLAUDE_CODE_SCRIPT_CAPSJSON caps for specific script invocations when env scrubbing is enabled NEW
CLAUDE_CODE_PERFORCE_MODEEnable Perforce-aware write protection with p4 edit hint NEW
CLAUDE_STREAM_IDLE_TIMEOUT_MSStreaming watchdog (def 90s)
CLAUDE_CODE_NO_FLICKERAlt-screen rendering (=1) NEW
MCP_CONNECTION_NONBLOCKINGSkip MCP wait in -p NEW
CLAUDE_CODE_USE_MANTLEUse Mantle for Bedrock (=1) NEW
CLAUDE_CODE_CERT_STOREComma-separated TLS CA sources: bundled, system (default: both) NEW
CLAUDECODEDetect CC shell (=1)
🔧 Skills
When to use? Skills are specialized instructions that may not always be relevant. Use them when you want to sometimes provide your primary agent with a relevant skillset — repeatable SOPs to apply across sessions. Description always loaded; full body loads only when invoked. Survives compaction (5K tokens each, 25K combined).
Trigger: Auto-triggered by AI or manual Context: Shared, progressively loaded Key: Token-efficient, automatic activation
Built-in Skills
/simplifyCode review (3 parallel agents)
/batchLarge parallel changes (5-30 worktrees)
/debug [desc]Troubleshoot from debug log
/loop [interval]Recurring scheduled task
/claude-apiLoad API + SDK reference
Custom Skill Locations
.claude/skills/<name>/Project skills
~/.claude/skills/<name>/Personal skills
descriptionAuto-invocation trigger
allowed-toolsSkip permission prompts
modelOverride model for skill
effortOverride effort level
paths: [globs]Path-specific (YAML list) NEW
context: forkRun in subagent (fresh context)
$ARGUMENTSUser input placeholder
${CLAUDE_SKILL_DIR}Skill's own directory
!`cmd`Dynamic context injection
When to use? Subagents are specialized personas you offload work to — code reviewer, skeptic, testing specialist, architect. Use them to keep your context clean for isolated tasks that don’t need context from others: “run tests on this file”, “refactor this function”. Results summarized back one-way; subagents cannot talk to each other. ⚠ Can burn tokens going down rabbit holes unchecked.
Trigger: Dispatched by user/AI Context: Isolated context (fresh) Key: Independent execution, no context pollution
ExploreFast read-only (Haiku)
PlanResearch for plan mode
GeneralFull tools, complex tasks
BashTerminal separate context
permissionModedefault / acceptEdits / plan / dontAsk / bypassPermissions
isolation: worktreeRun in git worktree
memory: user|project|localPersistent memory
background: trueBackground task
maxTurnsLimit agentic turns
initialPromptAuto-submit first turn
SendMessageResume agents (replaces resume)
@agent-nameMention named subagents NEW
When to use? When you need a coordination layer — a lead reviewing output from code agents and deciding what to merge. Teams shine for parallel exploration, competing hypotheses, cross-layer changes. The lead’s context acts as a natural check on scope creep — unlike subagents, teammates don’t go unchecked. Experimental.
Trigger: User requests team creation Context: Independent + peer-to-peer messaging Key: Coordinated parallel work, shared task list
Setup
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSEnable in env or settings.json (=1)
Architecture
Team leadMain session: spawns teammates, coordinates work
TeammatesSeparate Claude instances, each with own context
Task listShared across team; teammates self-claim pending tasks
MailboxDirect messaging between any teammates
Display Modes
in-processAll in one terminal; ⇧↓ to cycle teammates
tmux / iTerm2Split panes, one per teammate
--teammate-modeOverride per-session
Coordination
messageSend to one specific teammate by name
broadcastSend to all teammates (costly — use sparingly)
Plan approvalRequire teammates to plan before implementing
TeammateIdleRuns when teammate about to go idle; exit 2 to keep working
TaskCreatedRuns on task creation; exit 2 to prevent
TaskCompletedRuns on task completion; exit 2 to block
🖥️ CLI & Flags
When to use? For launching, scripting, and composing Claude Code. Key patterns: -p for headless/CI, -c to continue, --remote for web, --max-budget-usd to cap costs.
Context: New or resumed session Key: Unix-composable, scriptable
Core Commands
claudeInteractive
claude "q"With prompt
claude -p "q"Headless
claude -cContinue last
claude -r "n"Resume
claude updateUpdate
Key Flags
--modelSet model
-wGit worktree
-n / --nameSession name
--add-dirAdd dir
--agentUse agent
--allowedToolsPre-approve
--allow-dangerously-skip-permissionsAdd bypassPermissions to ⇧Tab cycle
--output-formattext/json/stream-json
--json-schemaStructured
--max-turnsLimit turns
--max-budget-usdCost cap
--exclude-dynamic-system-prompt-sectionsPrint mode: improve cross-user prompt caching NEW
--verboseVerbose
--bareMinimal mode (skips hooks/skills/plugins/MCP/auto-memory/CLAUDE.md)
--effortlow/medium/high/max
--permission-modeplan/default/…
--dangerously-skip-permissionsSkip all prompts ⚠️
--chromeChrome