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
claude project purgeDelete all Claude Code state for a path
claude agentsView all sessions: running, blocked, or completed
claude plugin details <name>Show plugin component inventory and projected token costs
claude plugin disable <name>Disable plugin (refuses if another enabled plugin depends on it)
claude plugin enable <name>Force-enable plugin and transitive dependencies

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 / xhigh (Opus 4.7) / max
--permission-modeplan / default / ...
--verboseShow verbose output
--bareMinimal headless (no hooks/LSP)
--remoteWeb session on claude.ai
--chromeEnable Chrome integration
--exclude-dynamic-system-prompt-sectionsImprove cross-user prompt caching
--from-prLoad context from PR URL (GitHub, GitLab, Bitbucket, GHE)
--plugin-url <url>Fetch plugin .zip from URL for current session
--dangerously-skip-permissionsBypass config-file permission prompts
Keyboard Shortcuts

Controls

Ctrl+CCancel input or generation
Ctrl+DExit session
Ctrl+LClear screen / full redraw
Ctrl+UClear entire input buffer
Ctrl+OToggle verbose/transcript
Ctrl+RReverse search history
Ctrl+GOpen prompt in $EDITOR
Ctrl+X Ctrl+EOpen in $EDITOR (alias)
Cmd+DeleteDelete to start of line
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
Ctrl+SNarrow history search to current project/session

Vim Mode

vEnter visual mode (select chars)
VEnter visual-line mode (select lines)

Transcript View

{Jump to previous user prompt
}Jump to next user prompt
[Dump transcript to scrollback
vOpen transcript in $EDITOR
?Show keyboard shortcuts overlay
Slash Commands

Session

/clearClear conversation
/compact [focus]Compress context
/resumeResume or switch session
/usageToken usage + streaks (merges /cost and /stats)
/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
/undoAlias for /rewind
/recapRecap session context (summary while away)
/goal [condition]Set completion condition; Claude works until met (shows elapsed time, turns, tokens)
/exportExport conversation

Configuration

/configOpen settings
/model [model]Switch model
/fast [on|off]Toggle fast mode
/themeChange color theme (incl. auto/terminal)
/colorSet prompt-bar color for session ID
/permissionsView and update permissions
/effort [level]Set effort level
/keybindingsCustomize shortcuts
/scroll-speed [speed]Tune mouse wheel scroll speed with live preview
/terminal-setupConfigure editor scroll sensitivity (VS Code/Cursor/Windsurf)

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
/ultraplanAuto-create cloud env with ultra plan mode
/loop [interval]Recurring scheduled task
/proactiveAlias for /loop
/focusToggle focus view (clutter-free; separate from verbose)
/voicePush-to-talk (20 languages)
/feedbackSend feedback (can attach last 24h or 7 days of sessions)
/doctorDiagnose installation
/pr-comments [PR]Fetch PR comments
/statsUsage streaks
/scheduleCloud scheduled tasks
/security-reviewSecurity analysis
/release-notesInteractive changelog
/team-onboardingGenerate teammate ramp-up guide from usage
/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
managed-settings.d/Drop-in org policy fragments

Notable Settings

modelOverridesMap model picker to custom IDs
autoMemoryDirectoryCustom memory directory
showThinkingSummariesOpt-in (off by default)
hooks: ifConditional hooks
continueOnBlock: truePostToolUse hook: feed rejection reason back to Claude and continue
PermissionDeniedHook on auto-mode denial
refreshIntervalRe-run status command every N seconds
disableSkillShellExecutionBlock shell execution inside skills
forceRemoteSettingsRefreshFail-closed remote settings (policy)
sandbox.network.deniedDomainsBlock specific domains even under allowedDomains wildcards
sandbox.failIfUnavailableExit with error if sandbox can't start
disableDeepLinkRegistrationPrevent claude-cli:// protocol handler
CLAUDE_CODE_ENABLE_AWAY_SUMMARYEnable auto-recap when resuming after time away
prUrlTemplateCustom code-review URL template
wslInheritsWindowsSettingsInherit Windows managed settings in WSL
cleanupPeriodDaysDays before pruning tasks/shell-snapshots/backups
skillOverridesControl skill invocation: off / user-invocable-only / name-only
worktree.baseReffresh | head — branch base for new worktrees
worktree.bgIsolationBackground session worktree behavior (none = direct working copy)

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)
CLAUDE_CODE_CERT_STOREbundled = use bundled CAs only (default: os)
CLAUDE_CODE_PERFORCE_MODEError on read-only files with p4 edit hint
CLAUDE_CODE_SUBPROCESS_ENV_SCRUBEnable subprocess sandboxing with PID namespace isolation (Linux)
API_TIMEOUT_MSCustom API request timeout in ms (default 300000)
CLAUDE_CODE_SCRIPT_CAPSLimit script invocations per session
CLAUDE_CODE_USE_POWERSHELL_TOOLEnable PowerShell tool (=1; requires pwsh)
MCP_CONNECTION_NONBLOCKINGSkip MCP wait in -p / headless mode (=true)
CLAUDECODEDetect CC shell (=1)
ENABLE_PROMPT_CACHING_1HForce 1-hour prompt cache TTL
FORCE_PROMPT_CACHING_5MForce 5-minute prompt cache TTL
CLAUDE_CODE_HIDE_CWDHide working directory in startup logo (=1)
DISABLE_UPDATESBlock all update paths (stricter than DISABLE_AUTOUPDATER)
CLAUDE_CODE_FORK_SUBAGENTEnable forked subagents on external builds (=1)
CLAUDE_CODE_SESSION_IDSession ID passed to Bash tool subprocess env
CLAUDE_CODE_DISABLE_ALTERNATE_SCREENOpt out of fullscreen renderer (=1)
CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATEAuto-upgrade via Homebrew/WinGet
ANTHROPIC_BEDROCK_SERVICE_TIERBedrock service tier: default / flex / priority
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERYEnable /v1/models gateway discovery (=1)
CLAUDE_PROJECT_DIRProject directory injected into stdio MCP server environments
MCP_TOOL_TIMEOUTPer-request timeout for remote HTTP/SSE MCP servers (ms)
CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDEPin fast mode to Opus 4.6 (=1; default is 4.7)
ANTHROPIC_WORKSPACE_IDWorkload identity federation workspace scoping
CLAUDE_CODE_GIT_BASH_PATHCustom Git for Windows path override
CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICYOpt out of PowerShell -ExecutionPolicy Bypass (=1)
CLAUDE_CODE_STOP_HOOK_BLOCK_CAPOverride stop hook block limit (default 8)
CLAUDE_CODE_PLUGIN_PREFER_HTTPSClone plugins over HTTPS instead of SSH (=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
/ultrareview [PR#]Cloud code review with parallel agents
/less-permission-promptsScan transcripts, propose tool allowlist

Custom Skill Locations

.claude/skills/<name>/Project skills
~/.claude/skills/<name>/Personal skills
.claude/skills/<name>/bin/Executables shipped with skill

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
monitorsBackground monitor agents in manifest
initialPromptAuto-submit prompt on skill load
disallowedToolsBlock specific tools in skill
disable-model-invocation: trueRun skill without LLM call
$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
_meta maxResultSizeCharsOverride result size up to 500K chars
alwaysLoadAlways load server tools (skip deferred tool search)

Permission Modes

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