Claude Code Cheat Sheet

Everything you need in one place — Commands, Shortcuts, Features & Tips
v2.x — March 2026
Keyboard Shortcuts

Essentials

EnterSend message / confirm EscCancel current input Esc EscRewind / summary menu Ctrl+CCancel input or generation Ctrl+DExit Claude Code Shift+TabCycle permission modes Ctrl+BSend task to background

Navigation & Display

Ctrl+RSearch history Ctrl+LClear screen (keeps conversation) Ctrl+OOpen/close verbose transcript Ctrl+TShow/hide task list Ctrl+SStash current prompt ↑/↓Navigate command history ←/→Cycle tabs / footer

Editing & Model

\ + EnterMulti-line input Ctrl+GOpen in external editor Ctrl+VPaste image (screenshots, diagrams) Ctrl+KDelete to end of line Ctrl+UDelete from cursor to beginning Ctrl+YPaste deleted text Ctrl+_Undo last action Alt+B / Alt+FMove back / forward one word Option+PModel selector NEW Option+TToggle extended thinking NEW Alt+OToggle fast mode NEW ?Show all shortcuts NEW Space (hold)Push-to-talk (if /voice enabled) Alt+YCycle paste history (after Ctrl+Y) Ctrl+JNewline (control sequence) Option+EnterNewline (macOS) Ctrl+X Ctrl+KKill all background agents (×2 to confirm) Ctrl+X Ctrl+EOpen in external editor (alias Ctrl+G)

Quick Prefixes

/Slash command or skill !Bash mode — run a shell command @Autocomplete file/folder/agent

Confirmation Dialogs

Y / EnterConfirm N / EscDeny Ctrl+EToggle permission explanation Ctrl+DToggle permission debug info
Tip: /terminal-setup for Shift+Enter. /keybindings to customize. Contexts: Global, Chat, Confirmation, Transcript, etc. (17 contexts).
Slash Commands

Session & Context

/clearReset the conversation (alias: /reset, /new)
/compact [focus]Compact with optional focus
/resume [session]Resume by ID or name (alias: /continue)
/rewindGo back to a checkpoint (alias: /checkpoint)
/rename [name]Rename the session
/branch [name]Branch the conversation (alias: /fork)
/export [file]Export conversation as text
/copy [N]Copy response N to clipboard
/costShow costs and tokens
/contextColor-coded context consumption grid
/tasksList and manage background tasks

Model & Configuration

/model [name]Switch model (sonnet, opus, haiku)
/effort [level]low / medium / high / max / auto
/fast [on|off]Toggle fast output mode
/configConfiguration panel (alias: /settings)
/permissionsManage permissions (alias: /allowed-tools)
/mcpManage MCP servers & OAuth
/hooksView configured hooks
/themeChange theme (light, dark, daltonized, ANSI)
/color [color]Prompt bar color
/sandboxToggle sandbox mode
/vimToggle vim / normal mode

Project & Analysis

/initCreate CLAUDE.md for the project
/memoryEdit CLAUDE.md & memory, toggle auto-memory
/add-dir <path>Add a working directory
/diffInteractive diff of changes NEW
/reviewCode review (deprecated → code-review plugin)
/security-reviewScan for vulnerabilities NEW
/insightsHTML usage analysis report
/statsVisualize daily usage, streaks, preferences
/pr-comments [PR]GitHub PR comments
/plan [desc]Enter plan mode with optional description
/simplifyAnalyze code for reuse, quality, efficiency
/batch [task]Parallel changes in worktrees
/debug [desc]Session troubleshooting

Extensions & Plugins

/pluginManage Claude Code plugins
/reload-pluginsReload all active plugins
/agentsManage sub-agents
/skillsList available skills
/chromeConfigure Claude in Chrome
/ideManage IDE integrations

Advanced & Remote

/loop [interval]Repeat a prompt at interval
/scheduleCloud-scheduled tasks NEW
/btwQuick question without tools or history
/voicePush-to-talk voice dictation NEW
/teleportResume a web session locally
/desktopTransfer to Desktop app NEW
/remote-controlMake session accessible from claude.ai
/remote-envConfigure default remote environment

System & Account

/helpHelp and command reference
/doctorCheck installation and auth
/statusVersion and account info
/usagePlan limits and rate limits
/extra-usageConfigure extra usage
/feedbackSubmit a report (alias: /bug)
/release-notesView full changelog
/login / /logoutLogin / Logout
/upgradeUpgrade to higher plan
/privacy-settingsPrivacy settings
/keybindingsOpen keybindings file
/terminal-setupConfigure terminal keybindings
/statuslineConfigure the status line
/install-github-appInstall the GitHub Actions app
/install-slack-appInstall the Slack app via OAuth
/exitExit (alias: /quit)
/mobileQR code for mobile app (alias: /ios, /android)
/passesShare a free week of Claude Code
/stickersOrder Claude Code stickers
🚀 CLI Launch Flags

Session Startup

claudeInteractive session
claude "query"Start with an initial prompt
claude -p "query"Print mode — output and exit
claude -cResume last conversation
claude -r "id"Resume by name or ID
claude -n "name"Name the session
claude -w branchIsolated git worktree

Model & Reasoning

--model sonnetChoose the model
--model opus[1m]Opus + 1M context
--effort highThinking level (low/medium/high/max/auto)
--fallback-modelFallback model if overloaded

Context & Directories

--add-dir ../pathAdditional directories
--bareSkip hooks, plugins, MCP, CLAUDE.md
--verboseDetail for each turn
--debug "api,hooks"Debug by categories
--chrome / --no-chromeEnable/disable Chrome
--ideAuto-connect IDE at startup

Permissions

--permission-mode planRead-only mode
--permission-mode autoAI classifies permissions
--allowedToolsAuto-approved tools
--disallowedToolsTools removed from context
--toolsRestrict built-in tools
--enable-auto-modeUnlock Auto in Shift+Tab
--permission-prompt-toolMCP tool for permissions (headless)
--dangerously-skip-permissionsEquivalent of bypassPermissions

Output & Formats

--output-format jsonStructured JSON output
--output-format stream-jsonReal-time streaming JSON
--input-formatInput format (text, stream-json)
--include-partial-messagesInclude partial streaming events
--json-schema '{}'Force an output schema
--max-turns 5Limit agentic turns
--max-budget-usd 2Spending limit

System Prompt

--system-prompt "text"Override the system prompt
--system-prompt-fileLoad from a file
--append-system-promptAppend text to the prompt
--append-system-prompt-fileAppend from a file

Advanced & Remote

--remote "task"Remote session on claude.ai
--remote-controlEnable remote control
--tmuxWorktree + tmux pane NEW
--teammate-modeAgent teams: auto/in-process/tmux
--agent nameRun as agent
--agentsDefine agents via JSON
--from-pr 42Resume from a PR NEW
--fork-sessionFork while keeping context NEW
--teleportResume a web session
--mcp-configLoad MCP servers
--strict-mcp-configUse ONLY these MCP servers
--plugin-dirLoad plugins from a directory
--settingsCustom JSON settings file
--init / --init-onlyRun init hooks (and exit)
--maintenanceRun maintenance hooks and exit
--disable-slash-commandsDisable skills and commands
--no-session-persistenceDisable persistence (print)
--session-idSpecific session UUID
--agentsDefine dynamic agents via JSON
--channelsMCP notifications to listen to (research preview)
--setting-sourcesSetting sources to load (user, project, local)
--betasBeta headers for API requests

CLI Subcommands

claude updateUpdate
claude auth loginLogin (--email, --sso, --console)
claude auth statusAuth status (JSON or --text)
claude agentsList configured agents
claude mcpManage MCP servers
claude pluginManage plugins
claude auto-mode defaultsDefault auto-mode rules
claude auto-mode configEffective config with settings
🔌 The Big 5 — Claude Code Extension System

1. CLAUDE.md — System Prompt

ManagedEnterprise policy, highest priority
Project./CLAUDE.md or ./.claude/CLAUDE.md
User~/.claude/CLAUDE.md

Imports: @docs/standards.md (max 5 levels)

Size: Keep < 200 lines, @path to split

2. Rules — Scoped Rules

Files in .claude/rules/*.md, activated by glob:

paths: ["src/**/*.tsx"] MUST use TanStack Query. SHOULD prefer named exports.

Placement based on consumer. MUST/SHOULD/MAY

3. Custom Commands — Shortcuts

Create in .claude/commands/name.md/name

$ARGUMENTS, $0, $1 for arguments

Live context: !`git diff` (executed before prompt)

4. Skills — Complex Workflows

Directory .claude/skills/name/SKILL.md

descriptionAuto-discovery trigger (250 chars)
context: forkIsolated sub-agent NEW
paths: "*.ts"Activate by file type NEW
effort: highForce extended thinking NEW
user-invocabletrue = /command, false = Claude only

Progressive disclosure: SKILL.md < 500 lines, [ref](references/)

5. Sub-agents — Parallel Specialists

Create in .claude/agents/name.md

modelModel (inherited by default)
toolsRestrict tools
isolation: worktreeSeparate git worktree NEW
memory: projectPersistent memory NEW
permissionModeDedicated permission mode

Invoke: @"name (agent)" | --agent name

Builtin: Explore (Haiku), Plan, general-purpose

6. MCP + Plugins

MCP: Integrations via .mcp.json. Tools: mcp__server__tool

# Add / List / Remove claude mcp add playwright -- npx @playwright/mcp claude mcp list claude mcp remove playwright # Import from Claude Desktop claude mcp add-from-claude-desktop # Debug claude --mcp-debug

Transports: stdio | http | sse | ws

Plugins: Bundles of skills + agents + hooks + MCP

/plugin install name@marketplace

🖥 MCP Computer Use NEW

Built-in MCP server — Claude sees and controls your desktop: screenshots, clicks, typing, scrolling on macOS apps. Enabled in Settings > General > Computer Use. Pro/Max only.

Security: request_access required. Allowlist per app. Screenshots filtered by compositing — only authorized apps are visible. systemKeyCombos separate grant.

27 tools: screenshot, left_click, type, key, scroll, zoom, computer_batch (sequence in 1 call), open_application, mouse_move, double_click, right_click, left_click_drag, read/write_clipboard, wait, switch_display, etc.

Where to put what? Commands = you invoke  |  Skills = Claude invokes  |  Agents = separate context  |  MCP = external integrations  |  Computer Use = desktop control
🛡 Permission Modes
ModeBehavior
DefaultAsks permission for every tool
acceptEditsAuto-approves edits, asks for Bash
PlanRead-only. Explores & understands. Writes nothing.
AutoAI classifies (safe/risky). Team/Enterprise + Sonnet/Opus 4.6
dontAskSkip prompts, ignore non-approved tools NEW
bypassSkip all checks (containers only)
Normal Auto-Accept Plan

Shift+Tab to cycle. --enable-auto-mode to unlock Auto.


Pro workflow: Plan Mode to explore → Normal to implement → Rewind if needed.


Pre-approve Tools

// .claude/settings.json "allow": ["Read", "Bash(git *)", "Bash(npm run *)"] "deny": ["Bash(rm -rf *)"]

Order: denyaskallow (first match wins)

Syntax: Bash(npm run *), Read(/src/**), WebFetch(domain:x.com), mcp__server__*

🔗 Hooks — Automation

Events (25)

EventWhen
SessionStartSession start / resume
SessionEndSession end
UserPromptSubmitBefore Claude processes the message
PreToolUseBefore a tool — can block (exit 2)
PostToolUseAfter a successful tool
PostToolUseFailureAfter a failed tool
PermissionRequestWhen a permission dialog appears
StopClaude finishes its response
StopFailureTurn ended by API error
SubagentStartA sub-agent starts NEW
SubagentStopA sub-agent finishes NEW
TeammateIdleA teammate is about to become idle
TaskCreatedTask created
TaskCompletedTask completed
PreCompactBefore compaction
PostCompactAfter compaction
NotificationClaude sends a notification
InstructionsLoadedCLAUDE.md or rules loaded
ConfigChangeA config file changes
FileChangedA watched file changes
CwdChangedWorking directory changes
WorktreeCreateWorktree created
WorktreeRemoveWorktree removed
ElicitationMCP server requests input
ElicitationResultResponse to an MCP elicitation

4 Handler Types NEW

commandShell command
httpPOST to an endpoint
promptLLM single-turn (Haiku)
agentMulti-turn sub-agent
// Auto-format after write "PostToolUse": [{ "matcher": "Write|Edit", "if": "Edit(*.ts)", "hooks": [{ "type": "command", "command": "npx prettier --write $CLAUDE_FILE_PATHS" }] }]

Codes: 0 = success, 2 = block (stderr → Claude), other = error

if field: Filter by tool name AND arguments. E.g.: Bash(git *), Edit(*.ts)

Env vars: $CLAUDE_PROJECT_DIR, $CLAUDE_FILE_PATHS, $CLAUDE_TOOL_INPUT

Input Superpowers
SyntaxAction
@fileReference files & folders in context
@"agent"Mention a specific sub-agent
!commandRun a shell. E.g.: ! git status
Ctrl+VPaste screenshots, diagrams, images

Pipe Input

# Analyze logs cat error.log | claude -p "find root cause" # PR review gh pr diff 42 | claude -p "security review" # Commit message git diff --staged | claude -p "conventional commit msg" # Translate cat README.md | claude -p "translate to Spanish"

Multi-directories & Worktrees

# Add directories claude --add-dir ../lib --add-dir ../shared # Isolated worktree claude -w feature # isolated git branch # Worktree + tmux claude -w feature --tmux

Background & Remote

Ctrl+B to send to background. Claude continues while you work.

--remote "task" to launch an agent on claude.ai.

/remote-control to make the session remotely accessible.

Configuration

Hierarchy (decreasing priority)

Enterprise/etc/claude-code/managed-settings.json
CLI ArgsFlags passed at launch
Local.claude/settings.local.json (gitignored)
Project.claude/settings.json (committed)
User~/.claude/settings.json (global)

Config Commands

config listShow all settings config get keyView a value config set key valSet a value config add key valAdd to an array config remove key valRemove from an array

Key Environment Variables

ANTHROPIC_API_KEYAPI key (overrides subscription)
ANTHROPIC_MODELDefault model
CLAUDE_CODE_EFFORT_LEVELEffort level
CLAUDE_CODE_USE_BEDROCKUse Amazon Bedrock
CLAUDE_CODE_USE_VERTEXUse Google Vertex AI
CLAUDE_CODE_DISABLE_1M_CONTEXTDisable 1M context
CLAUDE_CODE_DISABLE_AUTO_MEMORYDisable auto memory
DISABLE_TELEMETRYOpt-out telemetry
DISABLE_AUTOUPDATERDisable auto updates

Advanced Permissions

// .claude/settings.json { "permissions": { "allow": ["Read", "Bash(git *)"], "deny": ["Bash(rm -rf *)"] }, "allowedMcpServers": ["playwright"], "deniedMcpServers": ["untrusted"] }
📁 File Structure Map

Project Level (.claude/)

CLAUDE.md — Project memory, conventions settings.json — Shared settings (git) settings.local.json — Personal settings (gitignored) commands/ — Project slash commands skills/ — Skills (SKILL.md + references/) agents/ — Project sub-agents rules/ — File-scoped rules .mcp.json — Project MCP config (committable)

Global Level (~/.claude/)

CLAUDE.md — Applies to ALL projects settings.json — Global settings commands/ — Personal commands skills/ — Personal skills agents/ — Personal agents rules/ — Global rules keybindings.json — Custom keybindings ~/.claude.json — User MCP config
Rewind & Checkpoints
Esc EscOpen rewind menu anytime /rewindSame function via command

Rewind Options

OptionEffect
ConversationGo back in chat. Code stays.
CodeRestore files. Conversation stays.
Full RewindRestore conversation AND code.
Limits: Side effects (Bash, deleted files, installed packages) CANNOT be undone. Checkpoints only track file edits by Claude. Use Git.

Context Management

Startup budget ~6K tokens: system prompt, memory, env, MCP, CLAUDE.md, rules, skill descriptions.

Compaction: Auto at ~95% capacity. /compact to trigger manually. CLAUDE.md re-read from disk.

"Document & Clear" workflow: Save progress → /clear → Start fresh. Claude reads the summary.

Save tokens: Scoped rules, sub-agents for verbose tasks, --bare, opus[1m] for large codebases.

🎯 Pro Workflow — Getting the Most Out of Claude Code

Starting a Project

1.cd project && claude 2./init to generate CLAUDE.md 3.Edit CLAUDE.md → conventions & commands 4.Start coding!

Plan → Execute Loop

Shift+Tab × 2 → Plan Mode → Describe the task

Validate → Shift+Tab → Normal → "implement the plan"

Manage Context

/compactContext growing? Compact it /clearUnrelated tasks? Reset opus[1m]Large codebases? 1M context --bareQuick questions? Skip startup

Prompting Techniques

Precisecat error.log | claude -p "root cause" Verifiable"After the fix, run npm test" IncrementalBreak into steps, validate each one Correct earlyCtrl+C if wrong direction

Advanced Patterns

Worktreesclaude -w feat --tmux
Multi-dirs--add-dir ../lib
BackgroundCtrl+B
Agent TeamsMultiple Claudes in parallel
Remote--remote "task"
Loop/loop 5m /test
Schedule/schedule for cron jobs

Headless / CI

claude -p --max-budget-usd 2 \ --max-turns 5 "fix failing test"
Learning loop: Claude makes a mistake → you correct it → promote to a MUST rule → Claude never repeats it. This is compound learning.
📝 Customize Claude Code — Create Your Extensions

📋 Slash Command — .claude/commands/name.md

--- description: Review staged changes allowed-tools: Read, Bash(git *) model: sonnet disable-model-invocation: true argument-hint: "[focus area]" --- Diff: !`git diff --staged` Review: $ARGUMENTS | $1, $2 positional

You invoke it: /name. Personal: ~/.claude/commands/

🧠 Skill — .claude/skills/name/SKILL.md

--- name: deploy description: "Deploy to production (250 chars max)" context: fork # isolated sub-agent paths: "src/**/*.ts" # activate by glob effort: high # force extended thinking user-invocable: true # false = Claude only --- Instructions... + [ref](references/guide.md)

Claude decides when to invoke it (auto-discovery via description).

🤖 Sub-agent — .claude/agents/name.md

--- name: security-reviewer description: "Audit code for vulnerabilities" model: sonnet tools: Read, Grep, Glob memory: project # user / project / local isolation: worktree # separate git worktree permissionMode: plan --- You are a security specialist...

Invoke: @"name (agent)" | --agent name | natural language

📐 Rule — .claude/rules/name.md

--- paths: ["src/**/*.tsx", "src/**/*.ts"] --- MUST use TanStack Query for data fetching. SHOULD prefer named exports over default. MAY use inline styles for one-off components.

Auto-loaded when Claude touches a file matching the glob.

🔗 Hook — .claude/settings.json

"hooks": { "PostToolUse": [{ "matcher": "Write|Edit", "if": "Edit(*.ts)", "hooks": [{ "type": "command", "command": "npx prettier --write $FILE" }] }] }

Deterministic — always runs (unlike CLAUDE.md ~80%).

🔌 MCP Server — .mcp.json

# Add via CLI claude mcp add playwright -- npx @playwright/mcp # Or in .mcp.json { "mcpServers": { "pg": { "type": "stdio", "command": "npx", "args": ["@mcp/server-postgres"] }}}
Where to put what? Every conversation → CLAUDE.md | File-scoped → rules/ | Deterministic → hooks | Reusable workflow → commands/ | Complex + refs → skills/ | Parallel task → agents/ | External tool → MCP
💡 Quick Reference — Most Used Combos

Basic Commands

claudeInteractive session
claude -cResume last session
claude -p "query"Non-interactive mode
claude -r "name"Named session
claude --model opusUse Opus
/clearStart from scratch
/compactFree up context

Models & Effort

sonnetFast & balanced (default)
opusComplex reasoning
opus[1m]Opus + 1M token context
haikuUltra-fast, exploration
--effort lowSimple questions
--effort maxComplex problems (Opus)
"ultrathink"One-time max effort

Power Moves

Esc EscRewind — undo
Shift+Tab ×2Plan Mode — read-only
Ctrl+BBackground task
--remote "task"Remote agent
-w feat --tmuxWorktree + tmux
/loop 5m /testRepeat every 5 min
/insightsAnalyze your usage