Reference
Claude Code Cheatsheet
Every shortcut, command, and config option in one place.
CLI Essentials
Launch
claude- Interactive session
claude "query"- Start with a prompt
claude -p "query"- Headless (non-interactive)
claude -c- Continue last conversation
claude -r "name"- Resume a named session
claude update- Update to latest version
claude project purge- Delete all Claude Code state for a path
claude agents- View all sessions: running, blocked, or completed
claude remote-control --continue- Resume a Remote Control session
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
claude auto-mode reset- Restore default auto-mode configuration (--yes to skip confirmation)
claude rc- Short alias for claude remote-control
claude setup-token- Create a long-lived auth token for headless and CI use
claude self-hosted-runner- Run web, mobile and desktop sessions on your own machine (Team/Enterprise)
claude plugin validate- Check a plugin or marketplace manifest before publishing
Key Flags
--model- Choose model
-w- Git worktree isolation
-n / --name- Name this session
--add-dir- Add working directory
--agent- Use a custom agent
--allowedTools- Pre-approve tools
--output-format- json or stream
--max-turns- Limit agentic turns
--max-budget-usd- Set cost cap
--effort- low / medium / high / xhigh / max
--permission-mode- plan / default / ...
--verbose- Show verbose output
--bare- Minimal headless (no hooks/LSP)
--bg --exec '<cmd>'- Start background shell session
--fallback-model- Use when primary model unavailable
--remote- Web session on claude.ai
--teleport <id>- Continue a cloud session locally
--chrome- Enable Chrome integration
--exclude-dynamic-system-prompt-sections- Improve cross-user prompt caching
--from-pr- Load context from PR URL (GitHub, GitLab, Bitbucket, GHE)
--plugin-url <url>- Fetch plugin .zip from URL for current session
--safe-mode- Start with all customizations disabled (CLAUDE.md, plugins, skills, hooks, MCP)
--ax-screen-reader- Screen reader mode (plain-text rendering)
--dangerously-skip-permissions- Bypass config-file permission prompts
--forward-subagent-text- Include subagent text and thinking in stream-json output
--system-prompt-file <path>- Load system prompt from file in --print/-p mode
--append-system-prompt <text>- Append text to system prompt (interactive and print modes)
--mcp-config <file>- Load extra MCP servers for this session
--settings <file>- Load an extra settings file (trusted source for sandbox keys)
Keyboard Shortcuts
Controls
Ctrl+C- Cancel input or generation
Ctrl+D- Exit session
Ctrl+Z- Suspend Claude Code (resume with fg)
Ctrl+L- Clear screen / full redraw
Ctrl+U- Clear entire input buffer
Ctrl+O- Toggle verbose/transcript
Ctrl+R- Reverse search history
Ctrl+G- Open prompt in $EDITOR
Ctrl+X Ctrl+E- Open in $EDITOR (alias)
Cmd+Delete- Delete to start of line
Ctrl+B- Background running task
Ctrl+T- Toggle task list
Ctrl+V- Paste image
Esc Esc- Rewind or summarize
Ctrl+W- Delete word before cursor
Ctrl+K- Delete to end of line
Modes
Shift+Tab- Cycle permission modes
Alt+P- Switch model
Alt+T- Toggle thinking
Alt+O- Toggle fast mode
Ctrl+Alt+F- Toggle focus view in VSCode (hides tool activity)
Input
\\+Enter- Newline
/- Slash command
!- Run bash command
@- File mention + autocomplete
:word:- Emoji shortcode autocomplete (e.g. :heart: → ❤️)
Ctrl+S- Narrow history search to current project/session
Vim Mode
v- Enter visual mode (select chars)
V- Enter visual-line mode (select lines)
c- Change operator (delete selection + enter insert mode)
f / F- Find character forward / backward on line
t / T- Move till character forward / backward on line
Transcript View
{- Jump to previous user prompt
}- Jump to next user prompt
[- Dump transcript to scrollback
v- Open transcript in $EDITOR
?- Show keyboard shortcuts overlay
Slash Commands
Session
/clear- Clear conversation
/compact [focus]- Compress context
/resume- Resume or switch session
/usage- Token usage + streaks (merges /cost and /stats)
/rename [name]- Name session
/branch [name]- Branch conversation
/cost- Token usage breakdown
/context- Visualize context usage
/diff- Interactive diff viewer
/copy [N]- Copy last response
/rewind- Rewind to checkpoint
/undo- Alias for /rewind
/recap- Recap session context (summary while away)
/goal [condition]- Set completion condition; Claude works until met (shows elapsed time, turns, tokens)
/export- Export conversation
/autocompact- Auto-compact settings dialog (opens mid-turn)
Configuration
/config- Open settings
/config key=value- Set any config key directly from prompt
/config --help- List available shorthand keys for /config key=value
/model [model]- Switch model
/fast [on|off]- Toggle fast mode (Opus 5 and 4.8)
/theme- Change color theme (incl. auto/terminal)
/color- Set prompt-bar color for session ID
/permissions- View and update permissions
/effort [level]- Set effort level
/keybindings- Customize shortcuts
/scroll-speed [speed]- Tune mouse wheel scroll speed with live preview
/terminal-setup- Configure editor scroll sensitivity (VS Code/Cursor/Windsurf)
/login- Sign in or switch account
/remote-control- Move Remote Control to this session
Tools
/init- Create CLAUDE.md
/memory- Edit CLAUDE.md files
/mcp- Manage MCP servers
/hooks- Manage hooks
/skills- List available skills
/agents- Manage agents
/chrome- Chrome integration
/add-dir <path>- Add working directory
/install-github-app- Install GitHub App with optional Actions workflow setup
/reload-skills- Re-scan skill directories without restarting session
/cd <path>- Move session to new working directory without breaking prompt cache
/commit-push-pr- Commit, push, and open a PR in one step (auto-allows pushes to configured push remote)
/fork [desc]- Copy conversation to a new background session; keeps your current session running
/subtask- Launch an in-session subagent (former /fork behavior)
/review- Alias for /code-review (reviews current diff or PR; /review <level> <pr#>)
/plugin- Browse, install and manage plugins (installs activate without a restart)
/reload-plugins- Reload plugins without restarting the session
Utilities
/powerup- Interactive feature lessons
/btw <question>- Side question (no context cost)
/plan [desc]- Enter plan mode
/loop [interval]- Recurring scheduled task
/proactive- Alias for /loop
/status- Show session kind (interactive / attached / unattended)
/focus- Toggle focus view (clutter-free; separate from verbose)
/voice- Push-to-talk (20 languages)
/feedback- Send feedback (can attach last 24h or 7 days of sessions)
/doctor- Complete setup checkup
/checkup- Alias for /doctor
/pr-comments [PR]- Fetch PR comments
/stats- Usage streaks
/download- Download files with arrow navigation to step through results
/deep-research- Deep research mode (manual-launch only)
/schedule- Cloud scheduled tasks
/teleport- Cloud sessions: show how to continue locally (claude --teleport <id>)
/security-review- Security analysis
/release-notes- Interactive changelog
/team-onboarding- Generate teammate ramp-up guide from usage
/workflows- View dynamic workflow runs
/tasks- Open the background task panel
/bug- Report a bug
/advisor- Pick an advisor model to consult during a session
/usage-credits- Request usage credits from your organization admins
/autofix-pr- Cloud session that fixes a PR (not on the default branch)
/help- Show help
Memory and Files
CLAUDE.md Locations
./CLAUDE.md- Project (team-shared)
~/.claude/CLAUDE.md- Personal (all projects)
/etc/claude-code/- Managed (org-wide)
Rules
.claude/rules/*.md- Project rules
~/.claude/rules/*.md- User rules
paths: frontmatter- Path-specific rules
@path/to/file- Import in CLAUDE.md
Auto Memory
~/.claude/projects/<proj>/memory/- MEMORY.md + topic files, auto-loaded
Workflows and Tips
Plan Mode
Shift+Tab- Manual -> Auto-Accept -> Plan
--permission-mode plan- Start in plan mode
Thinking
Alt+T- Toggle thinking on/off
"ultrathink"- Max effort for this turn
/effort- low, medium, high, max
Worktrees
--worktree name- Isolated branch per feature
isolation: worktree- Agent in own worktree
sparsePaths- Checkout only needed dirs
/batch- Auto-creates worktrees
Voice
/voice- Enable push-to-talk
Space (hold)- Record, release to send
20 languages- EN, ES, FR, DE, PL, CZ...
Context Management
/context- Usage and optimization tips
/compact [focus]- Compress with focus keyword
Auto-compact- Triggers at ~95% capacity
1M context- Opus 5 and Opus 4.6 (Max/Team/Enterprise)
CLAUDE.md- Survives compaction
Headless / SDK
claude -p "query"- Non-interactive mode
--output-format json- Structured output
--max-budget-usd 5- Set a cost cap
cat file | claude -p- Pipe input
Config and Environment
Config Files
~/.claude/settings.json- User settings
.claude/settings.json- Project (shared)
.claude/settings.local.json- Local only
~/.claude.json- OAuth, MCP, state
.mcp.json- Project MCP servers
managed-settings.d/- Drop-in org policy fragments
Notable Settings
modelOverrides- Map model picker to custom IDs
autoMemoryDirectory- Custom memory directory
showThinkingSummaries- Opt-in (off by default)
hooks: if- Conditional hooks
continueOnBlock: true- PostToolUse hook: feed rejection reason back to Claude and continue
PermissionDenied- Hook on auto-mode denial
refreshInterval- Re-run status command every N seconds
disableSkillShellExecution- Block shell execution inside skills
forceRemoteSettingsRefresh- Fail-closed remote settings (policy)
sandbox.credentials- Block sandboxed commands from accessing credential files and secret env vars
sandbox.network.deniedDomains- Block specific domains even under allowedDomains wildcards
sandbox.failIfUnavailable- Exit with error if sandbox can't start
disableDeepLinkRegistration- Prevent claude-cli:// protocol handler
CLAUDE_CODE_ENABLE_AWAY_SUMMARY- Enable auto-recap when resuming after time away
prUrlTemplate- Custom code-review URL template
wslInheritsWindowsSettings- Inherit Windows managed settings in WSL
cleanupPeriodDays- Days before pruning tasks/shell-snapshots/backups
skillOverrides- Control skill invocation: off / user-invocable-only / name-only
worktree.baseRef- fresh | head: branch base for new worktrees
worktree.bgIsolation- Background session worktree behavior (none = direct working copy)
pluginSuggestionMarketplaces- Managed: allowlist org marketplaces for plugin suggestions
forward_user_identity- Apps gateway opt-in: attribute actions to the authenticated user identity
additionalMarketplaces- Friendly alias for pluginSuggestionMarketplaces (add org marketplaces)
allowedMarketplaces- Friendly alias for allowed marketplace settings (restrict which marketplaces Claude can use)
MessageDisplay- Hook event: transform or hide assistant message text during display
EnterWorktree- Hook event: fires when switching between Claude-managed worktrees mid-session
workflowKeywordTrigger- Disable 'ultracode' keyword auto-triggering dynamic workflows (set via /config)
workflowSizeGuideline- Advisory dynamic workflow size target (e.g. 'medium' for fewer than 15 agents); settable from any settings file
reloadSkills: true- SessionStart hook output: load newly-installed skills in same session
requiredMinimumVersion- Managed: minimum Claude Code version required to run
requiredMaximumVersion- Managed: maximum Claude Code version allowed to run
hookSpecificOutput.additionalContext- Stop/SubagentStop hook return: extra feedback fed back to Claude
disableBundledSkills- Hide bundled skills, workflows, and built-in slash commands from model
post-session- Self-hosted runner lifecycle hook: runs after session ends, before workspace deletion
teammateMode: "iterm2"- iTerm2 teammate mode; warns when auto-detection fails
respondToBashCommands: false- Disable auto Claude responses to ! bash commands (preserves context-only behavior)
autoMode.classifyAllShell- Route all Bash/PowerShell commands through auto-mode classifier
disableAutoMode- Disable auto mode on Bedrock/Vertex/Foundry (auto mode is now on by default on these platforms)
vimInsertModeRemaps- Two-key insert-mode sequences (e.g. jj -> Esc)
emojiCompletionEnabled- Disable emoji shortcode autocomplete (set false)
sandbox.filesystem.disabled- Skip filesystem isolation while keeping network egress control
sandbox.network.strictAllowlist- Restrict sandboxed commands to only allowlisted hosts
DirectoryAdded- Hook event: fires after /add-dir registers a new working directory mid-session
UserPromptSubmit- Hook event: fires before each user prompt is submitted
PreCompact- Hook event: fires before conversation compaction
awsAuthRefresh- Helper script for foreground AWS auth (e.g., aws sso login)
awsCredentialExport- Helper script for background AWS credential export (STS-like response)
keybindingFlavor- classic (default) or readline: readline makes Ctrl+W delete back to whitespace
spellcheck- Underline misspelled words in the prompt (needs aspell, hunspell or ispell)
crossSessionInbound- Hold, auto-deliver or refuse cross-session messages
dialogExpiry- Expiry for held cross-session message approval dialogs
subagentStatusLine- Custom status line for agent rows (payload carries model and effort)
remoteControlAtStartup- Enable Remote Control when a session starts
axScreenReader- Screen reader mode with plain-text rendering (settings equivalent of --ax-screen-reader)
selection:clear- Keybinding action: clear the in-app text selection
forceLoginMethod- Enterprise: force a login method for terminal, SDK, VS Code and setup-token
extraKnownMarketplaces- Add marketplaces (additionalMarketplaces is the friendly alias)
strictKnownMarketplaces- Managed: restrict to listed marketplaces; accepts owner/* wildcards
blockedMarketplaces- Managed: block marketplaces; accepts owner/* wildcards
sandbox.ripgrep- Sandbox ripgrep binary; honored from user, managed and --settings only
Environment Variables
ANTHROPIC_API_KEY- API authentication
ANTHROPIC_MODEL- Default model override
CLAUDE_CODE_EFFORT_LEVEL- low / medium / high / max / auto
MAX_THINKING_TOKENS- 0 = thinking off
CLAUDE_STREAM_IDLE_TIMEOUT_MS- Streaming watchdog (default 90s)
CLAUDE_CODE_NO_FLICKER- Alt-screen rendering (=1)
CLAUDE_CODE_CERT_STORE- bundled = use bundled CAs only (default: os)
CLAUDE_CODE_PERFORCE_MODE- Error on read-only files with p4 edit hint
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB- Enable subprocess sandboxing with PID namespace isolation (Linux)
API_TIMEOUT_MS- Custom API request timeout in ms (default 300000)
CLAUDE_CODE_SCRIPT_CAPS- Limit script invocations per session
CLAUDE_CODE_USE_POWERSHELL_TOOL- Enable PowerShell tool (=1; requires pwsh)
MCP_CONNECTION_NONBLOCKING- Skip MCP wait in -p / headless mode (=true)
CLAUDECODE- Detect CC shell (=1)
ENABLE_PROMPT_CACHING_1H- Force 1-hour prompt cache TTL
FORCE_PROMPT_CACHING_5M- Force 5-minute prompt cache TTL
CLAUDE_CODE_HIDE_CWD- Hide working directory in startup logo (=1)
DISABLE_UPDATES- Block all update paths (stricter than DISABLE_AUTOUPDATER)
CLAUDE_CODE_FORK_SUBAGENT- Enable forked subagents on external builds (=1)
CLAUDE_CODE_SESSION_ID- Session ID passed to Bash tool subprocess env
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN- Opt out of fullscreen renderer (=1)
CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE- Auto-upgrade via Homebrew/WinGet
ANTHROPIC_BEDROCK_SERVICE_TIER- Bedrock service tier: default / flex / priority
AWS_BEARER_TOKEN_BEDROCK- Bearer token for Bedrock API authentication
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY- Enable /v1/models gateway discovery (=1)
CLAUDE_PROJECT_DIR- Project directory injected into stdio MCP server environments
MCP_TOOL_TIMEOUT- Per-request timeout for remote HTTP/SSE MCP servers (ms)
CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT- Idle timeout for remote MCP tool calls beyond 5 min (ms)
ANTHROPIC_WORKSPACE_ID- Workload identity federation workspace scoping
CLAUDE_CODE_GIT_BASH_PATH- Custom Git for Windows path override
CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY- Opt out of PowerShell -ExecutionPolicy Bypass (=1)
CLAUDE_CODE_STOP_HOOK_BLOCK_CAP- Override stop hook block limit (default 8)
CLAUDE_CODE_PLUGIN_PREFER_HTTPS- Clone plugins over HTTPS instead of SSH (=1)
CLAUDE_CODE_ENABLE_AUTO_MODE- Enable auto mode on Bedrock/Vertex/Foundry for Opus 4.7/4.8 (=1)
OTEL_LOG_TOOL_DETAILS- Include tool parameters in tool_decision telemetry events (=1)
OTEL_RESOURCE_ATTRIBUTES- Values included as labels on metric datapoints for slicing usage by team or repo
CLAUDE_CODE_TMPDIR- Override directory for temporary files
CLAUDE_CODE_SAFE_MODE- Start with all customizations disabled (=1)
CLAUDE_CODE_DISABLE_BUNDLED_SKILLS- Hide bundled skills, workflows, and built-in slash commands (=1)
API_FORCE_IDLE_TIMEOUT- Set to 0 to opt out of idle timeout on Vertex/Foundry (default 5 min)
CLAUDE_CODE_MAX_RETRIES- Max retry attempts (capped at 15; use CLAUDE_CODE_RETRY_WATCHDOG for unattended sessions)
CLAUDE_CODE_RETRY_WATCHDOG- Enable retry watchdog for unattended/long-running sessions
CLAUDE_CODE_DISABLE_MOUSE_CLICKS- Disable mouse interactions in fullscreen while preserving scroll (=1)
OTEL_LOG_ASSISTANT_RESPONSES- Control redaction of assistant responses in claude_code.assistant_response OTel log events
CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP- Disable automatic memory-pressure reaping for idle background shell commands (=1)
CLAUDE_AX_SCREEN_READER- Enable screen reader mode with plain-text rendering (=1)
CLAUDE_CODE_PROCESS_WRAPPER- Corporate launcher integration wrapper
CLAUDE_CODE_FORWARD_SUBAGENT_TEXT- Include subagent text and thinking in stream-json output (=1)
CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION- Session-wide web search cap (default 200)
CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION- Session-wide subagent spawn cap (default 200; /clear resets budget)
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS- Auto-background MCP calls exceeding this ms threshold (default 120000; 0 to disable)
CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH- Configure OTel content attribute truncation limit (default 60 KB)
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS- Cap concurrently-running subagents (default 20)
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH- Allow nested subagents to spawn their own subagents (default 3)
CLAUDE_CODE_TOOL_MEMORY_LIMIT- Memory cgroup limit for Bash tool on Linux (e.g. 512m)
CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS- WebFetch session URL cache TTL in ms
CLAUDE_CODE_ENABLE_TODO_TOOLS- Restore task-tracking tools on Opus 4.8, Sonnet 5, and newer models (=1)
ANTHROPIC_DEFAULT_MODEL- Model new sessions start on (a /model pick still overrides it)
CLAUDE_CODE_OAUTH_TOKEN- Auth token from claude setup-token, for headless and CI use
CLAUDE_CODE_PROJECT_DIR_NAME- Short name for the per-project transcript directory
CLAUDE_CODE_DISABLE_1M_CONTEXT- Hold every 1M-window model to 200K via auto-compaction
CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT- Stop auto-compact enforcing an assumed window on unknown model IDs (=1)
CLAUDE_CODE_GOAL_CHECKIN_MINUTES- Minutes before /goal checks in on background work (0 to opt out)
CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS- Stagger between sibling workflow agents for prompt-cache reuse (0 disables)
ANTHROPIC_BEDROCK_REGION_PREFIX- Prefer a specific Bedrock cross-region inference profile
Skills and Agents
Built-in Skills
/code-review [--comment|--fix]- Correctness-focused review; runs as background subagent (does not fill conversation); --comment posts inline PR comments; --fix applies findings
/simplify- Cleanup-only review (reuse, simplification, efficiency); applies fixes to working tree
/batch- Large parallel changes (5-30 worktrees)
/debug [desc]- Troubleshoot from debug log
/loop [interval]- Recurring scheduled task
/claude-api- Load API + SDK reference
/ultrareview [PR#|branch|desc]- Cloud code review with parallel agents; accepts PR number, branch name, or description
/less-permission-prompts- Scan transcripts, propose tool allowlist
/dataviz- Chart and dashboard design guidance with color-palette validator
/code-review ultra- Deep multi-agent cloud review (/ultrareview is the old alias)
Custom Skill Locations
.claude/skills/<name>/- Project skills
~/.claude/skills/<name>/- Personal skills
.claude/skills/<name>/bin/- Executables shipped with skill
Skill Frontmatter
description- Auto-invocation trigger
allowed-tools- Skip permission prompts
model- Override model for skill
effort- Override effort level
paths: [globs]- Path-specific activation
context: fork- Run in subagent (background by default)
background: false- Opt out of background for context:fork skills
monitors- Background monitor agents in manifest
initialPrompt- Auto-submit prompt on skill load
disallowedTools- Block specific tools in skill
disable-model-invocation: true- Run skill without LLM call
$ARGUMENTS- User input placeholder
argument-hint- Hint text displayed for slash command argument input
`!`cmd``- Dynamic context injection
Built-in Agents
Explore- Fast read-only (Haiku)
Plan- Research for plan mode
General- Full tools, complex tasks
Bash- Terminal, separate context
Agent Config
permissionMode- default / acceptEdits / plan / dontAsk
isolation: worktree- Run in git worktree
background: true- Background task
maxTurns- Limit agentic turns
SendMessage- Resume agents
@agent-name- Mention named subagents
3 levels deep (default)- Sub-agents can spawn their own sub-agents (depth 3 by default, configurable)
subagent_type: "fork"- Subagent inherits the full conversation and prompt cache (on by default)
ListAgents- List sessions you can message, on this machine and Remote Control
notify_when_idle- SendMessage option: one notice when that session next goes idle
MCP Servers
Add Servers
--transport http- Remote HTTP (recommended)
--transport stdio- Local process
--transport sse- Remote SSE
Scopes
Local- ~/.claude.json (you only)
Project- .mcp.json (shared/VCS)
User- ~/.claude.json (global)
Management
/mcp- Interactive UI
claude mcp list- List all servers
claude mcp serve- CC 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
Elicitation- Servers can request input mid-task
_meta maxResultSizeChars- Override result size up to 500K chars
alwaysLoad- Always load server tools (skip deferred tool search)
claude mcp get <name>- Show one server's config and connection status
headersHelper- Command that mints HTTP headers (e.g. a short-lived token) per request
Permission Modes
manual- Prompts for each action
acceptEdits- Auto-accept file edits
plan- Read-only research
dontAsk- Deny unless pre-allowed
bypassPermissions- Skip all prompts