Claude Code Cheatsheet

Every shortcut, command, and config option in one place.

CLI Essentials

Launch

claudeInteractive session
claude "query"Start with a prompt
claude -p "query"Headless (non-interactive)
claude -cContinue last conversation
claude -r "name"Resume a named session
claude updateUpdate to latest version

Key Flags

--modelChoose model
-wGit worktree isolation
-n / --nameName this session
--add-dirAdd working directory
--agentUse a custom agent
--allowedToolsPre-approve tools
--output-formatjson or stream
--max-turnsLimit agentic turns
--max-budget-usdSet cost cap
--effortlow / medium / high / max
--permission-modeplan / default / ...
--verboseShow verbose output
--bareMinimal headless (no hooks/LSP)
--remoteWeb session on claude.ai
--chromeEnable Chrome integration
Keyboard Shortcuts

Controls

Ctrl+CCancel input or generation
Ctrl+DExit session
Ctrl+LClear screen
Ctrl+OToggle verbose/transcript
Ctrl+RReverse search history
Ctrl+GOpen prompt in $EDITOR
Ctrl+BBackground running task
Ctrl+TToggle task list
Ctrl+VPaste image
Esc EscRewind or summarize

Modes

Shift+TabCycle permission modes
Alt+PSwitch model
Alt+TToggle thinking
Alt+OToggle fast mode

Input

\+EnterNewline
/Slash command
!Run bash command
@File mention + autocomplete
Slash Commands

Session

/clearClear conversation
/compact [focus]Compress context
/resumeResume or switch session
/rename [name]Name session
/branch [name]Branch conversation
/costToken usage breakdown
/contextVisualize context usage
/diffInteractive diff viewer
/copy [N]Copy last response
/rewindRewind to checkpoint
/exportExport conversation

Configuration

/configOpen settings
/model [model]Switch model
/fast [on|off]Toggle fast mode
/themeChange color theme
/permissionsView and update permissions
/effort [level]Set effort level
/keybindingsCustomize shortcuts

Tools

/initCreate CLAUDE.md
/memoryEdit CLAUDE.md files
/mcpManage MCP servers
/hooksManage hooks
/skillsList available skills
/agentsManage agents
/chromeChrome integration
/add-dir <path>Add working directory

Utilities

/powerupInteractive feature lessons
/btw <question>Side question (no context cost)
/plan [desc]Enter plan mode
/loop [interval]Recurring scheduled task
/voicePush-to-talk (20 languages)
/doctorDiagnose installation
/pr-comments [PR]Fetch PR comments
/statsUsage streaks
/scheduleCloud scheduled tasks
/security-reviewSecurity analysis
/release-notesInteractive changelog
/helpShow help
Memory and Files

CLAUDE.md Locations

./CLAUDE.mdProject (team-shared)
~/.claude/CLAUDE.mdPersonal (all projects)
/etc/claude-code/Managed (org-wide)

Rules

.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 + topic files, auto-loaded
Workflows and Tips

Plan Mode

Shift+TabNormal -> Auto-Accept -> Plan
--permission-mode planStart in plan mode

Thinking

Alt+TToggle thinking on/off
"ultrathink"Max effort for this turn
/effortlow, medium, high, max

Worktrees

--worktree nameIsolated branch per feature
isolation: worktreeAgent in own worktree
sparsePathsCheckout only needed dirs
/batchAuto-creates worktrees

Voice

/voiceEnable push-to-talk
Space (hold)Record, release to send
20 languagesEN, ES, FR, DE, PL, CZ...

Context Management

/contextUsage and optimization tips
/compact [focus]Compress with focus keyword
Auto-compactTriggers at ~95% capacity
1M contextOpus 4.6 (Max/Team/Enterprise)
CLAUDE.mdSurvives compaction

Headless / SDK

claude -p "query"Non-interactive mode
--output-format jsonStructured output
--max-budget-usd 5Set a cost cap
cat file | claude -pPipe input
Config and Environment

Config Files

~/.claude/settings.jsonUser settings
.claude/settings.jsonProject (shared)
.claude/settings.local.jsonLocal only
~/.claude.jsonOAuth, MCP, state
.mcp.jsonProject MCP servers

Notable Settings

modelOverridesMap model picker to custom IDs
autoMemoryDirectoryCustom memory directory
showThinkingSummariesOpt-in (off by default)
hooks: ifConditional hooks
PermissionDeniedHook on auto-mode denial

Environment Variables

ANTHROPIC_API_KEYAPI authentication
ANTHROPIC_MODELDefault model override
CLAUDE_CODE_EFFORT_LEVELlow / medium / high / max / auto
MAX_THINKING_TOKENS0 = thinking off
CLAUDE_STREAM_IDLE_TIMEOUT_MSStreaming watchdog (default 90s)
CLAUDE_CODE_NO_FLICKERAlt-screen rendering (=1)
CLAUDECODEDetect CC shell (=1)
Skills and Agents

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

Skill Frontmatter

descriptionAuto-invocation trigger
allowed-toolsSkip permission prompts
modelOverride model for skill
effortOverride effort level
paths: [globs]Path-specific activation
context: forkRun in subagent
$ARGUMENTSUser input placeholder
!`cmd`Dynamic context injection

Built-in Agents

ExploreFast read-only (Haiku)
PlanResearch for plan mode
GeneralFull tools, complex tasks
BashTerminal, separate context

Agent Config

permissionModedefault / acceptEdits / plan / dontAsk
isolation: worktreeRun in git worktree
background: trueBackground task
maxTurnsLimit agentic turns
SendMessageResume agents
@agent-nameMention named subagents
MCP Servers

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)

Management

/mcpInteractive UI
claude mcp listList all servers
claude mcp serveCC as MCP server
ElicitationServers can request input mid-task

Permission Modes

defaultPrompts for each action
acceptEditsAuto-accept file edits
planRead-only research
dontAskDeny unless pre-allowed
bypassPermissionsSkip all prompts