Claude Code Cheat Sheet 2026: Shortcuts, Commands & Flags
# Fast-lookup Claude Code cheat sheet updated for v2.1.220 — CLI flags, slash commands, keyboard shortcuts, permission modes (Manual rename), models (Opus 5, Sonnet 5 default), hooks, plugins, Agent View, Workflow, and env vars.
Every CLI flag, slash command, keyboard shortcut, config key, hook event, and environment variable in one place. For deep explanations, see the full Claude Code guide. For first-time setup, see the quickstart.
1. Installation
Three installation methods, in order of preference.
# Native binary (recommended)
curl -fsSL https://claude.ai/install.sh | bash
# Homebrew (macOS)
brew install --cask claude-code
# NPM (deprecated — migrate with `claude install`)
npm install -g @anthropic-ai/claude-code
Install a specific version:
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58
Verify installation:
claude doctor
claude --version
Authenticate:
claude auth login # Log in or switch accounts
claude auth status # Check current auth state
claude auth logout # Clear stored credentials
2. CLI Flags
| Flag | Description | Example |
|---|---|---|
-p |
Print mode — single query, then exit | claude -p "list TODOs" |
-c |
Continue most recent session | claude -c |
-r, --resume |
Resume a named or numbered session | claude -r "auth-refactor" |
-n, --name |
Set session display name at startup | claude -n "feature-x" |
--model |
Override model for this session | claude --model opus |
--max-turns |
Limit autonomous turns | claude -p "fix lint" --max-turns 10 |
--output-format |
Output as text, json, or stream-json |
claude -p "count files" --output-format json |
--allowedTools |
Restrict available tools | claude -p "fix" --allowedTools "Edit,Bash(npm:*)" |
--permission-mode |
Set permission mode | claude --permission-mode auto |
--permission-mode auto |
Start with Auto Mode enabled (replaced --enable-auto-mode, removed v2.1.111) |
claude --permission-mode auto |
--dangerously-skip-permissions |
YOLO mode — skip all prompts | claude --dangerously-skip-permissions |
--from-pr |
Start session linked to a PR (v2.1.27+); accepts GitHub, GHE, GitLab MR, Bitbucket PR URLs (v2.1.119+) | claude --from-pr 123 |
--fork-session |
Fork from a resumed session | claude -r base --fork-session |
-w |
Start in isolated git worktree | claude -w |
--bare |
Scripted mode — skip hooks, LSP, plugins | claude -p "count files" --bare |
--plugin-url <url> |
Fetch a plugin .zip archive for the current session (v2.1.129+) |
claude --plugin-url https://example.com/plugin.zip |
--plugin-dir <path> |
Load plugin directory or .zip archive for the current session (.zip support v2.1.128+) |
claude --plugin-dir ./my-plugin.zip |
--channels |
Relay approval prompts to Telegram/Discord | claude --channels |
--forward-subagent-text |
Include subagent text + thinking in stream-json output (v2.1.211+); env: CLAUDE_CODE_FORWARD_SUBAGENT_TEXT=1 |
claude -p "audit" --output-format stream-json --forward-subagent-text |
--ax-screen-reader |
Enable screen reader mode (v2.1.208+); also CLAUDE_AX_SCREEN_READER=1 or "axScreenReader": true |
claude --ax-screen-reader |
--debug |
Enable debug logging | claude --debug |
--init |
Initialize project with CLAUDE.md | claude --init |
Subcommand added in v2.1.212: claude auto-mode reset resets your auto-mode state from the terminal; pass --yes to skip the confirmation prompt.7
3. Slash Commands
| Command | What It Does |
|---|---|
/init |
Initialize project with CLAUDE.md |
/compact |
Condense conversation history. Add focus: /compact focus on tests |
/context |
View context window usage with actionable suggestions |
/usage |
Token usage, cost, plan usage; merged dialog (v2.1.118+: /cost and /stats are typing shortcuts that open /usage tabs); v2.1.149+ adds per-category limits usage for skills, subagents, plugins, and per-MCP-server cost |
/cost |
Typing shortcut → opens /usage cost tab (v2.1.118+) |
/model |
Change model. /model opus, /model sonnet |
/fast |
Toggle fast output mode — Opus 5 / Opus 4.8 only (v2.1.219 removed Opus 4.7); ~2.5× output speed at $10/$50 per MTok |
/effort |
Set effort level: low, medium, high |
/status |
View session state, model, settings |
/permissions |
Manage permission settings interactively |
/config |
Open full settings interface |
/mcp |
Configure MCP servers. /mcp enable, /mcp disable |
/hooks |
View hook configuration |
/memory |
View and manage auto-memory files |
/copy |
Copy code blocks. /copy N for Nth-latest response |
/resume |
Resume named session. /resume 1 or /resume name |
/rename |
Name current session. /rename feature-auth |
/branch |
Branch conversation for parallel exploration |
/fork |
Copy the conversation into a new background session — own row in claude agents (repurposed v2.1.212); the copy gets its own worktree as of v2.1.221 |
/subtask |
In-session fork — the old /fork behavior under its new name (v2.1.212) |
/list-agents |
List every agent Claude can message: subagents, your other local sessions, and (with Remote Control) sessions on other machines (v2.1.224) |
/peers |
Alias of /list-agents (v2.1.224) |
/clear |
Clear conversation history |
/plan |
Enter plan mode. /plan refactor the auth module |
/powerup |
Interactive feature lessons with animated demos (v2.1.90+) |
/voice |
Toggle push-to-talk voice mode |
/loop |
Recurring tasks. /loop 5m /foo runs every 5 min |
/rewind |
Return to checkpoint (or press Esc twice) |
/export |
Export conversation transcript |
/add-dir |
Add working directories to expand file access |
/agents |
Manage subagents |
/goal |
Set a completion condition; Claude continues until the target is met (v2.1.139+) |
/skills |
List installed skills; type-to-filter search box (v2.1.121+) |
/bashes |
List background bash tasks |
/tasks |
List background agents |
/theme |
Manage named themes (v2.1.118+); plugins ship a themes/ directory |
/color |
Set prompt-bar color. /color default to reset |
/code-review [effort] |
Find correctness bugs at optional effort level; --comment posts inline GitHub PR comments (renamed from /simplify in v2.1.147). Runs as a background subagent as of v2.1.218. As of v2.1.223, /review is an alias of this command, bare /code-review reuses the last effort level you typed, and /code-review ultra is the deep cloud review |
/batch |
Batch operations |
/security-review |
Review code for vulnerabilities |
/claude-api |
Build apps with Claude API/Anthropic SDK |
/doctor |
Full setup checkup — diagnoses and fixes issues (v2.1.205; /checkup is an alias) |
/bug |
Report a bug to Anthropic |
/release-notes |
Interactive version picker with changelogs (v2.1.92+) |
/buddy |
Terminal companion pet — 18 species, 5 rarity tiers, deterministic from account ID |
/login / /logout |
Authenticate or sign out in session |
Custom commands: Create .claude/commands/my-command.md (project) or ~/.claude/commands/my-command.md (personal) and invoke with /my-command. Commands support YAML frontmatter for description, allowed tools, model override, and argument interpolation via $ARGUMENTS or positional $1, $2.
---
description: Fix a GitHub issue
allowed-tools: Read, Edit, Bash(git:*)
model: opus
argument-hint: [issue-number]
---
Fix GitHub issue #$ARGUMENTS following our coding standards.
Usage: /fix-issue 123
4. Keyboard Shortcuts
General Controls
| Shortcut | Action |
|---|---|
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit session (EOF) |
Ctrl+L |
Clear screen (keeps history) |
Ctrl+O |
Toggle verbose output |
Ctrl+R |
Search command history |
Ctrl+V |
Paste image from clipboard |
Ctrl+B |
Background current operation |
Ctrl+X Ctrl+K |
Stop all agents (changed from Ctrl+F in v2.1.83) |
Ctrl+S |
Stash prompt draft |
Ctrl+G |
Open external editor |
Esc Esc |
Rewind last change |
Tab |
Accept prompt suggestion |
! Tab |
Bash history autocomplete |
Shift+Tab |
Cycle permission modes |
Alt+P / Option+P |
Switch models while typing |
Alt+T |
Toggle thinking mode |
Ctrl+T |
Toggle syntax highlighting |
Shift+Down |
Cycle agent team teammates |
Up/Down |
Navigate command history |
v |
Vim visual mode — character selection (v2.1.118+; vim mode only) |
V |
Vim visual-line mode (v2.1.118+; vim mode only) |
? |
Show shortcuts |
Quick Prefixes
| Prefix | Action | Example |
|---|---|---|
# |
Add to persistent memory | # Always use TypeScript |
/ |
Slash command | /review |
! |
Execute bash directly | ! git status |
@ |
Reference a file | @src/index.ts |
& |
Send task to cloud | & Build the API |
Multiline Input
| Method | Keys |
|---|---|
| Escape newline | \ then Enter |
| macOS | Option+Enter |
| iTerm2/WezTerm/Ghostty/Kitty | Shift+Enter |
| Other terminals | Shift+Enter (run /terminal-setup first) |
| Control character | Ctrl+J |
Keybindings are customizable via /keybindings (stored in ~/.claude/keybindings.json).
5. Configuration Files
Precedence Hierarchy (highest to lowest)
| Level | Location | Scope |
|---|---|---|
| Enterprise (locked) | /Library/Application Support/ClaudeCode/managed-settings.json (macOS) |
All users, cannot override |
| CLI flags | Command-line arguments | Current session |
| Local project | .claude/settings.local.json |
Personal, current project (gitignored) |
| Shared project | .claude/settings.json |
Team, checked into git |
| User global | ~/.claude/settings.json |
All your projects |
| Runtime state | ~/.claude.json |
OAuth tokens, MCP config |
First match wins. Enterprise settings cannot be bypassed.
6. Settings.json Reference
Key settings with types and examples. Place in any settings file from the hierarchy above.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"model": "claude-sonnet-4-6",
"permissions": {
"allow": ["Read", "Glob", "Grep", "Bash(npm run:*)", "Bash(git:*)", "Edit(src/**)"],
"deny": ["Read(.env*)", "Bash(rm -rf:*)", "Bash(sudo:*)"],
"ask": ["WebFetch", "Bash(docker:*)"],
"defaultMode": "acceptEdits",
"additionalDirectories": ["../shared-lib"]
},
"env": {
"NODE_ENV": "development"
},
"hooks": {},
"sandbox": {
"enabled": false,
"autoAllowBashIfSandboxed": true
},
"includeCoAuthoredBy": true,
"cleanupPeriodDays": 30,
"respectGitignore": true,
"showTurnDuration": true,
"language": "en",
"autoMemoryDirectory": ".claude/memory",
"plansDirectory": ".claude/plans"
}
Permission rule syntax: Tool(pattern:*) provides prefix matching. Bash(npm run test:*) allows npm run test, npm run test:unit, etc. File patterns use glob syntax: Edit(src/**). As of v2.1.214, a single-segment dir/** allow rule matches only <cwd>/dir — no longer any dir/ anywhere in the tree; write Edit(**/src/**) for any-depth matching. deny/ask rules keep any-depth matching, and hook if: conditions get the same cwd scoping.
New keys (v2.1.118+):
| Key | Behavior |
|---|---|
autoMode.allow $defaults |
Sentinel that adds custom rules alongside the built-in list (also for soft_deny, environment) — v2.1.118+ |
prUrlTemplate |
Footer PR badge URL template — v2.1.119+ |
wslInheritsWindowsSettings |
WSL inherits Windows-side managed settings — v2.1.118+ |
skillOverrides |
Hide or collapse skills: off, user-invocable-only, or name-only — v2.1.129+ |
allowAllClaudeAiMcps |
Enterprise managed setting to load claude.ai cloud MCP connectors alongside managed-mcp.json — v2.1.149+ |
sandbox.filesystem.disabled |
Skip filesystem isolation while keeping network egress control — v2.1.216+ |
emojiCompletionEnabled |
Emoji shortcode autocomplete in the prompt input (:heart: → ❤️); set false to disable — v2.1.217+ |
sandbox.network.strictAllowlist |
Deny non-allowlisted hosts for sandboxed commands without prompting — v2.1.219+ |
workflowSizeGuideline |
Set the advisory Dynamic workflow size guideline from any settings file; default is medium (“aim for fewer than 15 agents”), and the /config row hides while one is set — v2.1.219+ |
For the complete settings schema, see the Configuration Deep Dive in the full guide.
7. CLAUDE.md Quick Reference
CLAUDE.md is your project’s instruction file. Claude reads it at the start of every session.
Where it lives:
| Location | Scope |
|---|---|
CLAUDE.md (project root) |
All users, all sessions in this project |
.claude/CLAUDE.md |
Same, alternative location |
~/.claude/CLAUDE.md |
Personal, all projects |
What to include:
# Project Name
## Stack
- Backend: FastAPI, Python 3.11+
- Frontend: HTMX + Alpine.js + Bootstrap 5
## Commands
- Dev: `uvicorn app.main:app --reload --port 8000`
- Test: `python -m pytest -v`
- Lint: `ruff check .`
## Conventions
- Conventional commits: feat:, fix:, docs:, refactor:
- Never force push to main
- Always activate venv before Python commands
## Key Files
- app/main.py — FastAPI app and routes
- app/models.py — SQLAlchemy models
Keep it scannable. Dense prose wastes context tokens every session. Use bullet points, tables, and short code blocks. Avoid long paragraphs — Claude reads CLAUDE.md at the start of every session, so every word costs context.
Pro tips:
- Use # prefix in the REPL to add things to auto-memory without editing CLAUDE.md: # Always use TypeScript strict mode
- CLAUDE.md in subdirectories is loaded when Claude reads files in that directory
- Team-shared rules go in .claude/rules/*.md for modular organization
8. Permission Modes
| Mode | Behavior | Use Case |
|---|---|---|
default / manual — labeled “Manual” (v2.1.200+) |
Prompts on first use of each tool | Normal development |
acceptEdits |
Auto-approves file edits, prompts for bash | Trusted projects |
auto |
Classifier (Sonnet 5 as of v2.1.210, originally Sonnet 4.6) reviews each action for safety | Autonomous with safeguards |
plan |
Read-only — no edits or execution allowed | Analysis and planning only |
bypassPermissions |
Skips all prompts | CI/CD automation |
Auto Mode (v2.1.85+) is the recommended replacement for --dangerously-skip-permissions. Read-only and file edits are auto-approved. Custom allow/deny rules resolve first. Everything else goes to the safety classifier. Auto-blocked by default: curl | bash, force-push to main, production deploys, mass cloud deletions, IAM changes, sending sensitive data externally.1
Circuit breaker: 3 consecutive blocks or 20 total in a session pauses back to manual prompting.
# Enable at startup (--enable-auto-mode was removed in v2.1.111)
claude --permission-mode auto
# Cycle during session
Shift+Tab # Manual (aka default) -> acceptEdits -> auto -> plan
PowerShell auto-approval (v2.1.119+): PowerShell tool commands auto-approve in permission mode the same way Bash commands do. Allow rules like PowerShell(Get-*:*) bypass prompts for read-only operations. Use v2.1.149+ on PowerShell-heavy workflows; it fixes built-in cd permission bypasses, prefix/wildcard allow-rule matching, and stale directory variable tracking.
9. Hook Events
| Event | When It Fires | Can Block? |
|---|---|---|
PreToolUse |
Before tool executes | Yes |
PostToolUse |
After tool completes | No |
PostToolUseFailure |
After tool fails | No |
UserPromptSubmit |
User sends a prompt | Yes |
Stop |
Claude finishes response | Yes |
SubagentStart |
Subagent spawns | No |
SubagentStop |
Subagent completes | Yes |
SessionStart |
Session begins | No |
SessionEnd |
Session closes | No |
Notification |
Alert triggered | No |
| InstructionsLoaded | CLAUDE.md loaded | No |
| ConfigChange | Config file changes mid-session | Yes |
| DirectoryAdded | /add-dir or SDK register_repo_root adds a working directory mid-session (v2.1.219+) | No |
| WorktreeCreate | Worktree being created | Yes |
| WorktreeRemove | Worktree being removed | No |
| PreCompact | Before context compaction | No |
| PostCompact | After context compaction | No |
| Elicitation | MCP requests structured input | Yes |
| ElicitationResult | User responds to MCP dialog | Yes |
| StopFailure | Turn ends due to API error | No |
| PermissionRequest | Permission dialog shown | Yes |
| PermissionDenied | Auto mode denies an action (v2.1.88+) | No |
| CwdChanged | Working directory changes (v2.1.83+) | No |
| FileChanged | Watched file modified externally (v2.1.83+) | No |
| TaskCreated | New task created (v2.1.84+) | No |
| TeammateIdle | Agent team member idles | Yes |
| TaskCompleted | Task marked complete | Yes |
For the full hook protocol (input/output JSON, matchers, exit codes), see Hooks Deep Dive in the full guide.
10. Hook Configuration
Hooks live in settings.json or a dedicated hooks.json. Minimal example:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "npx prettier --write \"$FILE_PATH\""
}
]
}
],
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": ".claude/hooks/validate-bash.sh"
}
]
}
]
}
}
Matcher syntax:
| Pattern | Matches |
|---|---|
* |
All tools |
Bash |
Bash only |
Edit\|Write |
Edit or Write |
mcp__github |
MCP server tools |
"" (empty) |
Events without tools (e.g., UserPromptSubmit) |
Exit codes:
| Code | Meaning |
|---|---|
0 |
Success — operation proceeds |
2 |
Block — operation stops, stderr fed to Claude |
1, 3+ |
Non-blocking warning |
Async hooks run in the background without blocking: add "async": true to the hook object.2
Hook output / input fields:
duration_msonPostToolUse/PostToolUseFailurehook input (v2.1.119+) — tool execution time excluding permission prompts and PreToolUse hooks.hookSpecificOutput.updatedToolOutput(v2.1.121+) — replace tool output for any tool (v2.1.118 introduced this for MCP only; v2.1.121 extends to all tools).hookSpecificOutput.sessionTitle(v2.1.96+) — set session title from aUserPromptSubmithook.args: string[]on command hooks (v2.1.139+) — pass structured argv without shell quoting.continueOnBlockonPostToolUsehooks (v2.1.139+) — feed the block reason back to Claude and continue the turn.subagent_typeon agent hook input (v2.1.140+) — identify which agent type is running.terminalSequencein hook JSON output (v2.1.141+) — emit terminal-control sequences for notifications, window titles, and bells.
11. MCP Quick Setup
Add an MCP server in one command:
# Remote HTTP server (recommended)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
# Remote with auth header
claude mcp add --transport http api https://api.example.com/mcp \
--header "Authorization: Bearer $TOKEN"
# Local stdio server
claude mcp add --transport stdio postgres \
--env "DATABASE_URL=postgresql://user:pass@localhost/db" \
-- npx -y @anthropic-ai/mcp-server-postgres
Scope control:
claude mcp add --scope project ... # Team-shared (.mcp.json)
claude mcp add --scope user ... # Personal (~/.claude.json)
Project .mcp.json example:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/"
},
"database": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost/db"
}
}
}
}
MCP now has 100 million monthly downloads and 3,000+ indexed servers.3 For transport types, elicitation, and tool search configuration, see the MCP section in the full guide.
alwaysLoad (v2.1.121+): Opt a trusted server out of Tool Search deferral. All its tools load at session start, no ToolSearch round-trip:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"alwaysLoad": true
}
}
}
Auto-retry (v2.1.121+): MCP servers that error during startup are retried up to 3 times before being marked disconnected.
SDK mcp_authenticate redirectUri (v2.1.121+): Required for completing OAuth on custom URI schemes — desktop apps and claude.ai connector flows.
11.5. Plugin CLI Commands
| Command | Behavior |
|---|---|
claude --plugin-url <url> |
Fetch a plugin .zip archive for the current session (v2.1.129+) |
claude --plugin-dir <path> |
Load plugin directory or .zip archive for the current session (.zip support v2.1.128+) |
claude plugin prune |
Remove auto-installed plugins whose parent is no longer present (v2.1.121+) |
claude plugin uninstall <name> --prune |
Uninstall and cascade-remove orphaned auto-installed dependencies (v2.1.121+) |
claude plugin tag |
Create release git tags with version validation (v2.1.118+) |
12. Subagent Types
| Type | Default Model | Mode | Use For |
|---|---|---|---|
| Explore | Inherits session model, capped at Opus (v2.1.198+; was Haiku) | Read-only | Codebase search, finding files, understanding structure |
| General-purpose | Inherits main | Full read/write | Complex research + modification tasks |
| Plan | Inherits main | Read-only | Planning implementations before execution |
| Custom | Configurable | Configurable | Domain-specific work (security review, testing, etc.) |
Claude automatically delegates to subagents. You can also request them explicitly:
> Use the explore agent to find all auth-related files
> Have a subagent analyze the database schema
Custom subagents are defined in .claude/agents/ (project) or ~/.claude/agents/ (personal) as markdown files with YAML frontmatter. Up to 10 subagents can run in parallel.4
claude agents opens Agent View in current releases: a research-preview operations screen for running, blocked, and completed Claude Code sessions. claude agents --cwd <path> scopes the view to one directory (v2.1.141+), v2.1.142 adds dispatch flags for background sessions, and v2.1.143 applies those flags consistently to the dashboard and background sessions: --add-dir, --settings, --mcp-config, --plugin-dir, --permission-mode, --model, --effort, and --dangerously-skip-permissions. v2.1.144 adds /resume support for background sessions and marks them with bg; v2.1.145 adds claude agents --json, awaiting-input tab counts, and Agent View reply-pane fixes; v2.1.147 adds pinned background sessions that stay alive when idle and restart in place for updates. Use Agent View for monitoring, not as proof that the work passed quality gates.6
Custom agent frontmatter fields:
| Field | Purpose |
|---|---|
name |
Unique identifier (lowercase, hyphens) |
description |
When to invoke (include “PROACTIVELY” for auto-delegation) |
tools |
Comma-separated tool list. Supports Agent(Explore) to restrict spawnable types |
disallowedTools |
Tools to deny from inherited set |
model |
opus, sonnet, haiku, or inherit (default) |
permissionMode |
default/manual, acceptEdits, plan, bypassPermissions, etc. |
maxTurns |
Maximum agentic turns |
background |
true to always run as background task |
isolation |
worktree for isolated git worktree copy |
Example custom agent (.claude/agents/security-reviewer.md):
---
name: security-reviewer
description: Expert security code reviewer. Use PROACTIVELY after code changes to auth or data handling.
tools: Read, Grep, Glob, Bash
model: opus
permissionMode: plan
---
You are a senior security engineer. Analyze for OWASP Top 10 vulnerabilities,
secrets, hardcoded credentials, and SQL injection. Report findings with severity
levels and remediation steps.
13. Environment Variables
Authentication and API
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY |
Direct API authentication |
ANTHROPIC_AUTH_TOKEN |
Custom authorization header |
ANTHROPIC_CUSTOM_HEADERS |
Additional request headers |
Model Configuration
| Variable | Purpose |
|---|---|
ANTHROPIC_MODEL |
Override default model |
CLAUDE_CODE_SUBAGENT_MODEL |
Model for subagents; v2.1.147 fixes propagation to agent-team teammate processes |
CLAUDE_CODE_WORKFLOWS |
Set 1 to enable the off-by-default Workflow tool for deterministic multi-agent orchestration (v2.1.147+) |
MAX_THINKING_TOKENS |
Enable extended thinking |
CLAUDE_CODE_MAX_OUTPUT_TOKENS |
Limit output length |
Cloud Providers
| Variable | Purpose |
|---|---|
CLAUDE_CODE_USE_BEDROCK=1 |
Use AWS Bedrock |
CLAUDE_CODE_USE_VERTEX=1 |
Use Google Vertex AI |
CLAUDE_CODE_USE_FOUNDRY=1 |
Use Microsoft Foundry |
ANTHROPIC_BEDROCK_SERVICE_TIER=priority |
Bedrock service tier — default/flex/priority (v2.1.122+); sent as X-Amzn-Bedrock-Service-Tier |
ENABLE_TOOL_SEARCH=true |
Opt in to Tool Search on Vertex AI (v2.1.119+; off by default to avoid unsupported beta header) |
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 |
Opt in gateway /v1/models discovery for the /model picker (v2.1.129+) |
Behavior Control
| Variable | Purpose |
|---|---|
DISABLE_AUTOUPDATER=1 |
Prevent automatic updates |
DISABLE_UPDATES=1 |
Block all update paths including manual claude update (v2.1.118+, stricter than DISABLE_AUTOUPDATER) |
CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 |
Homebrew/WinGet installs run package-manager upgrades in the background and prompt restart (v2.1.129+) |
CLAUDE_CODE_PLUGIN_PREFER_HTTPS=1 |
Clone GitHub plugin sources over HTTPS instead of SSH when SSH keys are unavailable (v2.1.141+) |
CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE |
Removed — no-op since v2.1.160. Fast mode is now /model <model> then /fast on |
CLAUDE_CODE_STOP_HOOK_BLOCK_CAP |
Override the v2.1.143+ cap that ends a turn with a warning after repeated blocking stop hooks |
CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY=1 |
Opt out of the v2.1.143+ PowerShell -ExecutionPolicy Bypass behavior |
CLAUDE_CODE_USE_POWERSHELL_TOOL=0 |
Disable the PowerShell tool where v2.1.143 enables it by default for Bedrock, Vertex, and Foundry users |
DISABLE_TELEMETRY=1 |
Opt out of usage telemetry |
CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH |
Truncation limit for OTel content attributes (default 60 KB, v2.1.214+) |
DISABLE_COST_WARNINGS=1 |
Hide cost warnings |
DISABLE_PROMPT_CACHING=1 |
Disable prompt caching globally |
CLAUDE_CODE_DISABLE_1M_CONTEXT=1 |
Hold every native-1M model to 200K via auto-compaction (v2.1.223 widened it beyond a fixed list) |
CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1 |
Let unrecognized model IDs exceed the assumed context window (v2.1.223) |
CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 |
Remove built-in commit/PR instructions |
CLAUDE_CODE_HIDE_CWD=1 |
Hide working directory in startup logo (v2.1.119+) |
CLAUDE_CODE_FORK_SUBAGENT=1 |
Forked subagents on external builds (v2.1.117+; works in non-interactive -p mode v2.1.121+) |
CLAUDE_CODE_FORCE_SYNC_OUTPUT=1 |
Force synchronized terminal output when auto-detection misses it (v2.1.129+) |
CLAUDE_CODE_FORWARD_SUBAGENT_TEXT=1 |
Include subagent text + thinking in stream-json output; pairs with --forward-subagent-text (v2.1.211+) |
CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION |
Per-session WebSearch cap (default 200, v2.1.212+) |
CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION |
Per-session subagent-spawn cap (default 200; /clear resets the budget, v2.1.212+) |
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS |
Cap on concurrently-running subagents (default 20; distinct from the per-session total above, v2.1.217+) |
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH |
Nested subagent spawn depth — default 3 as of v2.1.219; set 1 to disable nesting. Default history: 5 (v2.1.172–v2.1.216) → 1 (v2.1.217) → 3 (v2.1.219), so set it explicitly |
CLAUDE_AX_SCREEN_READER=1 |
Enable screen reader mode; same as --ax-screen-reader (v2.1.208+) |
Tool Configuration
| Variable | Purpose |
|---|---|
BASH_DEFAULT_TIMEOUT_MS |
Bash command timeout (default 30000) |
BASH_MAX_TIMEOUT_MS |
Maximum bash timeout (default 600000) |
MCP_TIMEOUT |
MCP server startup timeout (default 5000) |
MCP_TOOL_TIMEOUT |
MCP tool execution timeout (default 30000); v2.1.142 fixes remote HTTP/SSE calls ignoring higher values |
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS |
Threshold before a long MCP tool call auto-moves to the background (default 2 min, v2.1.212+) |
Network and Proxy
| Variable | Purpose |
|---|---|
HTTP_PROXY / HTTPS_PROXY |
Proxy configuration |
NO_PROXY |
Bypass proxy for specific domains |
CLAUDE_CODE_CLIENT_CERT |
mTLS certificate path |
ANTHROPIC_WORKSPACE_ID |
Scope workload-identity-federated tokens when a rule spans multiple workspaces (v2.1.141+) |
For the complete list, see Environment Variables in the full guide.
14. Cost Reference
Pricing per 1 million tokens (as of July 2026).5
| Model | Input | Output | Notes |
|---|---|---|---|
| Sonnet 5 | $3.00 ($2 intro) | $15.00 ($10 intro) | Claude Code’s default model since v2.1.197 (June 30, 2026). Native 1M context; intro pricing through Aug 31, 2026. /model sonnet (claude-sonnet-5). |
| Opus 5 | $5.00 | $25.00 | The Opus tier since v2.1.219 (July 24, 2026) — model ID claude-opus-5, 1M context / 128K output, thinking on by default, effort defaults to high, knowledge cutoff May 2026. Default on Claude Max. /model opus. |
| Opus 4.8 (legacy) | $5.00 | $25.00 | Same price, now in the docs’ Legacy models table; the CC default v2.1.154–v2.1.197. Pin with ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-8. |
| Fable 5 | $10.00 | $50.00 | Tier above Opus (v2.1.170+); model ID claude-fable-5, 1M context / 128K output, adaptive thinking only. /model fable. |
| Haiku 4.5 | $1.00 | $5.00 | Fast exploration, simple tasks. |
A typical session consumes 50K-200K input tokens and 10K-50K output tokens. Haiku session: $0.10-$0.45. Opus session: $0.50-$2.25.
Default model in Claude Code (as of v2.1.197, June 30, 2026): Sonnet 5 for all new sessions — native 1M context, $2/$10 introductory pricing through Aug 31 — with Opus one /model opus away (as of v2.1.219 that alias lands on Opus 5). Admins can set an org-wide default, shown as “Org default” in /model (v2.1.196+); on Bedrock/Vertex/Foundry, pin a specific model via ANTHROPIC_DEFAULT_OPUS_MODEL / ANTHROPIC_DEFAULT_SONNET_MODEL.
Sonnet 5, Opus 5, Opus 4.8, and Fable 5 use adaptive reasoning only (no fixed thinking budgets). effort defaults to high on all of them, with /effort xhigh for the hardest coding/agentic work. Opus 5 breaking changes vs Opus 4.8: thinking is on by default for requests that omit the thinking field, and thinking: {type: "disabled"} with effort xhigh or max returns a 400.
Fast mode (/fast) applies to Opus 5 and Opus 4.8 only as of v2.1.219 — $10 / $50 per MTok (2× base) for up to 2.5× output tokens per second. Opus 4.7 was removed: claude-opus-4-7 + speed: "fast" now errors instead of falling back to standard speed. Research preview, Claude API only (not Bedrock/Vertex/Foundry); switching speeds invalidates the prompt cache.
Switch models during a session:
/model opus # Switch to Opus 5 (v2.1.219+)
/model sonnet # Switch to Sonnet 5 (the default)
/model haiku # Switch to Haiku 4.5
/model fable # Switch to Fable 5 (tier above Opus)
/effort xhigh # Recommended for the hardest coding/agentic work
Decision rule: Simple exploration goes to Haiku. Cost-sensitive daily coding goes to Sonnet. Hard reasoning, architecture, agentic loops, and security analysis go to Opus. Use opusplan for complex refactoring (Opus plans, Sonnet executes).
15. Key File Locations
| Path | Purpose |
|---|---|
~/.claude/settings.json |
User-global settings |
~/.claude/keybindings.json |
Custom keyboard shortcuts |
~/.claude/CLAUDE.md |
Personal instructions (all projects) |
~/.claude/commands/ |
Personal slash commands |
~/.claude/skills/ |
Personal skills |
~/.claude/agents/ |
Personal subagent definitions |
~/.claude.json |
Runtime state, OAuth tokens, MCP config |
.claude/settings.json |
Project settings (shared via git) |
.claude/settings.local.json |
Project settings (personal, gitignored) |
.claude/CLAUDE.md |
Project instructions |
.claude/commands/ |
Project slash commands |
.claude/agents/ |
Project subagent definitions |
.claude/skills/ |
Project skills |
.claude/plans/ |
Plan mode output files |
.claude/memory/ |
Auto-memory files |
.mcp.json |
Project MCP server config |
CLAUDE.md |
Project instructions (root alternative) |
16. Changelog
| Date | Change |
|---|---|
| 2026-08-10 | Carried-defect repair from the main guide’s holistic audit: the auto-mode classifier row still said Sonnet 4.6 — corrected to Sonnet 5 as of v2.1.210 (originally Sonnet 4.6). |
| 2026-08-06 | Targeted sync of v2.1.221–v2.1.223 command-surface items. /review is an alias of /code-review again (v2.1.223) with last-typed effort-level memory; /fork copies get their own worktree (v2.1.221); VSCode adds Focus view (Ctrl+Alt+F, v2.1.221); CLAUDE_CODE_DISABLE_1M_CONTEXT now holds every native-1M model to 200K via auto-compaction, with CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT as the unknown-model escape hatch (v2.1.223); strictKnownMarketplaces/blockedMarketplaces accept "owner/*" org wildcards (v2.1.223). |
| 2026-07-25 | Targeted sync of v2.1.219–v2.1.220 items. Models: Claude Opus 5 (claude-opus-5) replaces Opus 4.8 as the Opus tier and what /model opus selects — same $5/$25 per MTok, 1M context / 128K output, thinking on by default, effort defaults to high, knowledge cutoff May 2026, default model on Claude Max; Opus 4.8 kept as a legacy row. Breaking vs 4.8: requests with no thinking field now think, and thinking: {type: "disabled"} + effort xhigh/max returns a 400. Fast mode corrected: /fast covers Opus 5 and Opus 4.8 only at $10/$50 per MTok (2× base, ~2.5× output speed) — Opus 4.7 was removed and now errors on speed: "fast" instead of falling back. Env vars: CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH corrected — nested subagent spawning is on by default at depth 3 as of v2.1.219 (was off in v2.1.217); set 1 to disable. Settings keys: added sandbox.network.strictAllowlist (deny non-allowlisted hosts without prompting) and workflowSizeGuideline (advisory Dynamic workflow size, default medium / fewer than 15 agents). Hook events: added DirectoryAdded (fires after /add-dir or the SDK register_repo_root registers a working directory mid-session). v2.1.220 is bug fixes and reliability improvements only. |
| 2026-07-24 | Targeted sync of v2.1.218 items. Command surface: /code-review now runs as a background subagent, so review work no longer fills your conversation. Also in v2.1.218: skills with context: fork run in the background by default (per-skill opt-out via the new background: false frontmatter key), /deep-research starts only when invoked manually, the auto-mode classifier adjudicates the dangerous-rm/background-&/suspicious-Windows-path checks instead of opening permission dialogs, and agent frontmatter hooks require the agent file’s folder to have accepted workspace trust. |
| 2026-07-22 | Targeted sync of v2.1.217 items. Env vars: added CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS (concurrently-running subagent cap, default 20) and CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH (nested subagent spawning is off by default as of v2.1.217 — set this to re-enable; v2.1.172–v2.1.216 allowed 5 levels). Settings keys: added emojiCompletionEnabled (emoji shortcode autocomplete in the prompt input, :heart: → ❤️; false disables). Also in v2.1.217: --max-budget-usd now halts background subagents once the cap is reached. |
| 2026-07-21 | Targeted sync of v2.1.214–v2.1.216 items (v2.1.213 was never released). Permission rule syntax: single-segment dir/** allow rules now match only <cwd>/dir (v2.1.214) — **/dir/** for any-depth; deny/ask rules keep any-depth matching; hook if: conditions get the same cwd scoping. Settings keys: added sandbox.filesystem.disabled (skip filesystem isolation, keep network egress control, v2.1.216+). Env vars: added CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH (OTel content-truncation limit, default 60 KB, v2.1.214+). |
| 2026-07-17 | Synced through Claude Code v2.1.212. Command surface: /fork repurposed — copies the conversation into a new background session with its own claude agents row; the in-session fork is now /subtask; new claude auto-mode reset subcommand (--yes skips confirmation); new flags --forward-subagent-text (v2.1.211) and --ax-screen-reader (v2.1.208). Env vars added: CLAUDE_CODE_FORWARD_SUBAGENT_TEXT, CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION / CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION (200/session defaults, v2.1.212), CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS (MCP calls >2 min auto-background), CLAUDE_AX_SCREEN_READER.7 |
| 2026-07-07 | Synced through Claude Code v2.1.202. Permission mode default → “Manual” (v2.1.200; manual accepted as an alias). Model table rebuilt to the current lineup — Sonnet 5 (Claude Code’s default since v2.1.197), Opus 4.8, Fable 5, Haiku 4.5 — replacing the stale Opus 4.7-flagship / Sonnet 4.6 rows; default-routing and /effort notes updated. Explore subagent now inherits the session model (capped at Opus, v2.1.198), was Haiku. Removed stale entries: --enable-auto-mode (removed v2.1.111 → use --permission-mode auto) and CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE (no-op since v2.1.160). |
| 2026-05-24 | Synced latest-line evidence through Claude Code v2.1.150. Added /usage per-category limits usage, /diff keyboard scrolling note via changelog, GFM task-list checkbox rendering note via changelog, Enterprise allowAllClaudeAiMcps, PowerShell permission fix guidance, and Bash/git-worktree/managed-settings/OTEL/Remote Control reliability notes. v2.1.150 itself has no announced user-facing changes. Local verification: local claude --version returned 2.1.144 (Claude Code) while npm latest was 2.1.150.6 |
| 2026-05-21 | Synced latest-line evidence through Claude Code v2.1.147. Added the off-by-default Workflow tool (CLAUDE_CODE_WORKFLOWS=1), pinned Agent View background sessions, /code-review [effort] --comment replacing /simplify, hardened REPL/Workflow sandboxes, auto-updater and large-diff improvements, duplicate prompt-history suppression, enterprise-login, PowerShell, MCP pagination, Agent View, plugin, hook-condition, and pasted-text fixes. Local verification: local claude --version returned 2.1.144 (Claude Code) while npm latest was 2.1.147.6 |
| 2026-05-19 | Synced latest-line evidence through Claude Code v2.1.145. Added claude agents --json, Agent View awaiting-input tab counts, status-line GitHub repo/PR JSON fields, richer pre-install plugin discovery, Stop/SubagentStop background_tasks and session_crons hook input, OTEL agent_id/parent_agent_id, and permission, MCP, spinner, Windows, Agent View, task-list, plugin validation, skill recursion, and Read tool fixes. Local verification: local claude --version returned 2.1.144 (Claude Code) while npm latest was 2.1.145.6 |
| 2026-05-19 | Synced latest-line evidence through Claude Code v2.1.144. Added /resume support for background sessions, /model current-session/default behavior, /usage-credits, plugin last-updated display, background-subagent duration notifications, and terminal/background-session reliability fixes. Local verification: claude --version returned 2.1.144 (Claude Code) and npm latest was 2.1.144.6 |
| 2026-05-18 | Synced latest-line evidence through Claude Code v2.1.143. Added Agent View dispatch consistency, stop-hook block cap, PowerShell policy env vars, and noted plugin dependency enforcement, projected plugin context cost, worktree.bgIsolation: "none", background-session model/effort preservation, and /goal evaluator timing fixes. Local verification: claude --version returned 2.1.142 (Claude Code) while npm latest was 2.1.143.6 |
| 2026-05-15 | Synced latest-line evidence through Claude Code v2.1.142. Added terminalSequence, claude agents --cwd, v2.1.142 background-session dispatch flags, Fast-mode Opus 4.7 default override, HTTPS plugin clone env var, workload-identity workspace env var, and the MCP_TOOL_TIMEOUT remote HTTP/SSE fix note. Local verification: claude --version returned 2.1.141 (Claude Code) while npm latest was 2.1.142.6 |
| 2026-05-13 | Synced latest-line evidence through Claude Code v2.1.140. Added /goal, Agent View note, command-hook args, PostToolUse continueOnBlock, and subagent_type on agent hook input. Noted that v2.1.140 fixes ConfigChange, disableAllHooks, and allowManagedHooksOnly behavior. Local verification: claude --version returned 2.1.140 (Claude Code).6 |
| 2026-05-06 | Synced latest-line evidence through Claude Code v2.1.131. No command, config, shortcut, hook, plugin, or env-var table changes were needed because v2.1.131 is a fix release for VS Code Windows activation and Mantle endpoint authentication.6 |
| 2026-05-05 | Synced to CC guide v2.36 (CLI v2.1.126–v2.1.129). Added: --plugin-url for plugin zip loading, .zip support for --plugin-dir, skillOverrides, CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY, CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE, CLAUDE_CODE_FORCE_SYNC_OUTPUT, and v2.1.129 plugin manifest guidance for experimental themes/monitors. Coverage through v2.1.129.6 |
| 2026-04-29 | Synced to CC guide v2.35 (CLI v2.1.117–v2.1.123). Added: alwaysLoad MCP option + startup auto-retry; claude plugin prune and --prune cascade; claude plugin tag; /skills type-to-filter; /theme named themes; /usage merged dialog; vim visual modes (v/V); PowerShell auto-approval; duration_ms on hook input + updatedToolOutput for all tools; prUrlTemplate, wslInheritsWindowsSettings, autoMode.allow $defaults; env vars ANTHROPIC_BEDROCK_SERVICE_TIER, ENABLE_TOOL_SEARCH, CLAUDE_CODE_HIDE_CWD, DISABLE_UPDATES, CLAUDE_CODE_FORK_SUBAGENT; --from-pr accepts GitLab/Bitbucket/GHE PR URLs. Coverage through v2.1.123. |
| 2026-04-19 | Refresh: Sonnet 4.6 1M context now shown at standard $3/$15 (no long-context premium); switched pricing footnote to platform.claude.com/docs/en/about-claude/pricing. Coverage through v2.1.116. |
| 2026-04-04 | Re-derived from CC guide v2.26. Added /powerup, updated /release-notes, removed /vim. Updated Ctrl+X Ctrl+K shortcut. Added 4 hook events (CwdChanged, FileChanged, TaskCreated, PermissionDenied). Updated /cost with per-model breakdown. Coverage through v2.1.92. |
| 2026-03-28 | Initial release of cheat sheet, covering Claude Code CLI through v2.1.85 |
17. References
This cheat sheet is the quick-lookup companion to the full Claude Code CLI guide. For setup walkthroughs, see the Claude Code quickstart. For iOS and macOS projects specifically, see the iOS Agent Development guide, the XcodeBuildMCP integration patterns, and the Apple Ecosystem Series. Last updated July 17, 2026.
-
Claude Code v2.1.129 release notes, Claude Code v2.1.131 release notes, Claude Code v2.1.139 release notes, Claude Code v2.1.140 release notes, Claude Code v2.1.141 release notes, Claude Code v2.1.142 release notes, Claude Code v2.1.143 release notes, Claude Code v2.1.144 release notes, Claude Code v2.1.145 release notes, Claude Code v2.1.147 release notes, Claude Code v2.1.148 release notes, Claude Code v2.1.149 release notes, Claude Code v2.1.150 release notes, Claude Code Agent View docs, Claude Code Goal docs, and Claude Code CHANGELOG ↩↩↩↩↩↩↩↩↩↩
-
Claude Code v2.1.206 release notes, v2.1.207, v2.1.208, v2.1.210, v2.1.211, v2.1.212, and the Claude Code accessibility docs. July 2026. ↩↩