Back to All Cheatsheet Libraries cheatsheets

Anthropic Claude Code

Session/headless commands, flags, and configuration reference for Anthropic's Claude Code CLI.

This page is the CLI. For the claude.ai app, see Anthropic Claude

This page covers Claude Code, the terminal coding agent. For the consumer chat app — Projects, Artifacts, memory, model plans — see Anthropic Claude. The two share a model family and almost nothing else. Official docs start at code.claude.com/docs/en/overview — always more current than this page.

Install Claude Code

Three install methods. Native install is recommended — it auto-updates in the background, so you're never stuck chasing a stale version.

Platform Command
macOS, Linux, WSL curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell irm https://claude.ai/install.ps1 | iex
Windows CMD curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Homebrew brew install --cask claude-code
WinGet winget install Anthropic.ClaudeCode
First run cd your-project && claude
Which method updates itself?
  • Native install auto-updates in the background — the only one of the three that does.
  • Homebrew does not auto-update. Run brew upgrade claude-code yourself. Two casks exist: claude-code (stable, ~a week behind) and claude-code@latest (ships immediately).
  • WinGet does not auto-update either — run winget upgrade Anthropic.ClaudeCode periodically.
  • On Debian/Fedora/RHEL/Alpine, apt, dnf, and apk packages are also available.
  • On native Windows, install Git for Windows first so Claude Code can use the Bash tool — WSL doesn't need this.
  • First run prompts you to sign in. If ANTHROPIC_API_KEY is already set, it skips straight to approving the key instead.
Total Entries: 0
Category Surface / Availability Name Syntax Accepted Values / Range Example Description & Notes
1. Session & Startup Claude Code Interactive session claude ["query"] Optional opening prompt claude "explain this project" Starts the REPL in the current directory. Pass a query to open with that prompt already sent.
1. Session & Startup Claude Code Print / headless --print, -p Toggle + query string cat logs.txt | claude -p "explain" Runs one query, writes to stdout, exits. The entry point for every scripted or CI use. Accepts piped stdin.
1. Session & Startup Claude Code Continue --continue, -c Toggle claude -c -p "check for type errors" Loads the most recent conversation in the current directory, including sessions that added it via /add-dir.
1. Session & Startup Claude Code Resume --resume, -r Session ID, name, or blank for picker claude -r "auth-refactor" "finish this PR" Resumes a specific session, or opens an interactive picker. Background sessions appear marked bg.
1. Session & Startup Claude Code Session name --name, -n Text label claude -n "my-feature-work" Names the session for /resume and the terminal title. Rename mid-session with /rename.
1. Session & Startup Claude Code Fork on resume --fork-session Toggle (use with -r / -c) claude --resume abc123 --fork-session Creates a new session ID instead of reusing the original, leaving the source conversation untouched.
1. Session & Startup Claude Code Worktree --worktree, -w Name, #PR, or PR URL claude -w feature-auth --tmux Runs in an isolated git worktree under .claude/worktrees/ so parallel sessions don't collide.
1. Session & Startup Claude Code Maintenance commands claude update | doctor | install stable, latest, or a version claude install stable doctor prints read-only install and settings diagnostics without starting a session.
1. Session & Startup Claude Code Authentication claude auth login|logout|status --email, --sso, --console, --text claude auth login --console status exits 0 when signed in, 1 when not — useful as a CI precondition check.
1. Session & Startup Claude Code CI token claude setup-token Toggle claude setup-token Generates a long-lived OAuth token for CI and scripts. Printed once, never saved. Requires a Claude subscription.
2. Model & Reasoning Claude Code Model --model opus, sonnet, haiku, fable, or full ID claude --model claude-sonnet-5 Sets the session model. Overrides the model setting and ANTHROPIC_MODEL. Aliases resolve to the latest in that tier.
2. Model & Reasoning Claude Code Effort level --effort low, medium, high, xhigh, max, ultracode claude --effort xhigh How much reasoning the model spends per turn. Available levels depend on the model. ultracode starts at xhigh with automatic workflow orchestration.
2. Model & Reasoning Claude Code Fallback chain --fallback-model Comma-separated model list claude --fallback-model sonnet,haiku Tried in order when the primary model is overloaded or retired. Persist it with the fallbackModel setting.
2. Model & Reasoning v2.1.210+ Advisor --advisor opus, sonnet, or a full model ID claude --advisor opus Pairs a stronger second model that Claude consults at key decision points. Fable 5 isn't offered as an advisor.
2. Model & Reasoning Claude Code Subagents --agent, --agents Agent name, or inline JSON definitions claude --agent my-custom-agent --agents defines subagents on the fly using subagent frontmatter fields plus a prompt field.
3. Permissions & Safety Claude Code Permission mode --permission-mode default (manual), acceptEdits, plan, auto, dontAsk, bypassPermissions claude --permission-mode plan Sets the starting mode; cycle live with Shift+Tab. Overrides defaultMode in settings.
3. Permissions & Safety Claude Code Allow rules --allowedTools Permission-rule patterns --allowedTools "Bash(git log *)" "Read" Tools that run without prompting. Same syntax as permissions in settings.json — Bash(*) does not mean "match all Bash".
3. Permissions & Safety Claude Code Deny rules --disallowedTools Tool names or scoped rules --disallowedTools "Bash(rm *)" "mcp__*" A bare name removes the tool from context entirely; a scoped rule keeps the tool and denies only matching calls.
3. Permissions & Safety Claude Code Restrict toolset --tools "", "default", or a name list claude --tools "Bash,Edit,Read" Limits built-in tools. Does not affect MCP tools — pair with --disallowedTools "mcp__*" to cover those too.
3. Permissions & Safety Claude Code Extra directories --add-dir One or more paths claude --add-dir ../apps ../lib Grants file access only — most .claude/ configuration is not discovered from added directories.
3. Permissions & Safety v2.1.169+ Safe mode --safe-mode Toggle claude --safe-mode Disables every customization (CLAUDE.md, skills, plugins, hooks, MCP, themes) to isolate a broken config. Auth, models, tools, and permissions still work.
3. Permissions & Safety Claude Code Skip permissions --dangerously-skip-permissions Toggle claude --dangerously-skip-permissions Equivalent to --permission-mode bypassPermissions. Reserve for sandboxed containers and disposable CI runners.
4. Headless & Scripting Claude Code Output format --output-format text, json, stream-json claude -p "list endpoints" --output-format json | jq json returns one structured envelope with cost, duration, and turn count; stream-json emits live events.
4. Headless & Scripting Claude Code Input format --input-format text, stream-json claude -p --input-format stream-json Lets you feed structured turns in rather than a single prompt string. Print mode only.
4. Headless & Scripting Claude Code Bare mode --bare Toggle claude --bare -p "does this handle null?" Skips auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. Leaves Bash, read, and edit available. Fastest, most reproducible scripted start.
4. Headless & Scripting Claude Code Turn limit --max-turns Integer (no limit by default) claude -p --max-turns 3 "query" Caps agentic turns in print mode and exits with an error at the limit.
4. Headless & Scripting v2.1.217+ Spend cap --max-budget-usd Dollar amount claude -p --max-budget-usd 5.00 "query" Stops once API spend reaches the cap. Subagent spend counts toward it, and running background subagents are stopped.
4. Headless & Scripting v2.1.205+ Structured output --json-schema JSON Schema string claude -p --json-schema '{"type":"object",...}' "query" Returns validated JSON matching your schema after the agent finishes. Invalid schemas now exit with an error rather than falling back silently.
4. Headless & Scripting Claude Code Streaming detail --include-partial-messages Toggle claude -p --output-format stream-json --verbose --include-partial-messages "q" Emits token-level events. Requires --print and --output-format stream-json.
4. Headless & Scripting Claude Code Cache-friendly prompt --exclude-dynamic-system-prompt-sections Toggle claude -p --exclude-dynamic-system-prompt-sections "query" Moves per-machine sections (cwd, env, memory paths, git flag) into the first user message so the prompt cache is reused across users and machines.
5. System Prompt Claude Code Append text --append-system-prompt Text string claude --append-system-prompt "Always use TypeScript" Preferred for scripts: keeps default tool guidance, safety instructions, and coding conventions, and adds only what differs.
5. System Prompt Claude Code Append file --append-system-prompt-file File path claude --append-system-prompt-file ./style-rules.txt Same as above but sourced from a file you can version-control and share.
5. System Prompt Claude Code Replace prompt --system-prompt Text string claude --system-prompt "You are a Python expert" Drops the entire default prompt including tool guidance and safety instructions. Use only when the identity and permission model genuinely differ.
5. System Prompt Claude Code Replace from file --system-prompt-file File path claude --system-prompt-file ./prompts/review.txt Mutually exclusive with --system-prompt. Append flags can combine with either replacement flag.
5. System Prompt v2.1.205+ Subagent prompt --append-subagent-system-prompt Text string claude -p --append-subagent-system-prompt "Cite file paths" "q" Appends to every subagent's prompt, including nested ones. Print mode only.
6. Parallel & Background Claude Code Background session --bg, --background Toggle + prompt claude --bg "investigate the flaky test" Starts detached and returns immediately with a session ID. Cannot be combined with -p.
6. Parallel & Background Claude Code Shell job --exec Shell command string claude --bg --exec 'pytest -x' Runs a PTY-backed background job instead of a Claude session — useful for parking long test runs next to your agents.
6. Parallel & Background Claude Code Agent view claude agents --json, --all, --cwd claude agents --json One screen showing every parallel session and which ones need input. --json makes it scriptable.
6. Parallel & Background Claude Code Session control claude attach|logs|stop|respawn|rm Session ID claude attach 7c5dcf5d Manage background sessions from the shell. respawn --all restarts every running session, e.g. to pick up a new binary.
6. Parallel & Background v2.1.186+ Teammate display --teammate-mode in-process (default), auto, tmux, iterm2 claude --teammate-mode tmux How agent-team teammates render. The default changed from auto in v2.1.179.
7. Extensions & Config Claude Code MCP servers --mcp-config, --strict-mcp-config JSON file paths or inline JSON claude --strict-mcp-config --mcp-config ./mcp.json Loads servers from file. The strict flag ignores all other MCP configuration — the reproducible choice for CI.
7. Extensions & Config v2.1.186+ MCP auth claude mcp login|logout <name> Server name, --no-browser claude mcp login sentry --no-browser Runs a server's OAuth flow from the shell without opening /mcp. Use --no-browser over SSH.
7. Extensions & Config Claude Code Plugins --plugin-dir, --plugin-url Directory, .zip, or URL claude --plugin-dir ./my-plugin Session-scoped plugin loading. Repeat the flag for multiple plugins.
7. Extensions & Config Claude Code Settings override --settings, --setting-sources File path or inline JSON; user,project,local claude --settings '{"fastMode": true}' Overrides matching keys in settings.json for this session; omitted keys keep their file values. Max 2 MiB.
7. Extensions & Config Claude Code Browser & IDE --chrome, --ide Toggle (--no-chrome to disable) claude --chrome Chrome integration for web automation and testing; --ide auto-connects when exactly one valid IDE is available.
7. Extensions & Config Claude Code Debugging --debug, --debug-file Category filter, e.g. "api,mcp" or "!statsig" claude --debug "api,hooks" Category filtering keeps the log readable. --debug-file implicitly enables debug mode.
8. Slash Commands In-session Initialize project /init None /init Generates a starter CLAUDE.md. Set CLAUDE_CODE_NEW_INIT=1 for a guided flow covering skills, hooks, and personal memory.
8. Slash Commands In-session Inspect context /context [all] all expands the breakdown /context all Colored grid of what's filling the window, with warnings for context-heavy tools and memory bloat. Run this before compacting.
8. Slash Commands In-session Compact /compact [instructions] Optional focus instructions /compact keep the auth flow and test results Summarizes the conversation to free space while staying on the same task. Focus instructions control what survives.
8. Slash Commands In-session Clear /clear [name] Optional label for the old session /clear auth-work Empty context, project memory intact. Aliases /reset, /new. Recover the prior conversation with /resume or the rewind menu.
8. Slash Commands In-session Plan mode /plan [description] Optional task description /plan fix the auth bug Enters plan mode straight from the prompt so Claude researches and proposes before touching files.
8. Slash Commands In-session Model & effort /model, /effort Model name; low → ultracode, or auto /effort xhigh Both apply immediately without waiting for the current response. In /model, press s to switch for this session only.
8. Slash Commands In-session Code review /code-review [level] [--fix] low…max, ultra; --fix, --comment /code-review high --fix Reviews the diff for correctness bugs plus reuse and simplification cleanups. ultra runs a deep multi-agent review in the cloud.
8. Slash Commands In-session Security review /security-review None /security-review Checks the working diff for security vulnerabilities specifically, separate from the correctness pass.
8. Slash Commands In-session Side question /btw [question] Question text, or blank to reopen /btw what was that config file called? Ephemeral answer in an overlay — sees the full conversation, has no tools, never enters history. Works while Claude is mid-turn.
8. Slash Commands In-session Rewind /rewind None (or Esc Esc) /rewind Rolls code and conversation back to a checkpoint, or summarizes part of the conversation. Can restore context from before a /clear.
8. Slash Commands In-session Goal /goal [condition|clear] Completion condition /goal all tests pass and lint is clean Claude keeps working across turns until the condition holds. clear, stop, or cancel ends it early.
8. Slash Commands In-session Loop /loop [interval] [prompt] Interval like 5m; omit to self-pace /loop 5m check if the deploy finished Repeats a prompt while the session stays open. Omit the prompt to run .claude/loop.md. Alias /proactive.
8. Slash Commands In-session Batch /batch <instruction> Change description /batch migrate src/ from Solid to React Decomposes a codebase-wide change into 5–30 units, then runs one background subagent per unit in its own worktree, each opening a PR. Requires git.
8. Slash Commands In-session Branch / fork /branch, /fork, /background Optional name or prompt /fork try the Redis approach instead /branch switches you into a copy; /fork runs a copy as a separate background session; /background detaches this one and frees the terminal.
8. Slash Commands In-session Memory /memory None /memory Edit CLAUDE.md files, toggle auto-memory, and review what Claude has learned automatically.
8. Slash Commands In-session Permissions /permissions None /permissions Interactive allow / ask / deny rule editor by scope, plus working directories and recent auto-mode denials. Alias /allowed-tools.
8. Slash Commands v2.1.181+ Config /config [key=value ...] Any settable key /config theme=dark model=sonnet Sets settings without opening the UI. Run /config --help to list every key. Alias /settings.
8. Slash Commands In-session Diagnostics /doctor, /debug, /usage Optional issue description /doctor /doctor checks install health, trims bloated CLAUDE.md files, and flags unused skills and slow hooks before changing anything. /cost is an alias of /usage.
8. Slash Commands In-session Diff & export /diff, /export, /copy Optional filename; /copy N /export review-notes.txt /diff opens an interactive viewer for uncommitted and per-turn changes; /copy picks individual code blocks.
9. Keyboard & Input In-session Cycle permission mode Shift+Tab Alt+M on some Windows runtimes Shift+Tab → plan mode Cycles Manual → acceptEdits → plan, plus any modes you've enabled such as auto or bypassPermissions.
9. Keyboard & Input In-session Interrupt Esc Single press Esc → redirect mid-turn Stops the response or tool call mid-turn and keeps the work done so far. Closes a dialog instead when one is open.
9. Keyboard & Input In-session Rewind menu Esc Esc Double press on empty prompt Esc Esc → checkpoint list On an empty prompt, opens the rewind menu. With text in the prompt, clears the draft and saves it to history.
9. Keyboard & Input In-session Transcript viewer Ctrl+O Toggle Ctrl+O → full tool detail Shows detailed tool usage with timestamps and per-message model, and expands collapsed MCP calls.
9. Keyboard & Input In-session History search Ctrl+R Ctrl+S cycles scope in fullscreen Ctrl+R → search past prompts Reverse-searches prompt history across all projects. In fullscreen it opens a dialog scoped to session, project, or everything.
9. Keyboard & Input In-session Background a task Ctrl+B Press twice in tmux Ctrl+B → detach the build Moves a running Bash command or agent to the background so the turn continues.
9. Keyboard & Input In-session External editor Ctrl+G Ctrl+X Ctrl+E also works Ctrl+G → write prompt in $EDITOR Composes long prompts in your default editor. Optionally prepends Claude's last reply as commented context.
9. Keyboard & Input In-session Toggle thinking / fast Option+T, Option+O Alt+ on Windows and Linux Option+T → extended thinking off Thinking toggle has no effect on Fable 5, which always uses extended thinking. Option+P switches model without clearing your prompt.
9. Keyboard & Input In-session Input prefixes / ! @ : First character of the prompt ! npm test / command, ! shell mode, @ file path autocomplete, : emoji shortcode. Shell output lands in context and Claude responds to it.
9. Keyboard & Input In-session Multiline input Shift+Enter, \+Enter, Ctrl+J Terminal dependent Ctrl+J → newline anywhere Ctrl+J works in any terminal with no setup. For VS Code, Cursor, Alacritty, and Zed, run /terminal-setup to install the Shift+Enter binding.
10. Claude API Messages API Model model claude-opus-5, claude-sonnet-5, claude-haiku-4-5-20251001, claude-fable-5, claude-opus-4-8 model="claude-opus-5" Required. Opus for complex agentic work, Sonnet for balanced throughput, Haiku for fast and cheap.
10. Claude API Messages API Max tokens max_tokens Integer, model dependent max_tokens=16000 Required. Hard ceiling on total output for the turn, thinking tokens included.
10. Claude API Messages API Messages messages Array of {role, content} [{"role":"user","content":"Hello"}] The API is stateless — send the full conversation every request. Content can mix text, images, documents, and tool results.
10. Claude API Messages API System prompt system String or content-block array system="You are a technical editor." Top-level, not a message role. Use the array form to attach cache_control breakpoints for prompt caching.
10. Claude API Messages API Thinking thinking {"type":"adaptive"|"enabled"|"disabled"}, display, budget_tokens thinking={"type":"adaptive","display":"summarized"} Adaptive lets Claude decide how much to reason and is the path forward on newer models. With manual enabled, budget_tokens must be ≥1024 and below max_tokens.
10. Claude API Messages API Tools tools Array of {name, description, input_schema} tools=[weather_tool] Description quality is the single biggest driver of tool-use accuracy: say what it does, when not to use it, and what each parameter means.
10. Claude API Messages API Tool choice tool_choice auto, any, tool, none tool_choice={"type":"tool","name":"get_weather"} With extended thinking, only auto and none are supported. disable_parallel_tool_use forces one call at a time.
10. Claude API Messages API Streaming stream true / false (default false) stream=True Server-sent events: message_start → content blocks → message_delta → message_stop. Token counts in message_delta are cumulative.
10. Claude API Messages API Stop sequences stop_sequences Array of strings stop_sequences=["\n\nHuman:"] Ends generation when a sequence appears. The matched value comes back in stop_sequence on the response.
10. Claude API Messages API Beta headers betas e.g. interleaved-thinking-2025-05-14 betas=["interleaved-thinking-2025-05-14"] Interleaved thinking lets Claude think between tool calls, and is the one case where budget_tokens may exceed max_tokens. Newer models enable it automatically with adaptive thinking.
11. Deprecated & Removed Legacy — API Sampling controls temperature, top_p, top_k Default value only on newer models temperature=0.3 # 400 error Not supported on Claude 4.7 and later or Mythos Preview — a non-default value returns 400. Omit them and steer behavior through the prompt instead.
11. Deprecated & Removed Legacy — API Response prefill assistant turn as last message Removed on 4.6+ {"role":"assistant","content":"The answer is ("} Returns 400 on Claude 4.6 and later and on Mythos Preview. Use structured outputs or system-prompt instructions to shape the response instead.
11. Deprecated & Removed Removed v2.1.111 Auto mode flag --enable-auto-mode — claude --permission-mode auto Auto mode is now in the Shift+Tab cycle by default. Use --permission-mode auto to start in it.
11. Deprecated & Removed Removed v2.1.91 PR comments /pr-comments — "show me the review comments on this PR" Just ask Claude directly now. Related: /review still gives a fast read-only pass over a GitHub PR.
11. Deprecated & Removed Deprecated alias Remote flag --remote Task description claude --cloud "Fix the login bug" Deprecated alias for --cloud, which creates a web session on claude.ai. Pull it back down locally with --teleport.

Prompt Architecture & Working Vocabulary

[Context & Role] + [Concrete Task] + [Constraints & Guardrails] + [Reference Material] + [Output Contract]

1. Context & Role

Say what world this lives in and who's asking (e.g. this is a Rails 7 monolith; I'm the on-call engineer, it's 2am). Persistent context belongs in CLAUDE.md, not every prompt.

2. Concrete Task

One verb, one outcome. Find why the checkout webhook times out beats look at the webhook. Vague asks produce vague diffs.

3. Constraints & Guardrails

State the boundaries up front (e.g. don't change public APIs, smallest diff that passes tests, ask before installing anything).

4. Reference Material

Point at real artifacts: @src/auth.ts, a pasted stack trace, ! git diff. Specific beats descriptive every time.

5. Output Contract

Name the shape you want back — a plan, a unified diff, a JSON object, three options ranked. Ambiguous format is the most common cause of rework.

Task Verbs (A–Z)

Audit Benchmark Bisect Consolidate Document Extract Instrument Migrate Profile Refactor Reproduce Trace

Constraint Phrases (A–Z)

Ask before editing Don't add dependencies Don't touch public APIs Match existing patterns No new abstractions Smallest diff that works Stop after the plan Tests must stay green

Output Contracts (A–Z)

Bulleted list, no prose Comparison table JSON matching this schema One paragraph, no headers Plan first, then confirm Ranked shortlist of 3 Unified diff only

Reasoning Depth (A–Z)

Consider the failure modes Flag what you're unsure about List 3 approaches, then pick Read before you write State assumptions first What would break this?

Verification Demands (A–Z)

Cite file:line Prove it with a script Reproduce before fixing Run the tests, show output Show the failing case Verify, don't assume

Context Anchors (A–Z)

@path/to/file ! git diff ! npm test /context CLAUDE.md Pasted stack trace Screenshot paste

Top 20 High-Signal CLAUDE.md Entries (A–Z)

Branch naming convention Build command Commit message format Deploy is manual — never trigger Directories that are generated Error-handling convention Files never to edit Formatter and lint command Known flaky tests Local dev setup gotchas Logging convention Migration workflow Package manager (npm vs pnpm) Preferred test framework Secrets live in X, never inline Single test command Style rules that differ from defaults Test command Type-check command Where new modules go

Cool Tips & Tricks

Diagnose Before You Compact
/compact is a blunt instrument. Run /context first to see what's actually eating the window — it's often one enormous file read or an MCP server you forgot you connected. /context all → /compact keep the auth flow and test results Same task → compact. Different task → clear.
Bare Mode for Scripts
Skipping auto-discovery of hooks, skills, plugins, MCP servers, and CLAUDE.md makes scripted calls start noticeably faster and behave reproducibly across machines. claude --bare -p "does this handle null inputs?" < src/parse.ts Docs note this will become the default for -p.
Plan Before Big Changes
For anything spanning more than a couple of files, enter plan mode first so Claude researches and proposes before editing. Cheaper to redirect a plan than to unwind a diff. Shift+Tab → plan | /plan fix the auth bug
/btw vs. Subagent
They're exact inverses. /btw sees your whole conversation but has no tools — for asking about what Claude already knows. A subagent has full tools but starts empty — for going and finding out something new. /btw which file did you say held the retry logic? Both keep the main context clean.
Parallel Work Without Collisions
Worktrees give each session its own checkout, so two agents can't stomp each other's files. Pair with claude agents to watch them all from one screen. claude -w feature-auth --bg "implement the token refresh"
Shell Mode Round-Trip
Prefix with ! to run a command directly. The output lands in context and Claude responds to it — so you get an explanation of the failure without a second prompt. ! npm test Set respondToBashCommands: false to silence the auto-response.
Cap Spend in CI
Unattended runs deserve a hard ceiling. Subagent spend counts toward the cap, and running background subagents get stopped when it's reached. claude -p --max-budget-usd 3.00 --max-turns 10 "triage this failure"
When Config Goes Weird
--safe-mode disables every customization at once, so you can tell in one run whether a plugin, hook, or skill is the culprit. Unlike --bare, permissions and models still work normally. claude --safe-mode Then narrow it down with /doctor.

Project Standards & Framework

Rule 1: CLAUDE.md Discipline

CLAUDE.md loads into every session, so every line costs context forever. Keep only what Claude can't work out by reading the code:

  • Keep the non-derivable: pitfalls, rationale, and conventions that differ from tool defaults. Claude can read your directory layout; it can't guess that make test is broken and you use pytest -x.
  • Cut the derivable: directory listings, dependency lists, and architecture overviews belong in the codebase, not in permanent context. /doctor will offer to trim these for you.
  • Push detail down: move on-demand guidance into skills and nested per-package CLAUDE.md files so it loads only when relevant.
  • Never mid-session: CLAUDE.md edits don't apply until the next session — the prompt cache is already built. Use /memory to edit and restart to apply.
Rule 2: Permission Posture by Environment

Match the mode to the blast radius, not to your patience:

  • Exploring an unfamiliar repo: plan mode. Claude reads and proposes, nothing is written.
  • Normal feature work: acceptEdits or auto, with a project allowlist so read-only commands stop prompting. Build it with /fewer-permission-prompts.
  • Unattended CI: --strict-mcp-config, an explicit --tools list, --max-turns, and --max-budget-usd. Constrain the agent rather than trusting the prompt.
  • bypassPermissions: containers and disposable runners only. It skips the checks that stop a bad command, and the mode persists across supervisor restarts for background sessions.
Rule 3: Session Hygiene

Context quality degrades long before the window is full. Defaults worth adopting:

  • New task, new session. /clear beats fighting drift from an unrelated conversation. Project memory survives.
  • Name sessions you'll come back to with -n or /rename, so /resume is a list of tasks rather than a list of timestamps.
  • Branch instead of arguing. Trying a second approach? /branch preserves the first so you can compare rather than reconstruct.
  • Review before you ship: /diff to see it, /code-review for correctness, /security-review for vulnerabilities.
Standard CLAUDE.md Template
# Project: [name] ## Commands - Test: [single command] - Type-check: [single command] - Lint: [single command] - Build: [single command] ## Conventions that differ from defaults - [e.g. we use tabs, not spaces — the formatter enforces it] - [e.g. errors are returned, never thrown, outside the HTTP layer] - [e.g. new modules go in src/features/<name>/, not src/lib/] ## Gotchas - [e.g. the auth tests are flaky in CI; rerun once before investigating] - [e.g. never edit db/schema.rb by hand — it's generated by migrations] ## Do not - Deploy, or run anything under scripts/prod/ - Add dependencies without asking - Touch [generated directory]

Complete Slash Command Reference

Every built-in command and bundled skill in Claude Code, current as of August 2026 — 88 in total. The table above covers CLI flags and startup syntax; this one is the in-session slash commands. Type /help in Claude Code for the live list, which is always authoritative.

Category Command What it does
Session/clear [name]Start a new conversation with empty context.
Session/compact [instructions]Free up context by summarising the conversation.
Session/autocompact [auto|<tokens>]Set the auto-compact window threshold.
Session/context [all]Visualise current context usage.
Session/resume [name]Return to an earlier conversation.
Session/rewind [turn]Roll code and conversation back to a checkpoint.
Session/branch [name]Create a branch of the current conversation.
Session/fork [prompt]Copy the conversation into a new background session.
Session/recapOne-line summary of the current session.
Session/export [filename]Export the conversation as plain text.
Session/copy [N]Copy the last assistant response to the clipboard.
Session/exitExit the CLI, or detach from a background session.
Help & status/helpShow help and available commands.
Help & status/statusCurrent session status.
Help & status/usageToken usage and costs.
Help & status/costAlias for /usage.
Help & status/doctorSetup checkup — diagnoses and fixes common issues.
Help & status/insightsHTML report analysing recent sessions.
Help & status/release-notesView release notes.
Help & status/upgradeUpgrade Claude Code or SDK dependencies.
Help & status/bug [report]Report a bug or share conversation context.
Help & status/shareAlias for /bug.
Help & status/feedback [report]Send product feedback.
Help & status/heapdumpHeap snapshot for diagnosing memory usage.
Config/config [key=value]Open Settings, or set preferences directly.
Config/settingsAlias for /config.
Config/permissionsManage tool permission rules.
Config/hooksView hook configurations for tool events.
Config/memoryEdit CLAUDE.md files and manage auto memory.
Config/initInitialise the project with a CLAUDE.md guide.
Config/keybindingsOpen the keyboard shortcuts file.
Config/statuslineConfigure the statusline display.
Config/terminal-setupConfigure terminal integration.
Config/vimToggle Vim keybindings.
Config/theme [color]Set the colour theme.
Config/color [color|default]Prompt-bar colour for this session.
Config/sandboxManage sandboxed environments.
Config/plugin [subcommand]Manage Claude Code plugins.
Config/import [codex|gemini]Bring configuration in from another coding agent.
Config/auto-mode-setupGenerate and configure autoMode environment entries.
Config/privacy-settingsView and update privacy settings.
Model/model [model]Switch the model.
Model/effort [level|auto|status]Set or check the effort level.
Model/fast [on|off]Toggle fast mode.
Model/advisor [model|off]Enable or disable the advisor tool.
Agents/agentsManage subagent configurations.
Agents/subtask [prompt]Hand a side task to a subagent.
Agents/list-agentsList subagents and sessions Claude can message.
Agents/tasksList this session's background work.
Agents/background [prompt]Detach the session to run as a background agent.
Agents/todosManage session todos.
Agents/goal [condition|clear]Set a goal for Claude to work toward.
Agents/plan [description]Enter plan mode for large changes.
Files/add-dir <path>Add a working directory for file access.
Files/cd <path>Move the session to a new working directory.
Files/diffInteractive diff viewer for uncommitted changes.
Integrations/ideManage IDE integrations and show status.
Integrations/mcp [reconnect|enable|disable]Manage MCP server connections.
Integrations/chromeConfigure Claude in Chrome settings.
Integrations/install-github-appInstall the Claude GitHub App for a repo.
Integrations/install-slack-appInstall the Claude Slack app.
Integrations/artifactsList, attach, open or copy links to artifacts.
Integrations/autofix-pr [prompt]Spawn a cloud session to watch and fix a PR.
Integrations/design-loginAuthorise design-system access.
Cross-device/desktopContinue the session in the Desktop app.
Cross-device/mobileQR code to download the mobile app.
Cross-device/teleportPull a web session into the terminal.
Cross-device/remote-controlContinue a local session from another device.
Account/loginSign in to your Anthropic account.
Account/logoutSign out.
Account/passesShare a free week of Claude Code.
Skills/code-review [level] [--fix] [--comment]Review a diff or PR for bugs and cleanups.
Skills/reviewAlias for /code-review.
Skills/security-reviewCheck the diff for security vulnerabilities.
Skills/simplify [level] [--fix]Improve readability and maintainability.
Skills/verifyVerify code correctness.
Skills/debug [description]Enable debug logging and troubleshoot.
Skills/batch <instruction>Orchestrate large-scale parallel changes.
Skills/loop [interval] [prompt]Run a prompt repeatedly on a schedule.
Skills/deep-research <question>Fan out web searches and synthesise a report.
Skills/dataviz [request]Design guidance for charts and dashboards.
Skills/claude-api [migrate|upgrade]Load the Claude API reference and assist with updates.
Skills/design-sync [hint]Convert a React design system to Claude Design.
Skills/fewer-permission-promptsScan transcripts and reduce permission prompts.
Extras/btw [question]Ask a side question without adding to history.
Extras/focusToggle focus view for a cleaner display.
Extras/powerupLearn Claude Code features interactively.
Extras/radioOpen Claude FM lo-fi radio.

/code-review — every level, copy-paste ready

ultra is not just a bigger --effort

Every other level runs inline, in this session. ultra is different in kind, not just degree: it launches a multi-agent review in the cloud, separate from the running session.

It needs a git repository — offer to git init if you don't have one. The no-argument form bundles your local branch and needs no GitHub remote; pass a PR number to review a PR on GitHub.com instead, where --post becomes available to post the findings back as a PR comment.

It is user-triggered and billed. Claude cannot launch it on your behalf — you run the command yourself. /ultrareview still works as a deprecated alias for the same command.

Level Command What it does
low /code-review low Fewer, high-confidence findings only. Fast pass on a small diff.
medium /code-review medium The everyday default — high-confidence findings, still fast.
high /code-review high Broader coverage; may surface uncertain findings alongside confident ones.
high --fix /code-review high --fix Same review, then applies the findings to the working tree.
xhigh /code-review xhigh Wider still. Costs more time and tokens than high.
max /code-review max The most thorough inline level. Slowest, most tokens.
ultra /code-review ultra Cloud, multi-agent, billed. Reviews your current local branch. Needs a git repo.
ultra + PR /code-review ultra 123 Same cloud review, targeted at PR #123 on GitHub.com instead of your local branch.
ultra --post /code-review ultra 123 --post After the review finishes, posts its findings to the PR as a single comment from your GitHub account.
specific target /code-review medium src/auth Any inline level accepts a PR number, branch name, or path instead of reviewing the whole current diff.
inline comments /code-review medium --comment Posts findings as inline PR review comments instead of one summary.
alias /review high /review is a plain alias for /code-review — every level above works the same under either name.

SuperClaude — adding /sc: commands

If you were looking for /analyze, this is where it lives

/analyze is not a Claude Code command — it does not exist in the built-in set or the bundled skills. It comes from SuperClaude, a third-party configuration framework, and its real name there is /sc:analyze.

Every SuperClaude command is namespaced under /sc: precisely so it cannot collide with a built-in. That namespace is the giveaway: if a command you read about starts with /sc:, it needs SuperClaude installed first.

Know what you are installing
  • SuperClaude is third-party, not from Anthropic. It is an independent open-source project (MIT, ~23.8k stars, actively maintained) that writes command and configuration files into your Claude Code setup.
  • It adds 30 commands, plus optional cognitive personas and MCP server integrations.
  • It needs Python 3.10+ — it installs from PyPI, not npm, which surprises people.
  • Because it modifies your Claude configuration, install it the way you would any tool with write access to your dotfiles: read the repo first, and prefer pipx so it lives in its own isolated environment.
  • Nothing here is required for Claude Code to work. The 88 built-in commands above are complete on their own.

Install

1

Install the package

pipx is recommended — it isolates the dependency tree instead of putting it in your system Python.

# Recommended pipx install SuperClaude # Or with pip, into your user site-packages pip install --user SuperClaude
2

Run the installer

This is the step that actually writes the 30 commands into your Claude Code configuration. Installing the package alone does nothing.

SuperClaude install
3

Optionally add MCP servers

SuperClaude mcp --list

Optional extras. Each MCP server is executable code you are choosing to trust — review before enabling.

4

Verify inside Claude Code

Restart Claude Code, then run /sc to list everything it added, or try /sc:brainstorm.

/sc # list all SuperClaude commands /sc:help # SuperClaude's own help /sc:analyze # the command you were probably after

The 30 /sc: commands

Group Command Purpose
Plan/sc:brainstormStructured brainstorming from multiple perspectives.
Plan/sc:designSystem design and architecture planning.
Plan/sc:estimateEffort and time estimation.
Plan/sc:spec-panelMulti-expert specification analysis.
Plan/sc:workflowCustom workflow automation.
Build/sc:implementCode implementation workflows.
Build/sc:buildBuild and compilation workflows.
Build/sc:testTesting workflows and test generation.
Improve/sc:improveCode improvement suggestions.
Improve/sc:cleanupCleanup and refactoring.
Analyse/sc:analyzeCode and architecture analysis. The one people mistake for a built-in.
Analyse/sc:troubleshootDebugging and troubleshooting.
Analyse/sc:explainCode explanation.
Analyse/sc:reflectReflection and retrospectives.
Analyse/sc:researchDeep web research with parallel search.
Document/sc:documentDocumentation generation.
Manage/sc:gitGit operations and workflows.
Manage/sc:pmProject-management workflows.
Manage/sc:taskTask management and tracking.
Manage/sc:business-panelMulti-expert business analysis.
Agents/sc:agentSpecialised AI agents.
Agents/sc:spawnSpawn parallel tasks.
Agents/sc:select-toolTool selection guidance.
Context/sc:index-repoRepository indexing for context optimisation.
Context/sc:indexAlias for /sc:index-repo.
Context/sc:loadLoad a saved session.
Context/sc:saveSave the current session.
Meta/scList every SuperClaude command.
Meta/sc:helpCommand help and usage.
Meta/sc:recommendSuggests which command to reach for.
Do you actually need it?

Several /sc: commands overlap with built-ins — /sc:research against /deep-research, /sc:improve against /simplify, /sc:agent against /agents. Try the built-in first; it needs no install and no trust decision.

Re-run after upgrades

Upgrading the package does not rewrite the installed command files. Run SuperClaude install again after pipx upgrade SuperClaude.

Python, not npm

Claude Code is Node; SuperClaude is Python 3.10+ from PyPI. If pipx is missing, brew install pipx then pipx ensurepath.

It writes to your config

The installer places files in your Claude Code configuration directory. Back it up first if you have hand-tuned settings, hooks or custom skills you would not want overwritten.

What Claude Code Can Generate On The Fly

There are three different mechanisms, and the difference matters

People ask "what file types does it support?" as if there were a fixed list. There isn't — because Claude Code generates files three distinct ways, with very different requirements.

  • Directly, via the Write tool — any text-based format. Nothing to install, no code executed.
  • By writing and running a script — every binary format. The library does the work, so it must be installed.
  • Via a document skill — docx, pdf, pptx, xlsx. These are plugin-provided, not bundled with Claude Code — they encode the format gotchas so the generated script is correct first time.
How Formats Requirements & notes
Write tool.md .txt .csv .tsv .json .yaml .toml .xml .html .svg .css .js .ts .py .sh .sql .env .ini .ipynb — and any other plain-text formatNothing required. Claude writes the bytes directly. This covers most day-to-day output: reports in Markdown, data as CSV or JSON, charts as inline SVG, dashboards as a single HTML file.
Script.xlsx .xlsm .xltxPython openpyxl for formulas, formatting and charts; pandas for bulk data in and out. Real Excel formulas, multiple sheets, conditional formatting and native charts are all achievable.
Script.pdfCreate, merge, split, rotate, watermark, encrypt, fill forms, extract text and tables, OCR scanned pages. Also reachable by rendering HTML to PDF.
Script.docx .dotxCreated with the docx npm library or python-docx. Headings, tables of contents, page numbers, letterheads, tracked changes and comments are all supported. Editing an existing file means unzip → edit XML → rezip, because docx-js cannot open one.
Script.pptx .potxpptxgenjs to create; unzip-and-edit to modify an existing deck or build from a template. Speaker notes and layouts included.
Script.zip .tar .tar.gzShell zip/tar, or Python zipfile/tarfile. Useful for bundling a generated report with its data and charts.
Script.png .jpg .webp .gifChart images from matplotlib or plotly; image manipulation with Pillow. Note these are rendered, not drawn — Claude writes plotting code, it does not paint pixels.
Script.parquet .db .sqlite .featherpandas, pyarrow, sqlite3. Sensible when a CSV has outgrown being a CSV.

Reports from a CSV or dataset

The pattern that works

Hand Claude a CSV and ask for a report and it will do something reasonable. Ask in this shape and it will do the right thing:

"Analyse sales.csv with pandas — don't read it into context. Produce a single-file HTML report with revenue by region, month-over-month trend, and the top 10 accounts. Charts inline as SVG. Flag any rows with missing or negative amounts."

That names the tool, the constraint, the deliverable, the sections and the data-quality check — which is the difference between a report you use and one you re-request.

Report type Good for Best output format
Exploratory summaryShape, dtypes, null counts, cardinality, outliers, describe() — "what am I even looking at".Markdown
Data-quality auditDuplicates, malformed rows, impossible values, inconsistent categories, mixed types in one column.Markdown + a CSV of the offending rows
DashboardKPI tiles, charts, filterable tables — something to actually look at.Single-file HTML with inline SVG
Pivot / cross-tabGroup-by summaries across two or more dimensions.XLSX with real formulas, or Markdown
Time seriesTrends, seasonality, moving averages, period-over-period deltas.HTML or PNG charts
Executive one-pagerFindings and recommendations, minimal chart furniture.PDF or DOCX
ReconciliationDiffing two datasets — what is new, missing, or changed.XLSX, one sheet per bucket
Recurring/scheduledThe same report on new data each period.A committed script, not a one-off answer

The limits that actually bite

Context is the real constraint — not file size
  • Reading a large CSV into context is the mistake. A 50 MB file will exhaust the context window and produce a worse answer than a five-line pandas script would.
  • Say "analyse it with pandas, don't read it into context". Claude then works on the whole dataset regardless of size, because the file never enters the conversation.
  • Read the file directly only to inspect its shape — headers, a few sample rows, a delimiter check.
  • There is no meaningful upper bound on data processed this way — the limit is your machine's memory and patience, not Claude's.
Hard format limits
  • XLSX: 1,048,576 rows × 16,384 columns per sheet. That is the Excel file format itself, not a Claude limit — exceed it and you need multiple sheets, or Parquet.
  • Excel cells cap at 32,767 characters, and a formula at 8,192.
  • CSV has no format limit at all; the limit is whatever opens it afterwards.
  • Very large single-file HTML dashboards get sluggish in the browser well before they get large on disk — paginate or aggregate.
Environment limits
  • Binary formats need the library present. No openpyxl, no XLSX. Claude will offer to install it, which is a permission prompt, not magic.
  • Sandbox and permission settings govern where files may be written. The default workspace-write preset confines writes to the workspace and temp directories.
  • The docx, pdf, pptx and xlsx skills are plugin-provided, not bundled. Without them the formats are still generatable — you just lose the encoded gotchas, so expect more iterations.
  • Long-running scripts can hit a tool timeout. For genuinely heavy jobs, have Claude write the script and run it yourself in the background.
Judgement limits
  • Claude cannot see the rendered output. It writes plotting code; it does not look at the chart. Overlapping labels, clipped legends and terrible colour choices go unnoticed unless you look or ask it to screenshot the result.
  • Statistical conclusions deserve the same scepticism as any generated code — check the aggregation logic, especially group-bys, joins and date handling.
  • Timezone and date-parsing bugs are the single most common defect in generated data reports. Ask explicitly what timezone the dates are in.
Ask for one self-contained HTML file

Inline the CSS, JS and SVG. You get a report you can email, archive or open in five years with no build step and no broken asset links.

Ask for the script, not just the answer

For anything you will run again, the script is the deliverable. Commit it and next month's report is one command instead of one conversation.

Use /dataviz first

The bundled skill loads chart-design guidance — form, colour, accessibility — before any chart code is written. Noticeably better output than asking cold.

Demand a data-quality pass

Always ask what it had to assume or discard. Silently dropped nulls and coerced types are how a confident report ends up wrong.

Claude Code tips — recommendations from Boris Cherny

Boris Cherny leads Claude Code at Anthropic and has given several talks packed with the kind of tips that don't make it into the reference docs. This tab captures those recommendations — but a talk is a snapshot, and Claude Code ships constantly.

Every item below was re-checked against the current official docs before publishing, and corrected where behaviour has moved on. Three did: one shortcut's exact behaviour was more specific than the one-line summary in the slide, one no longer appears in the current docs at all, and one command wasn't found anywhere in the current documentation. Each is flagged plainly rather than silently corrected, so you know which parts to trust at a glance and which to verify yourself.

Interlude: Keybindings

Combo What it actually does
Shift+TabCycles permission modes — default (labelled Manual) → acceptEdits → plan → bypassPermissions → auto, then back to default. "Auto-accept edits" is one stop on that cycle, not the whole feature.
! at the start of a lineShell mode — runs the command directly, adds its output to the session, and Claude responds to it.
@Triggers file-path autocomplete to add a file or directory to context.
EscInterrupts whatever is running.
Esc Esc (double)With text in the input: clears it and saves the draft to history (↑ recalls it). With an empty input: opens the rewind menu to restore or summarise code and conversation from an earlier point in this session. claude --resume is a separate thing — a CLI flag for picking a past session to resume when starting fresh, not what double-Esc does.
Ctrl+RReverse-searches your prompt history — bash-style. For the detailed, verbose view of tool calls and execution, that's Ctrl+O (toggle transcript viewer) instead.
Two items from the talk, flagged rather than silently dropped
  • # to create a memory — this was a genuine, well-known shortcut in earlier Claude Code versions. It does not appear in the current docs' list of input-start triggers (/, !, @, :, ?). It may still work as undocumented legacy behaviour — try it — but don't build a habit or a team doc around something that isn't guaranteed anymore. The current, documented path is /memory, or simply telling Claude "remember that…" or "add this to CLAUDE.md."
  • /vibe — not found anywhere in the current official documentation. It reads as a demo easter egg from the talk rather than a supported command. Type /help in a session for the live, authoritative list instead of trusting this — or any — cheatsheet.

Give Claude more context: the memory hierarchy

Four levels, concatenated — not overridden

A common mental model is that a more specific CLAUDE.md "wins" over a broader one, like CSS specificity. That's not how it works: every applicable file is concatenated into context, ordered broadest-to-narrowest, so a project instruction is simply read after a user instruction — both are present.

Scope Location Shared with
Managed policy/Library/Application Support/ClaudeCode/CLAUDE.md (macOS) · /etc/claude-code/CLAUDE.md (Linux/WSL) · C:\Program Files\ClaudeCode\CLAUDE.md (Windows)Every user in the org, every project — deployed via MDM/Group Policy/Ansible, not editable per-user
User~/.claude/CLAUDE.mdJust you, across all your projects
Project./CLAUDE.md or ./.claude/CLAUDE.mdThe whole team, via source control
Local./CLAUDE.local.mdJust you, this project — gitignore it
Worth knowing
  • Type # at any time (if it still works for you — see above) or ask directly to add something quickly; run /init to generate a starting CLAUDE.md from your codebase.
  • Beyond hand-written CLAUDE.md files, Claude Code also keeps auto memory — notes it writes itself about your corrections and preferences, stored per-project at ~/.claude/projects/<project>/memory/ and loaded automatically. Browse or edit it with /memory.
  • Run /context in any session to see exactly which memory files actually loaded — the fastest way to debug "why isn't Claude following my instructions."
  • One thing from the talk worth naming honestly: a demo showed a Claude-team-internal ~/.claude/ULTRACLAUDE.md as an "[ANT-ONLY]" tier. That's exactly what the label says — an internal Anthropic mechanism, not a public product feature. It won't do anything special on your machine; it's here for accuracy about what was on screen, not as something to set up.

Share configuration with your team

What Managed policy User (just you) Project (shared) Project (local, just you)
Memory/Library/…/ClaudeCode/CLAUDE.md~/.claude/CLAUDE.mdCLAUDE.mdCLAUDE.local.md
Slash commands—~/.claude/commands/.claude/commands/—
Permissionsmanaged-settings.json~/.claude/settings.json.claude/settings.json.claude/settings.local.json
MCP servers—claude mcp add -s user.mcp.jsonclaude mcp add (default scope)
The one real correction in this table
  • Slash commands have technically merged into skills — a file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and work identically. Existing commands/ files keep working, so the table above is still accurate — just know skills are where new capability is landing.
  • MCP has three real scopes, and "user" is easy to misread as "global default." local (the default, no flag needed) is private to you and to the current project; project lives in .mcp.json and is genuinely shared via git; user is private to you but follows you to every project. When the same server is defined in more than one scope, local wins, then project, then user.

Running several Claude Code sessions at once

The one-line version now exists

The talk's "4 ways to run Claude in parallel" are all still valid — but the git-worktrees option has since gotten a proper built-in flag, and there's now a dedicated view for watching every session at once. If you take one thing from this section, take this:

# Start an isolated parallel session on its own branch and worktree — # one command, no manual git worktree add: claude --worktree feature-auth # Run it again with a different name, in a second terminal, for a # second concurrent session. Needs at least one commit in the repo first.
Approach Notes
1. Multiple checkouts, separate terminal tabsSimplest to understand; most disk and setup overhead. Each checkout is a fully independent copy.
2. One checkout, git worktreesThe modern version of this is a single command — claude --worktree <name> — which creates and manages the worktree for you.
3. SSH + tmuxStill legitimate for a remote box. On your own machine, background agents (below) largely replace the need for this.
4. GitHub Actions, parallel jobsRight tool for CI-triggered, repo-event-driven parallelism rather than interactive sessions.
5. Background agents (newer than the talk)Monitor several full sessions from one screen instead of juggling terminals — the direct answer to "how do I keep track of all these parallel sessions."