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
claude plugin init <name>Scaffold a new plugin in .claude/skills
claude plugin list [--enabled|--disabled]List plugins with optional enabled/disabled filter

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)
--bg --exec '<cmd>'Start background shell session
--fallback-modelUse when primary model unavailable
--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
--safe-modeStart with all customizations disabled (CLAUDE.md, plugins, skills, hooks, MCP)
--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
/config key=valueSet any config key directly from prompt
/config --helpList available shorthand keys for /config key=value
/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
/install-github-appInstall GitHub App with optional Actions workflow setup
/reload-skillsRe-scan skill directories without restarting session
/cd <path>Move session to new working directory without breaking prompt cache

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
/downloadDownload files with arrow navigation to step through results
/scheduleCloud scheduled tasks
/security-reviewSecurity analysis
/release-notesInteractive changelog
/team-onboardingGenerate teammate ramp-up guide from usage
/workflowsView dynamic workflow runs
/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.credentialsBlock sandboxed commands from accessing credential files and secret env vars
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)
pluginSuggestionMarketplacesManaged: allowlist org marketplaces for plugin suggestions
MessageDisplayHook event: transform or hide assistant message text during display
EnterWorktreeHook event: fires when switching between Claude-managed worktrees mid-session
workflowKeywordTriggerDisable 'ultracode' keyword auto-triggering dynamic workflows (set via /config)
reloadSkills: trueSessionStart hook output: load newly-installed skills in same session
requiredMinimumVersionManaged: minimum Claude Code version required to run
requiredMaximumVersionManaged: maximum Claude Code version allowed to run
hookSpecificOutput.additionalContextStop/SubagentStop hook return: extra feedback fed back to Claude
disableBundledSkillsHide bundled skills, workflows, and built-in slash commands from model
post-sessionSelf-hosted runner lifecycle hook: runs after session ends, before workspace deletion
teammateMode: "iterm2"iTerm2 teammate mode; warns when auto-detection fails
respondToBashCommands: falseDisable auto Claude responses to ! bash commands (preserves context-only behavior)
autoMode.classifyAllShellRoute all Bash/PowerShell commands through auto-mode classifier

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_MCP_TOOL_IDLE_TIMEOUTIdle timeout for remote MCP tool calls beyond 5 min (ms)
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)
CLAUDE_CODE_ENABLE_AUTO_MODEEnable auto mode on Bedrock/Vertex/Foundry for Opus 4.7/4.8 (=1)
OTEL_LOG_TOOL_DETAILSInclude tool parameters in tool_decision telemetry events (=1)
OTEL_RESOURCE_ATTRIBUTESValues included as labels on metric datapoints for slicing usage by team or repo
CLAUDE_CODE_TMPDIROverride directory for temporary files
CLAUDE_CODE_SAFE_MODEStart with all customizations disabled (=1)
CLAUDE_CODE_DISABLE_BUNDLED_SKILLSHide bundled skills, workflows, and built-in slash commands (=1)
API_FORCE_IDLE_TIMEOUTSet to 0 to opt out of idle timeout on Vertex/Foundry (default 5 min)
CLAUDE_CODE_MAX_RETRIESMax retry attempts (capped at 15; use CLAUDE_CODE_RETRY_WATCHDOG for unattended sessions)
CLAUDE_CODE_RETRY_WATCHDOGEnable retry watchdog for unattended/long-running sessions
CLAUDE_CODE_DISABLE_MOUSE_CLICKSDisable mouse interactions in fullscreen while preserving scroll (=1)
OTEL_LOG_ASSISTANT_RESPONSESControl redaction of assistant responses in claude_code.assistant_response OTel log events
CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAPDisable automatic memory-pressure reaping for idle background shell commands (=1)
Skills and Agents

Built-in Skills

/code-review [--comment|--fix]Correctness-focused review; --comment posts inline PR comments; --fix applies findings
/simplifyCleanup-only review (reuse, simplification, efficiency); applies fixes to working tree
/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
5 levels deepSub-agents can spawn their own sub-agents (up to 5 levels)
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
claude mcp login <name>Authenticate MCP server without interactive menu (--no-browser for SSH)
claude mcp logout <name>Log out from authenticated 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