Claude Code Cheat Sheet 2026: Commands, Flags, Shortcuts
# Fast-lookup Claude Code cheat sheet updated for v2.1.150 — CLI flags, slash commands, keyboard shortcuts, hooks, plugins, Agent View, /goal, 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-fsSLhttps://claude.ai/install.sh|bash
# Homebrew (macOS)
brewinstall--caskclaude-code
# NPM (deprecated — migrate with `claude install`)
npminstall-g@anthropic-ai/claude-code
Install a specific version:
curl-fsSLhttps://claude.ai/install.sh|bash-s1.0.58
Verify installation:
claudedoctor
claude--version
Authenticate:
claudeauthlogin# Log in or switch accounts
claudeauthstatus# Check current auth state
claudeauthlogout# 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 |
--enable-auto-mode |
Start with Auto Mode enabled | claude --enable-auto-mode |
--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 |
--debug |
Enable debug logging | claude --debug |
--init |
Initialize project with CLAUDE.md | claude --init |
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 |
/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 |
/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) |
/batch |
Batch operations |
/security-review |
Review code for vulnerabilities |
/claude-api |
Build apps with Claude API/Anthropic SDK |
/doctor |
Check installation health |
/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/**).
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+ |
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 |
Prompts on first use of each tool | Normal development |
acceptEdits |
Auto-approves file edits, prompts for bash | Trusted projects |
auto |
Classifier (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
claude--enable-auto-mode
# Cycle during session
Shift+Tab# 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 |
| 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)
claudemcpadd--transporthttpgithubhttps://api.githubcopilot.com/mcp/
# Remote with auth header
claudemcpadd--transporthttpapihttps://api.example.com/mcp\
--header"Authorization: Bearer $TOKEN"
# Local stdio server
claudemcpadd--transportstdiopostgres\
--env"DATABASE_URL=postgresql://user:pass@localhost/db"\
--npx-y@anthropic-ai/mcp-server-postgres
Scope control:
claudemcpadd--scopeproject...# Team-shared (.mcp.json)
claudemcpadd--scopeuser...# 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 | Haiku (fast) | 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, 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=1 |
Keep Fast mode on Opus 4.6 instead of the v2.1.142+ Opus 4.7 default |
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 |
DISABLE_COST_WARNINGS=1 |
Hide cost warnings |
DISABLE_PROMPT_CACHING=1 |
Disable prompt caching globally |
CLAUDE_CODE_DISABLE_1M_CONTEXT=1 |
Use standard 200K instead of 1M |
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+) |
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 |
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 April 2026).5
| Model | Input | Output | Notes |
|---|---|---|---|
| Opus 4.7 | $5.00 | $25.00 | Current flagship. 1M context at standard pricing — no long-context premium. |
| Opus 4.6 (legacy) | $5.00 | $25.00 | 1M context now also at standard pricing |
| Sonnet 4.6 | $3.00 | $15.00 | Balanced model. 1M context at standard pricing — no long-context premium. |
| Haiku 4.5 | $1.00 | $5.00 | 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 by plan (Claude Code as of April 16, 2026):
- Max, Team Premium → Opus 4.7
- Pro, Team Standard, Enterprise, Anthropic API → Sonnet 4.6 (Enterprise + API switch to Opus 4.7 on April 23, 2026)
- Bedrock, Vertex, Foundry → Sonnet 4.5 (pin newer via
ANTHROPIC_DEFAULT_OPUS_MODEL)
Opus 4.7 requires Claude Code v2.1.111 or later. It uses adaptive reasoning only (no fixed thinking budgets). New xhigh effort level is the default for coding/agentic workloads on Opus 4.7.
Switch models during a session:
/modelopus#SwitchtoOpus(resolvesto4.7onAPI,4.6onBedrock/Vertex/Foundry)
/modelsonnet#SwitchtoSonnet4.6
/modelhaiku#SwitchtoHaiku4.5
/effortxhigh#Opus4.7only—recommendedforcoding/agentic
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-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 May 24, 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 ↩↩↩↩↩↩↩↩↩↩
