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 purge- Delete all Claude Code state for a path (the old name claude project purge still works)
claude agents- View all sessions: running, blocked, or completed
claude agents: n:<text>- Filter the agents view by session name or task; Enter opens the best match
claude agents: Ctrl+F / Alt+↑↓- Find a session by name / jump between groups (rebindable in keybindings.json)
claude --desktop- Open the Claude desktop app on this directory (or a session with --continue / --resume <id>)
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> [--json]- Disable plugin with optional JSON output (refuses if another enabled plugin depends on it)
claude plugin enable <name> [--json]- Force-enable plugin and transitive dependencies, with optional JSON output
claude plugin init <name>- Scaffold a new plugin in .claude/skills
claude plugin list [--enabled|--disabled] [--json]- List plugins with optional filter; JSON rows include errorDetails and noteDetails
claude plugin install <name> [--json]- Install a plugin with optional JSON output
claude plugin uninstall <name> [--json]- Uninstall a plugin with optional JSON output
claude plugin update <name> [--json]- Update a plugin with optional JSON output
claude plugin eval- Run a plugin eval suite and produce scored JSON and HTML reports
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 [--json]- Check a plugin or marketplace manifest before publishing; --json returns a machine-readable report
claude plugin enable <name>@synced- Manage a plugin synced from claude.ai (never overrides a same-named plugin you installed)
claude doctor- Complete setup checkup, including organization policy load errors
claude self-hosted-runner --client-label <label>- Override the label the runner registers with (default: hostname)
claude self-hosted-runner --kill-session-after-min <min>- Release a session that is waiting for its user after the time limit
claude self-hosted-runner --remove-session-state- Delete each self-hosted session directory when the session ends
claude self-hosted-runner --drain-marker-file <path>- Report a SIGTERM exit as a host drain when that file exists (telemetry only)
claude self-hosted-runner --host-config-snapshot disk|memory- Choose how host config is carried into a session when the host config directory is large
claude plugin configure <plugin> [--values-stdin]- Show a plugin's options and which are unset, or save new values read from stdin
claude plugin install <name> --config <server>.<key>=<value>- Set a bundled .mcpb MCP server's own settings at install time
claude plugin install <name> --accept-command <sha256>- Accept exactly the command a previous --json run displayed, instead of -y (also on claude plugin update)
claude plugin install <name> --marketplace <source>- Add the marketplace if needed, then install the plugin from it
claude auth status --json- Show authentication status and the active configDirectory
claude attach <id|name>- Attach to a running background session (part of a session name works)
claude logs <id|name>- Show a background session's output (part of a session name works)
claude stop <id>- Stop a running background session
claude respawn <id>- Restart a stopped background session
claude rm <id>- Delete a background session
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, only MCP servers named on the command line, no background tasks
--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
--system-prompt-snapshot off- Render the system prompt fresh on every request
--append-system-prompt <text>- Append text to system prompt (interactive and print modes)
--append-subagent-system-prompt-file <path>- Append a file to the subagent system prompt
--mcp-config <file>- Load extra MCP servers for this session
--settings <file>- Load an extra settings file (trusted source for sandbox keys)
--agents <json|file>- Add subagents from inline JSON or, with -p, a JSON file path (exits with an error on invalid JSON)
--plugin-dir <dir>- Load one plugin or each child plugin in a local directory for this session
--restricted- Remove the tools that run commands or code, and WebFetch; keep file tools inside the working directory; refuse bypassPermissions; ignore user, project and local settings
--permission-prompts none- Deny actions that require a prompt on unattended headless hosts
Keyboard Shortcuts
Controls
Ctrl+C- Cancel input or generation
Ctrl+D- Exit session
Ctrl+Z- Suspend Claude Code (resume with fg)
Ctrl+L / Cmd+K- Redraw the screen (the 2.1.260 transcript clear in fullscreen was reverted)
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 back to whitespace
Ctrl+X Ctrl+S- Send now: move running tools to the background and send all queued messages at once (Ctrl+Enter does the same)
Ctrl+X Ctrl+K- Stop all background agents
confirm:yes / confirm:no- Keybinding actions: bind y/n to them to answer dialogs by letter again (Enter and Esc by default)
Alt+F- Move to the end of the next word
Alt+D- Delete to the end of the next word
Ctrl+K- Delete to end of line
Ctrl+Enter- Agent view: dispatch and attach (Shift+Enter inserts a newline)
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 a bash command outside the sandbox, including in strict sandbox mode
@- File mention + autocomplete
:word:- Emoji shortcode autocomplete (e.g. :heart: → ❤️)
Ctrl+S- Narrow history search to current project/session
↑ (empty prompt)- Bring back a draft cleared with Ctrl+C, including pasted text and images
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); shows a Spend limit bar behind a Claude apps gateway
/rename [name]- Name session
/branch [name]- Branch conversation
/cost- Token usage plus prompt-cache metrics and the likely cause of each cache miss
/context- Visualize context usage
/diff- Toggle the fullscreen side panel for uncommitted changes
/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); the window is saved per model
Configuration
/config- Open settings (fullscreen panel takes the mouse wheel and a click on a value)
/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)
/output-style [name]- List or switch output styles, including in remote and headless sessions
/color- Set prompt-bar color for session ID
/permissions- View and update permissions (Auto mode tab edits auto-mode classifier rules)
/effort [level]- Set effort level (saved per model, so each model keeps its own)
/effort ultracode [on|off]- Toggle Ultracode at any effort level (Tab in the /effort slider)
/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
/logout- Sign out of the current account
/desktop- Offer to download the Claude desktop app
Tools
/init- Create CLAUDE.md
/memory- Edit CLAUDE.md files
/mcp- Manage MCP servers
/hooks- Manage hooks
/skills- List available skills
/skill-doctor- Show unused loaded skills and their context costs
/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)
/plugin install <name> --marketplace <src>- Offer to add the marketplace, then install the plugin from it
/reload-plugins- Reload plugins without restarting; also available in headless command lists
Claude Mods- Plugins that modify deeper behavior: panes, bands and hooks inside Claude Code
/plugin enable cc-plugin-you-should-know@builtin- Turn on You should know: a side agent flags things you or Claude might miss
/web-setup- Connect GitHub for Claude Code on the web (Pro/Max); /status shows the connection state
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, organization policy load errors and an Auto mode server row saying where the classifier runs
/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
/doctor prompt-audit- Audit CLAUDE.md, skills, agents and commands for prompting patterns written for older models
/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 [model|off]- Set or disable the advisor in desktop, Remote Control and headless sessions
/rate-limit-options- See your options when you hit a usage limit (claude.ai subscribers)
/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
/insights- Session insights from your history
/list-agents- List subagents, other sessions and live teammates you can message
SendFeedback- Tool: Claude drafts a feedback report when something goes wrong, for you to review and send from /feedback
/radio- Open Claude FM lo-fi radio in your browser; prints the stream URL when no browser is available
Memory and Files
CLAUDE.md Locations
./CLAUDE.md- Project (team-shared)
./AGENTS.md- Read instead when the project has no CLAUDE.md; switch it under Project instructions in /config (not on Bedrock, Vertex or Foundry)
~/.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
.worktreeinclude- Patterns for extra files to copy into a new worktree
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)
Opus 5.5- claude-opus-5-5, the default Opus model: 1M context
Sonnet 5.5- claude-sonnet-5-5, the default Sonnet model on the Anthropic API: 1M context
CLAUDE.md- Survives compaction
Sonnet 5 auto-compact- Defaults to the full 1M window: about 967K tokens, not about 934K
Background
Background Bash commands- Stop at their timeout (default 30 min, max 2 h) only in unattended sessions (-p, SDK, CI, cloud); Claude is notified
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
VS Code
Build a custom style- Create and list a custom output style from the Output styles menu
Attach Open File- Turn off to stop the open file being added to messages; selected text is still attached
Copy response- Button on each response; the typed /copy command does the same
Sign out- Panel menu row; the typed /logout command does the same
Agent map tasks- Background shells and other running tasks each get a Stop; typed /tasks opens the map
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
managed-settings.json- Managed org settings file (/status lists sources it skipped)
~/.claude/history.jsonl- Prompt history read by Ctrl+R search
Notable Settings
modelOverrides- Map model picker to custom IDs
bashEditDiffEnabled- Include a diff when Bash edits files
gatewayInternalNetworks- Managed: allow gateway login from organization public IPv4 blocks
gateway.yaml pricing:- Send managed model rates to signed-in gateway clients for /cost and telemetry
gateway.yaml headers:- Static headers sent to a proxy you run in front of a gateway upstream
syncClaudeAiSkills- Set false to stop syncing the skills enabled on your claude.ai account into terminal sessions
syncClaudeAiPlugins- Set false to stop syncing the plugins enabled on your claude.ai account into terminal sessions
maxEffortLevel- Cap the effort level globally or per model in modelSettings
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
bashOutputMaxChars- Raise inline command output up to 128K characters
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 ('medium' is fewer than 10 agents; Pro plans default to 'small'); 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)
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
modelPicker- Curate the /model picker with an ordered, labeled model list (appends to or replaces the built-in lineup)
promptCacheTtl- Prompt cache TTL for the main conversation (API key and cloud provider users; 1 hour)
subagentPromptCacheTtl- Prompt cache TTL for subagents (5 minutes by default)
managedMcpServers- Managed HTTP or SSE MCP servers supplied to every user
allowedMcpServers- Allow only matching user-added MCP servers; managed servers are not filtered
deniedMcpServers- Block matching MCP servers, including managed servers
oidc.scope_on_refresh- Ask for openid again when the Claude apps gateway refreshes OIDC credentials
desktop.userPluginMarketplacesEnabled- Claude apps gateway policy for user plugin marketplaces in Claude Desktop
desktop.userPluginUploadsEnabled- Claude apps gateway policy for user plugin uploads in Claude Desktop
modelPricing- Managed: use contracted per-model rates for /cost, the status line and telemetry
claudeMdExcludes- Patterns for CLAUDE.md and rules files to skip
voice.enabled- Enable voice dictation without running /voice
metadata.pluginRoot- Marketplace manifest: directory bare plugin source names resolve under
PreToolUse- Hook event: fires before a tool runs (can defer the tool call)
Setup- Hook event: repository setup and maintenance, run via --init, --init-only or --maintenance
selection:copy- Keybinding action: copy the in-app text selection
feedbackDrafts- Turn off the SendFeedback tool's drafted feedback reports
spinnerTipsOverride- Rotate your own spinner tips: {id, text, cooldownSessions, priority} entries plus label
tipsFile- spinnerTipsOverride: file of org tips rotated alongside the built-in ones
PreModelSwitch- Hook event: block, confirm or annotate a model switch
PostModelSwitch- Hook event: fires after a model switch
desktopSessionCleanupPeriodDays- Cap the transcript-cleanup exemption that keeps Claude Desktop and Cowork sessions
rate_limits.spend_limit- Status line field: the spend limit for a Claude apps gateway account
prompt_cache- Status line object: cache metrics and the likely cause of each miss
allowed_domains- Per-command host allowlist for Bash, PowerShell and Monitor in auto mode with sandboxing; other hosts are refused
modelPricing multiplier- Managed setting and gateway pricing block: mark rates up, from 1 to 10, for internal chargeback
maxProseWidth- Cap the width of Claude's prose in wide terminals; tables and code blocks keep the full width
"attribution": false- Hide all commit and PR attribution (older CLI versions skip a file that holds it; keep the object form in shared files)
allowClaudeInChromeWithManagedMcp- Managed setting: let claude --chrome run alongside an exclusive managed-mcp.json
deniedModels- Managed setting: block specific models, even when availableModels allows them
availableModelsMatch: "exact"- Managed setting: an availableModels entry allows only the version it names, so new releases stay blocked until listed
allowedProviders- Managed setting: limit which API providers a machine may use (Anthropic API, Bedrock, Vertex AI, Foundry, a gateway ...)
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_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS- Gateway /v1/models discovery timeout in ms (default 3000)
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, plus agent, skill, plugin and MCP server names on cost and token metrics (=1)
OTEL_METRICS_INCLUDE_REPOSITORY- Add vcs.* repository attributes to OpenTelemetry metrics and 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 (project .claude/settings.json env no longer sets it)
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_AX_PREPARK_MS- Restore the screen reader pause before each changed line (e.g. =50)
CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS- Turn off structured outputs for gateways that reject them (session titles, memory recall, prompt hooks)
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_WEB_SEARCH_REFILLS_PER_HOUR- Interactive WebSearch budget refill rate (default 100 calls/hour; 0 turns refills off)
CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS- Longer base backoff delay when retrying overloaded (529) requests
MCP_PROTOCOL_NEGOTIATION=legacy- Opt stdio MCP servers out of the 2026-07-28 protocol negotiation
CLAUDE_CODE_DISABLE_WEB_FETCH- Turn off the WebFetch tool (=1)
CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES- Cap re-sends of a timed-out non-streaming fallback request
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_WEBFETCH_DEADLINE_MS- WebFetch deadline in ms (default 300000; 0 disables)
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)
CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS- Workflow per-run concurrent agent limit (1-256)
ANTHROPIC_BEDROCK_REGION_PREFIX- Prefer a specific Bedrock cross-region inference profile
ANTHROPIC_AUTH_TOKEN- Bearer token used directly against the Anthropic API or an LLM gateway
CLAUDE_CODE_RESTRICTED- Restricted mode (=1); the env-var form of --restricted
SELF_HOSTED_RUNNER_CLIENT_LABEL- Label the self-hosted runner registers with (default: hostname)
CLAUDE_CODE_SUBAGENT_MODEL- Default subagent model; an agent definition's model: and an explicit per-spawn model take precedence
ANTHROPIC_CUSTOM_HEADERS- Extra HTTP headers; from managed or project settings, credential, org, routing and API-behavior headers need approval
CLAUDE_CONFIG_DIR- Override the Claude Code config directory (project .claude/settings.json env no longer sets it)
CLAUDE_CODE_GATEWAY_HINT_HEADERS- Send the request-class, agent-type, prev-tool-durations, context-compacted and prompt-id hint headers to LLM gateways (=1)
CLAUDE_CODE_AUTO_MODE_SERVER- Server-side auto-mode classifier, now the default, also on a direct API connection; 0 opts out, 1 opts in
CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH- Change the 2,048-character cap on MCP tool descriptions and server instructions
CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT- Turn off the 2-minute auto-deny on the dangerous rm prompt in auto and skip-permissions mode (=1)
CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT- Stop the prompt on a recursive rm whose target is only command substitution, like rm -rf "$(pwd)" (=1)
CLAUDE_GATEWAY_PROXY_IS_EGRESS_BOUNDARY- Claude apps gateway: hand every outbound hostname to the forward proxy instead of resolving it locally (=1)
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
/code-review --max-findings <n>|all- Report more or fewer findings; the choice is reused until --max-findings default
/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, including Admin API (members, invites, workspaces, API keys, rate limit reports, CMEK)
/ultrareview [--post] [PR#|branch|desc]- Cloud code review with parallel agents; --post adds the findings to the PR and prints the comment link
/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)
/claude-api upgrade- Migrate a Python project from anthropic 0.x to 1.x
/claude-api cost-optimize- Profile a project's Claude API spend and work through cost levers (caching, token hygiene, batch, effort, model choice) one measured change at a time
/claude-api managed-agents-onboard <url|quickstart>- Set up a Managed Agents pattern from a page or Console quickstart (e.g. deep-researcher) as ant apply files
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
effort (Agent tool)- Ask Claude to run a sub-agent at a given effort level
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
experimental.cacheTtl- Agent frontmatter: per-agent prompt cache TTL ("5m" or "1h") when no subagent TTL setting is configured
anthropic-skills:<name>- Name for skills synced from claude.ai in cloud sessions (bare name works if unique)
omitClaudeMd- Agent frontmatter and --agents JSON: run the subagent without user, project and local CLAUDE.md files (managed policy files still load)
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
/mcp reconnect all- Retry every MCP server that failed to connect or needs auth
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- true always loads server tools; false defers all of them behind tool search
bareElicitationCapability- Set true in an MCP config entry if a server stops connecting after URL prompts (2025-11-25 protocol)
claude mcp get <name>- Show one server's config and connection status
VS Code MCP dialog- Add and remove MCP servers without leaving the IDE
headersHelper- Command that mints HTTP headers (e.g. a short-lived token) per request
Permission Modes
Modes
manual- Prompts for each action
acceptEdits- Auto-accept file edits
plan- Read-only research
dontAsk- Deny unless pre-allowed
bypassPermissions- Skip all prompts