Skip to content

Claude Code Cheatsheet

Last updated:

Daily reference. For compact printable editions, use the English and French cheatsheets.

Author: Florian BRUNIAUX | Founding Engineer @Méthode Aristote

Written with: Claude (Anthropic)

Version: 3.44.1 | Last Updated: Sep 24, 2026


These are selected daily commands. Availability depends on your version, provider, and plan: the complete list is in §10.1 of the guide, and the always-current official reference is code.claude.com/docs/en/commands.

CommandAction
/helpContextual help
/powerupInteractive animated lessons teaching Claude Code features
/clearReset conversation
/compactFree up context
/statusSession state + context usage
/contextDetailed token breakdown
/planEnter Plan Mode (no changes). Exit by approving the plan or Shift+Tab
/modelSelect model and save the default; press s in the picker for this session only
/autocompact [auto|500k]Choose the auto-compaction window or restore the model default
/output-style [style]Select Default, Proactive, Concise, Explanatory, Learning, or a custom style
/insightsUsage analytics + optimization report
/code-review [level]Review the diff for correctness bugs, --fix applies them, ultra runs it in the cloud
/simplifyCleanup-only review of changed code: reuse, simplification, efficiency (applies cleanup fixes; use /code-review for correctness bugs)
/security-reviewScan the branch diff for injection, auth, and data-exposure risks
/batchLarge-scale refactors via 5–30 parallel worktree agents
/subtask <task>Hand a side task to a forked subagent that reports back here (v2.1.212+)
/teleportTeleport session from web
/tasksMonitor background tasks
/remote-envConfigure cloud environment
/remote-control (/rc)Connect this local session to web/mobile; Team/Enterprise require owner enablement
/mobileGet Claude mobile app download links
/fastToggle faster Opus output; Opus 5.5 costs $8/$40 per MTok in fast mode
/voiceToggle voice input (hold Space to speak, release to send)
/recapSession context summary on return to a break (v2.1.108)
/effort [level]Thinking depth: low/medium/high/xhigh/max/ultracode; no arg = interactive slider (v2.1.111)
/tui [fullscreen]Full-screen flicker-free TUI rendering (v2.1.110)
/focusToggle minimal focus view, separate from Ctrl+O (v2.1.110)
/fewer-permission-promptsScan transcripts and propose a read-only tool allowlist (shipped as /less-permission-prompts in v2.1.111)
/btw [question]Side question overlay: read-only ephemeral agent, no history pollution, no tools
/loop [interval] [prompt]Repeat on a fixed interval, or let Claude choose the interval when omitted; recurring tasks expire after 7 days (see scheduling reference)
/usage (/cost, /stats)Token + cost usage per model, plan limits, activity graph (merged in v2.1.118)
/ultrareviewMulti-agent cloud code review, now an alias of /code-review ultra (v2.1.114)
/goal [condition]Autonomous multi-turn mode: Claude works until condition is met, live overlay shows elapsed/turns/tokens (v2.1.139)
/scroll-speedTune mouse wheel scroll speed with interactive live-preview slider (v2.1.139)
/rename [name]Name or rename the current session
/copyInteractive picker to copy a code block or full response
/doctorFull setup checkup: install, settings, hooks, CLAUDE.md bloat, unused skills (v2.1.205+)
/debugSystematic troubleshooting
/exitQuit (or Ctrl+D)

ShortcutAction
Shift+TabCycle permission modes
Esc × 2Rewind (undo)
Ctrl+CInterrupt
Ctrl+RSearch command history
Ctrl+LClear screen (keeps context)
TabAutocomplete
Shift+EnterNew line
Ctrl+BBackground tasks
Ctrl+X Ctrl+KStop running background subagents
Ctrl+Enter / Ctrl+X Ctrl+SSend queued messages now, interrupting the current turn
Option+T / Alt+TToggle thinking where supported; no effect on Opus 5.5 or Fable
Space (hold)Voice input (requires /voice enabled)
Ctrl+DExit

@path/to/file.ts → Reference a file
@agent-name → Call an agent
@session-name → Message another live Claude session (v2.1.232+)
!shell-command → Run shell command
IDEShortcut
VS CodeAlt+K
JetBrainsCmd+Option+K

FeatureSinceWhat It Does
Tasks APIv2.1.16Persistent task lists with dependencies; opt in on newer models with CLAUDE_CODE_ENABLE_TODO_TOOLS=1
Background Agentsv2.0.60Sub-agents work while you code. Since v2.1.232 forking is the default: a subagent_type: "fork" agent inherits the full conversation and prompt cache, and non-teammate spawns go background on their own
Agent Teamsv2.1.32Multi-agent coordination (TeamCreate/SendMessage)
Cross-Session Messagingv2.1.224Sessions message each other across all your machines. ListAgents to discover, SendMessage to talk, @name to mention (v2.1.232). macOS, Linux, Windows (v2.1.234+). Full guide →
Self-Hosted Environmentsv2.1.224claude self-hosted-runner makes your own machine or container the place web, mobile, and desktop sessions execute. Team and Enterprise
Auto-Memoriesv2.1.32Automatic cross-session context capture
Session Forkingv2.1.19Rewind + create parallel timeline
LSP Toolv2.0.74IDE-like navigation: symbols, types, refs. ~50ms vs 45s with grep. 11 languages
Voice Modev2.1.xNative voice input, free transcription, no rate limit impact
Remote Controlv2.1.51Control a local session from phone/browser; subscription required, with owner enablement on Team/Enterprise
/loopv2.1.71Session-scoped recurring scheduler: /loop 5m check the deploy (stops when session ends). Min 1 min, max 50 tasks/session
/goalv2.1.139Autonomous completion loop: set a condition, Claude works across turns until a separate evaluator (Haiku by default on the Claude API) judges the surfaced evidence. Live overlay shows elapsed time, turns, and tokens. Three-element formula: measurable end state + verification mechanism + constraints.
Cloud Scheduled Tasks2026Machine-off scheduling via /schedule or claude.ai/code/scheduled. Runs on Anthropic infra, clones repo fresh each run, min 1h interval. Pro/Max/Team/Enterprise
Desktop Scheduled Tasks2026Local machine scheduling via Desktop app. Min 1 min, full local file access, no session required
Skill EvalsMar 2026Two skill types: Capability Uplift (fills model gap, fades) / Encoded Preference (encodes workflow, stays). Benchmark Mode, A/B testing, Trigger Tuning.
Output Stylesv2.1.269 command/output-style selects Default, Proactive, Concise, Explanatory, Learning, or a custom style. Coding-oriented custom styles need keep-coding-instructions: true.

Activate LSP: Add to ~/.claude/settings.json → { "env": { "ENABLE_LSP_TOOL": "1" } } (requires LSP server installed for your language: tsserver, pylsp, gopls, rust-analyzer, sourcekit-lsp…)

Pro tip: These are public, documented in the CHANGELOG. Read it!


ModeEditingExecution
Manual (default)Permission rules applyPermission rules apply
acceptEditsAutoAsks
Plan ModeNo file changesRead-only exploration tools allowed
autoClassifier decidesClassifier decides
dontAskOnly if in allow rulesOnly if in allow rules
bypassPermissionsAutoAuto (CI/CD only)

Shift+Tab to switch modes


LevelmacOS/LinuxWindowsScopeGit
Project.claude/.claude\Team✅
Personal~/.claude/%USERPROFILE%\.claude\You (all projects)❌

Priority: Project overrides Personal

FileWhereUsage
CLAUDE.mdProject rootTeam memory (instructions)
settings.json.claude/Team settings (hooks)
settings.local.json.claude/Your setting overrides
CLAUDE.md~/.claude/ (Win: %USERPROFILE%\.claude\)Personal memory

.claude/
├── CLAUDE.md # Local memory (gitignored)
├── settings.json # Hooks (committed)
├── settings.local.json # Permissions (not committed)
├── agents/ # Custom agents
├── hooks/ # Event scripts
├── rules/ # Auto-loaded rules
└── skills/ # Slash commands + knowledge modules (unified)

1. Start session → claude
2. Check context → /status
3. Plan Mode → Shift+Tab × 2 (for complex tasks)
4. Describe task → Clear, specific prompt
5. Review changes → Always read the diff!
6. Accept/Reject → y/n
7. Verify → Run tests
8. Commit → When task complete
9. /compact → When context >70%

Model: Sonnet | Ctx: 89.5k | Cost: $2.11 | Ctx(u): 56.0%

Watch Ctx(u): → >70% = /compact, >85% = /clear

Enhanced statusline (ccstatusline): Add to ~/.claude/settings.json:

{ "statusLine": { "type": "command", "command": "npx -y ccstatusline@latest", "padding": 0 } }
Context %StatusAction
0-50%GreenWork freely
50-70%YellowBe selective
70-90%Orange/compact now
90%+Red/clear required
SignAction
Short responses/compact
Frequent forgetting/clear
>70% context/compact
Task complete/clear
CommandUsage
/compactSummarize and free context
/clearFresh start
/rewindUndo recent changes
claude -cResume last session (CLI flag)
claude -r <id>Resume specific session (CLI flag)

ConceptKey Point
Master LoopModel/tool loop; permissions and auto-mode review are separate controls
ToolsBash, Read, Edit, Write, Grep, Glob, Agent and more (tool reference)
ContextModel-dependent: native 1M on current Opus, Sonnet and Fable; 200K on Haiku 4.5. Inspect /context
Sub-agentsIsolated context, max depth=1
Philosophy”Less scaffolding, more model” (trust Claude’s reasoning)

Deep dive: Architecture & Internals


LayerOwnsStart here
ModelReasoning and tool-call proposalsGlossary
Runtime harnessTool loop, permissions, and recoveryAgent Harness Engineering
Repository harnessInstructions, task state, and verificationRepository Harness Engineering
OrchestratorCoordination between runtimes or sessionsAgent Tools

Choose the smallest control structure that safely solves the need: a bounded loop for one repeated task; an explicit graph for routing, joins, parallelism, interruption, or durable recovery; a repository harness for repeatable project behavior; and an orchestrator for several runs or queues. Specify success, failure, timeout, budget, and escalation before execution. See Loop & Graph Engineering and compare products in the Agent Harness Map.

Evaluate the exact model-harness pair for a bounded coding task. Introduce orchestration only when coordination is the constraint. A harness optimizer sits outside the four operating layers and changes candidate harnesses under a separate evaluation protocol.


FeatureActivationUsage
Plan ModeShift+Tab × 2 or /planExplore without modifying
OpusPlan/model opusplanOpus for planning, Sonnet for execution

Verified September 24, 2026: Opus 5.5 defaults to medium; Sonnet 5 and Fable 5.1 default to high. Haiku 4.5 has no effort parameter. ultrathink adds a reasoning instruction for the turn without changing API effort.

ControlActionPersistence
Option+T / Alt+TToggle thinking on supported models; Opus 5.5 and Fable always thinkSession
/effort or /model sliderChoose a supported level; Enter saves per model, s applies oncePer model or session
/effort maxHighest supported effortSession
CLAUDE_CODE_EFFORT_LEVELOverride effort in the launching environmentProcess environment
modelSettings / effortLevelPersist low, medium, high, or xhigh; not maxSettings
effort in skill frontmatterOverride effort while the skill runsInvocation

Cost tip: try a lower supported effort for bounded tasks, then verify the result. On Opus 5.5, changing effort is the control; disabling thinking has no effect.

Per-skill effort: add effort: low to mechanical skills (commit, sync, scaffold) and effort: high to analytical ones (security-audit, architecture-review). Overrides session setting automatically.

OpusPlan workflow: /model opusplan → Shift+Tab × 2 (plan with Opus) → Shift+Tab (execute with Sonnet)

Required for: features >3 files, architecture, complex debugging

TaskModelEffort
Rename, boilerplate, test genHaiku 4.5Not supported
Feature dev, debug, refactorSonnet 5 or Opus 5.5Start at the model default
Architecture, security auditOpus 5.5; evaluate Fable 5.1 if neededIncrease with evidence

Full decision table and pricing boundaries: Section 2.5 Model Selection & Thinking Guide

Pattern: Start Sonnet (speed) → swap Opus (complexity) → back Sonnet

Workflow:

Terminal window
# Select Sonnet explicitly for this session
claude --model sonnet
# Complex feature encountered
> "Implement OAuth2 flow with PKCE"
/model opus # Switch to deep reasoning
# Feature complete, back to routine
/model sonnet # Speed + cost optimization

Best Practices:

  • ✅ Swap on task boundaries, not mid-task
  • ✅ Use Opus for: architecture decisions, complex debugging, security-critical code
  • ✅ Use Sonnet for: routine edits, refactoring, test writing
  • ✅ Use Haiku for: simple fixes, typos, validation checks
  • Model switches keep conversation history but can invalidate prompt caches; switch at a useful task boundary.

Standard Anthropic API rates, USD per million tokens, checked September 24, 2026:

ModelInputOutputContext
Opus 5.5$4$201M
Sonnet 5$2$101M
Haiku 4.5$1$5200K
Fable 5.1$10$501M

Opus 5.5 fast mode costs $8/$40. Subscription allowances, usage credits, cache tokens, and cloud-provider pricing are separate. Official pricing.

On the direct Anthropic service, the account default and opus select Opus 5.5; sonnet selects Sonnet 5. Provider aliases differ: check the provider table. fable normally selects Fable 5.1, while Claude apps gateway sessions resolve it to Fable 5.

Source: Gur Sannikov embedded engineering workflow


ServerPurpose
SerenaIndexation + session memory + symbol search
grepaiSemantic search + call graph analysis
Context7Library documentation
SequentialStructured reasoning
PlaywrightBrowser automation
PostgresDatabase queries
doobidooSemantic memory + multi-client + Knowledge Graph

Serena memory: write_memory() / read_memory() / list_memories()

Serena indexation:

Terminal window
# Initial index
uvx --from git+https://github.com/oraios/serena serena project index
# Force rebuild
serena project index --force-full
# Incremental update (faster)
serena project index --incremental --parallel 4

Check status: /mcp


---
name: my-agent
description: Use when [trigger]
model: sonnet
tools: Read, Write, Edit, Bash
---
# Instructions here

Skill: user-invocable (.claude/skills/my-command/SKILL.md)

Section titled “Skill: user-invocable (.claude/skills/my-command/SKILL.md)”
---
description: Brief description
argument-hint: "<required_arg> [--flag]"
disable-model-invocation: true
---
# Command Name
Instructions for what to do...
$ARGUMENTS[0] $ARGUMENTS[1] (or $0 $1) - user args

Dynamic workflow (.claude/workflows/name.js)

Section titled “Dynamic workflow (.claude/workflows/name.js)”
export const meta = {
name: 'my-workflow',
description: 'What this orchestrates',
phases: [{ title: 'Analyze' }, { title: 'Verify' }],
};
// meta must be the first statement, a pure literal (no variables/spreads)
export default async function ({ agent, parallel, pipeline, phase, log, args, budget }) {
phase('Analyze');
const results = await parallel(
ITEMS.map((item) => () => agent(`Analyze ${item}.`, { schema: MY_SCHEMA }))
);
return results.filter(Boolean);
}

Trigger: type ultracode in the prompt (or ask in your own words). Monitor: /workflows.

PrimitiveBehavior
agent(prompt, { schema })Spawn one subagent; returns text or validated JSON
parallel([() => agent(...)])Barrier: all run concurrently, return when slowest finishes
pipeline(items, stage1, stage2)No barrier: items flow through stages independently
phase(title)Update progress label in /workflows UI
log(msg)Emit progress message
budget.remaining()Guard open-ended loops (budget hits 1000-agent cap otherwise)

Key rules: orchestrator consumes 0 tokens; Date.now()/Math.random() unavailable (breaks resume); filter parallel() results with .filter(Boolean).

Full reference: Dynamic Workflows

Bash (macOS/Linux):

#!/bin/bash
INPUT=$(cat)
# Process JSON input
exit 0 # 0=continue, 2=block

PowerShell (Windows):

Terminal window
$input = [Console]::In.ReadToEnd() | ConvertFrom-Json
# Process JSON input
exit 0 # 0=continue, 2=block

❌ Don’t✅ Do
Vague promptsSpecify file + line with @references
Accept without readingRead every diff
Ignore warningsUse /compact at 70%
Skip permissionsNever in production
Negative constraints onlyProvide alternatives

WHAT: [Concrete deliverable]
WHERE: [File paths]
HOW: [Constraints, approach]
VERIFY: [Success criteria]

Example:

Add input validation to the login form.
WHERE: src/components/LoginForm.tsx
HOW: Use Zod schema, show inline errors
VERIFY: Empty email shows error, invalid format shows error

FlagUsage
-p "query"Non-interactive mode (CI/CD)
-c / --continueContinue last session
-r / --resume <id>Resume specific session
--teleportTeleport session from web
remote-controlSubcommand: start remote control session
--model sonnetChange model
--add-dir ../libAllow access outside CWD
--permission-mode planPlan mode
--tools "Tool1,Tool2"Enable specific tools for session
--max-budget-usd 5.00Max API spend limit (print mode)
--system-prompt "..."Replace the entire default system prompt
--append-system-prompt "..."Append text to the default system prompt
--worktree / -wRun in isolated git worktree
--dangerously-skip-permissionsAuto-accept (use carefully)
--debugDebug output
--allowedTools "Edit,Read"Allow these tools without prompting; use --tools to restrict availability
--effort mediumChoose session effort on a supported model
--system-prompt-file ./prompt.txtReplace the prompt from a file
--append-system-prompt-file ./rules.txtAppend prompt text from a file

Use the official CLI reference for the full flag list. Self-hosted runners and command hooks must use the file-based system-prompt flags.

CommandDescription
claude project purge [path]Delete all Claude Code state for a project (transcripts, tasks, config). --dry-run for preview. (v2.1.126)
claude ultrareview [target]Non-interactive cloud code review for CI. --json output. Exits 0/1. (v2.1.120)
claude plugin pruneRemove orphaned auto-installed plugin deps. (v2.1.121)
claude plugin details <name>Show plugin inventory and token cost estimate. (v2.1.139)
claude --plugin-url <url>Load plugin .zip from URL for this session. (v2.1.129)
claude self-hosted-runnerRun web/mobile/desktop sessions on your own machine or container. Windows needs an explicit --base-dir. Team and Enterprise. (v2.1.224)

Terminal window
claude --version # Version
claude update # Check/install updates
claude doctor # Diagnostic
claude --debug # Verbose mode
claude --debug='mcp' # Debug MCP connections
/mcp # MCP status (inside Claude)

Terminal window
# Non-interactive execution
claude -p "analyze this file" src/api.ts
# JSON output
claude -p "review" --output-format json
# Economic model
claude -p "lint" --model haiku
# With auto-accept
claude -p "fix typos" --dangerously-skip-permissions

Available with Pro, Max, Team, and Enterprise subscriptions. Team and Enterprise owners must enable it first. API keys and third-party provider connections are not supported.

Terminal window
# Start a server in the project directory
claude remote-control
# Or connect an existing session
/remote-control

Open the displayed URL or scan the QR code from a browser or the Claude mobile app. The local process must keep running; the files and tools stay on your machine. Server mode can run multiple sessions with --spawn worktree and --capacity; /remote-control connects the current session. Available commands vary by client, so check the current limitations.

Full doc: Remote Control | Security notes


Availability: newer models, including Opus 5.5, Sonnet 5, and Fable, do not receive task-tracking tools by default. Start with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude to opt in. CLAUDE_CODE_ENABLE_TASKS=0 selects legacy TodoWrite only where task tools are enabled. Official tool availability.

Two systems available:

SystemWhen to UsePersistence
Tasks API (v2.1.16+)Multi-session projects, dependencies✅ Disk (~/.claude/tasks/)
TodoWrite (Legacy)Simple single-session❌ Session only
Terminal window
# Enable persistence across sessions
export CLAUDE_CODE_TASK_LIST_ID="project-name"
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude
# Inside Claude: Create task hierarchy
> "Create tasks for auth system with dependencies"
# Resume later (new session)
export CLAUDE_CODE_TASK_LIST_ID="project-name"
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude
> "TaskList to see current state"

Key capabilities:

  • 📁 Persistent: Survives session end, context compaction
  • 🔗 Dependencies: Task A blocks Task B
  • 🔄 Multi-session: Broadcast state to multiple terminals
  • 📊 Status: pending → in_progress → completed

⚠️ Limitation: TaskList shows id, subject, status, blockedBy only. For description/metadata → use TaskGet(taskId) per task.

Tip: Store key info in subject for quick scanning.

Migration flag (v2.1.19+):

Terminal window
# Revert to old TodoWrite system
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 CLAUDE_CODE_ENABLE_TASKS=0 claude

→ Full workflow: guide/workflows/task-management.md


  1. Always review diffs before accepting
  2. Use /compact before context gets critical (>70%)
  3. Be specific in requests (WHAT, WHERE, HOW, VERIFY)
  4. Plan Mode first for complex/risky tasks
  5. Create CLAUDE.md for every project
  6. Commit frequently after each completed task
  7. Know what’s sent: prompts, files, MCP results → Anthropic (opt-out training)

Simple task → Just ask Claude
Complex task → Tasks API to plan first
Risky change → Plan Mode first
Repeating task → Create agent or command
Context full → /compact or /clear
Need docs → Use Context7 MCP
Deep analysis → Use Opus (thinking on by default)

ProblemSolution
”Command not found”Check PATH, reinstall: curl -fsSL https://claude.ai/install.sh | sh
Context too high (>70%)/compact immediately
Slow responses/compact or /clear
MCP not workingclaude mcp list, check config
Permission deniedCheck settings.local.json
Hook blockingCheck hook exit code, review logic

Health Check Script (save & run):

Terminal window
# macOS/Linux
which claude && claude doctor && claude mcp list
# Windows PowerShell
where.exe claude; claude doctor; claude mcp list

ModelUse ForCost
HaikuSimple fixes, reviews$
SonnetMost development$$
OpusArchitecture, complex bugs$$$
OpusPlanPlan (Opus) + Execute (Sonnet)$$

Tip: Use --add-dir to allow tool access to directories outside your current working directory


ToolPurposeInstall
ccusageCost tracking & reportsbunx ccusage daily
RTKShell-output reduction (up to 90%)brew install rtk (or cargo install --git https://github.com/rtk-ai/rtk) · Site (author is a core contributor)
claude-code-viewerSession history UInpx @kimuson/claude-code-viewer
Entire CLISession checkpoints + governanceentire.io (Feb 2026)

Entire CLI: Agent-native platform by ex-GitHub CEO with rewindable checkpoints, approval gates, audit trails. For compliance (SOC2, HIPAA) or multi-agent workflows.


Quick decision (5 seconds): exact text → rg | exact name → rg/Serena | concept → grepai | structure → ast-grep

TaskToolCommand
”Find TODO comments”rgrg "TODO"
”Find auth code”grepaigrepai search "authentication"
”Who calls login?”grepaigrepai trace callers "login"
”Get file structure”Serenaserena get_symbols_overview
”Async without try/catch”ast-grepast-grep "async function $F"

Speed: rg (~20ms) → Serena (~100ms) → ast-grep (~200ms) → grepai (~500ms)

Full workflows: workflows/search-tools-mastery.md



Author: Florian BRUNIAUX | @Méthode Aristote | Written with Claude

Last updated: Sep 24, 2026 | Version 3.44.1