Session/headless commands, flags, and configuration reference for Anthropic's Claude Code CLI.
| 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
|
- Native install auto-updates in the background — the only one of the three that does.
- Homebrew does not auto-update. Run
brew upgrade claude-codeyourself. Two casks exist:claude-code(stable, ~a week behind) andclaude-code@latest(ships immediately). - WinGet does not auto-update either — run
winget upgrade Anthropic.ClaudeCodeperiodically. - On Debian/Fedora/RHEL/Alpine,
apt,dnf, andapkpackages 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_KEYis already set, it skips straight to approving the key instead.
| 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
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)
Constraint Phrases (A–Z)
Output Contracts (A–Z)
Reasoning Depth (A–Z)
Verification Demands (A–Z)
Context Anchors (A–Z)
Top 20 High-Signal CLAUDE.md Entries (A–Z)
Cool Tips & Tricks
/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.
claude --bare -p "does this handle null inputs?" < src/parse.ts
Docs note this will become the default for -p.
Shift+Tab → plan | /plan fix the auth bug
/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.
claude agents to watch them all from one screen.
claude -w feature-auth --bg "implement the token refresh"
! 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.
claude -p --max-budget-usd 3.00 --max-turns 10 "triage this failure"
--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
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 testis broken and you usepytest -x. - Cut the derivable: directory listings, dependency lists, and architecture overviews belong in the codebase, not in permanent context.
/doctorwill 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
/memoryto edit and restart to apply.
Match the mode to the blast radius, not to your patience:
- Exploring an unfamiliar repo:
planmode. Claude reads and proposes, nothing is written. - Normal feature work:
acceptEditsorauto, with a project allowlist so read-only commands stop prompting. Build it with/fewer-permission-prompts. - Unattended CI:
--strict-mcp-config, an explicit--toolslist,--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.
Context quality degrades long before the window is full. Defaults worth adopting:
- New task, new session.
/clearbeats fighting drift from an unrelated conversation. Project memory survives. - Name sessions you'll come back to with
-nor/rename, so/resumeis a list of tasks rather than a list of timestamps. - Branch instead of arguing. Trying a second approach?
/branchpreserves the first so you can compare rather than reconstruct. - Review before you ship:
/diffto see it,/code-reviewfor correctness,/security-reviewfor vulnerabilities.
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 | /recap | One-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 | /exit | Exit the CLI, or detach from a background session. |
| Help & status | /help | Show help and available commands. |
| Help & status | /status | Current session status. |
| Help & status | /usage | Token usage and costs. |
| Help & status | /cost | Alias for /usage. |
| Help & status | /doctor | Setup checkup — diagnoses and fixes common issues. |
| Help & status | /insights | HTML report analysing recent sessions. |
| Help & status | /release-notes | View release notes. |
| Help & status | /upgrade | Upgrade Claude Code or SDK dependencies. |
| Help & status | /bug [report] | Report a bug or share conversation context. |
| Help & status | /share | Alias for /bug. |
| Help & status | /feedback [report] | Send product feedback. |
| Help & status | /heapdump | Heap snapshot for diagnosing memory usage. |
| Config | /config [key=value] | Open Settings, or set preferences directly. |
| Config | /settings | Alias for /config. |
| Config | /permissions | Manage tool permission rules. |
| Config | /hooks | View hook configurations for tool events. |
| Config | /memory | Edit CLAUDE.md files and manage auto memory. |
| Config | /init | Initialise the project with a CLAUDE.md guide. |
| Config | /keybindings | Open the keyboard shortcuts file. |
| Config | /statusline | Configure the statusline display. |
| Config | /terminal-setup | Configure terminal integration. |
| Config | /vim | Toggle Vim keybindings. |
| Config | /theme [color] | Set the colour theme. |
| Config | /color [color|default] | Prompt-bar colour for this session. |
| Config | /sandbox | Manage sandboxed environments. |
| Config | /plugin [subcommand] | Manage Claude Code plugins. |
| Config | /import [codex|gemini] | Bring configuration in from another coding agent. |
| Config | /auto-mode-setup | Generate and configure autoMode environment entries. |
| Config | /privacy-settings | View 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 | /agents | Manage subagent configurations. |
| Agents | /subtask [prompt] | Hand a side task to a subagent. |
| Agents | /list-agents | List subagents and sessions Claude can message. |
| Agents | /tasks | List this session's background work. |
| Agents | /background [prompt] | Detach the session to run as a background agent. |
| Agents | /todos | Manage 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 | /diff | Interactive diff viewer for uncommitted changes. |
| Integrations | /ide | Manage IDE integrations and show status. |
| Integrations | /mcp [reconnect|enable|disable] | Manage MCP server connections. |
| Integrations | /chrome | Configure Claude in Chrome settings. |
| Integrations | /install-github-app | Install the Claude GitHub App for a repo. |
| Integrations | /install-slack-app | Install the Claude Slack app. |
| Integrations | /artifacts | List, attach, open or copy links to artifacts. |
| Integrations | /autofix-pr [prompt] | Spawn a cloud session to watch and fix a PR. |
| Integrations | /design-login | Authorise design-system access. |
| Cross-device | /desktop | Continue the session in the Desktop app. |
| Cross-device | /mobile | QR code to download the mobile app. |
| Cross-device | /teleport | Pull a web session into the terminal. |
| Cross-device | /remote-control | Continue a local session from another device. |
| Account | /login | Sign in to your Anthropic account. |
| Account | /logout | Sign out. |
| Account | /passes | Share a free week of Claude Code. |
| Skills | /code-review [level] [--fix] [--comment] | Review a diff or PR for bugs and cleanups. |
| Skills | /review | Alias for /code-review. |
| Skills | /security-review | Check the diff for security vulnerabilities. |
| Skills | /simplify [level] [--fix] | Improve readability and maintainability. |
| Skills | /verify | Verify 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-prompts | Scan transcripts and reduce permission prompts. |
| Extras | /btw [question] | Ask a side question without adding to history. |
| Extras | /focus | Toggle focus view for a cleaner display. |
| Extras | /powerup | Learn Claude Code features interactively. |
| Extras | /radio | Open Claude FM lo-fi radio. |
/code-review — every level, copy-paste ready
| 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
- 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
pipxso 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 the package
pipx is recommended — it isolates the dependency tree instead of putting it in your system Python.
Run the installer
This is the step that actually writes the 30 commands into your Claude Code configuration. Installing the package alone does nothing.
Optionally add MCP servers
Optional extras. Each MCP server is executable code you are choosing to trust — review before enabling.
Verify inside Claude Code
Restart Claude Code, then run /sc to list everything it added, or try /sc:brainstorm.
The 30 /sc: commands
| Group | Command | Purpose |
|---|---|---|
| Plan | /sc:brainstorm | Structured brainstorming from multiple perspectives. |
| Plan | /sc:design | System design and architecture planning. |
| Plan | /sc:estimate | Effort and time estimation. |
| Plan | /sc:spec-panel | Multi-expert specification analysis. |
| Plan | /sc:workflow | Custom workflow automation. |
| Build | /sc:implement | Code implementation workflows. |
| Build | /sc:build | Build and compilation workflows. |
| Build | /sc:test | Testing workflows and test generation. |
| Improve | /sc:improve | Code improvement suggestions. |
| Improve | /sc:cleanup | Cleanup and refactoring. |
| Analyse | /sc:analyze | Code and architecture analysis. The one people mistake for a built-in. |
| Analyse | /sc:troubleshoot | Debugging and troubleshooting. |
| Analyse | /sc:explain | Code explanation. |
| Analyse | /sc:reflect | Reflection and retrospectives. |
| Analyse | /sc:research | Deep web research with parallel search. |
| Document | /sc:document | Documentation generation. |
| Manage | /sc:git | Git operations and workflows. |
| Manage | /sc:pm | Project-management workflows. |
| Manage | /sc:task | Task management and tracking. |
| Manage | /sc:business-panel | Multi-expert business analysis. |
| Agents | /sc:agent | Specialised AI agents. |
| Agents | /sc:spawn | Spawn parallel tasks. |
| Agents | /sc:select-tool | Tool selection guidance. |
| Context | /sc:index-repo | Repository indexing for context optimisation. |
| Context | /sc:index | Alias for /sc:index-repo. |
| Context | /sc:load | Load a saved session. |
| Context | /sc:save | Save the current session. |
| Meta | /sc | List every SuperClaude command. |
| Meta | /sc:help | Command help and usage. |
| Meta | /sc:recommend | Suggests which command to reach for. |
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.
Upgrading the package does not rewrite the installed command files. Run SuperClaude install again after pipx upgrade SuperClaude.
Claude Code is Node; SuperClaude is Python 3.10+ from PyPI. If pipx is missing, brew install pipx then pipx ensurepath.
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
| 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 format | Nothing 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 .xltx | Python 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 | .pdf | Create, merge, split, rotate, watermark, encrypt, fill forms, extract text and tables, OCR scanned pages. Also reachable by rendering HTML to PDF. |
| Script | .docx .dotx | Created 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 .potx | pptxgenjs to create; unzip-and-edit to modify an existing deck or build from a template. Speaker notes and layouts included. |
| Script | .zip .tar .tar.gz | Shell zip/tar, or Python zipfile/tarfile. Useful for bundling a generated report with its data and charts. |
| Script | .png .jpg .webp .gif | Chart 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 .feather | pandas, pyarrow, sqlite3. Sensible when a CSV has outgrown being a CSV. |
Reports from a CSV or dataset
| Report type | Good for | Best output format |
|---|---|---|
| Exploratory summary | Shape, dtypes, null counts, cardinality, outliers, describe() — "what am I even looking at". | Markdown |
| Data-quality audit | Duplicates, malformed rows, impossible values, inconsistent categories, mixed types in one column. | Markdown + a CSV of the offending rows |
| Dashboard | KPI tiles, charts, filterable tables — something to actually look at. | Single-file HTML with inline SVG |
| Pivot / cross-tab | Group-by summaries across two or more dimensions. | XLSX with real formulas, or Markdown |
| Time series | Trends, seasonality, moving averages, period-over-period deltas. | HTML or PNG charts |
| Executive one-pager | Findings and recommendations, minimal chart furniture. | PDF or DOCX |
| Reconciliation | Diffing two datasets — what is new, missing, or changed. | XLSX, one sheet per bucket |
| Recurring/scheduled | The same report on new data each period. | A committed script, not a one-off answer |
The limits that actually bite
- 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.
- 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.
- 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-writepreset confines writes to the workspace and temp directories. - The
docx,pdf,pptxandxlsxskills 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.
- 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.
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.
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.
/dataviz firstThe bundled skill loads chart-design guidance — form, colour, accessibility — before any chart code is written. Noticeably better output than asking cold.
Always ask what it had to assume or discard. Silently dropped nulls and coerced types are how a confident report ends up wrong.
Interlude: Keybindings
| Combo | What it actually does |
|---|---|
Shift+Tab | Cycles 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 line | Shell 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. |
Esc | Interrupts 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+R | Reverse-searches your prompt history — bash-style. For the detailed, verbose view of tool calls and execution, that's Ctrl+O (toggle transcript viewer) instead. |
#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/helpin a session for the live, authoritative list instead of trusting this — or any — cheatsheet.
Give Claude more context: the memory hierarchy
| 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.md | Just you, across all your projects |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | The whole team, via source control |
| Local | ./CLAUDE.local.md | Just you, this project — gitignore it |
- Type
#at any time (if it still works for you — see above) or ask directly to add something quickly; run/initto generate a startingCLAUDE.mdfrom your codebase. - Beyond hand-written
CLAUDE.mdfiles, 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
/contextin 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.mdas 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.md | CLAUDE.md | CLAUDE.local.md |
| Slash commands | — | ~/.claude/commands/ | .claude/commands/ | — |
| Permissions | managed-settings.json | ~/.claude/settings.json | .claude/settings.json | .claude/settings.local.json |
| MCP servers | — | claude mcp add -s user | .mcp.json | claude mcp add (default scope) |
- Slash commands have technically merged into skills — a file at
.claude/commands/deploy.mdand a skill at.claude/skills/deploy/SKILL.mdboth create/deployand work identically. Existingcommands/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;projectlives in.mcp.jsonand is genuinely shared via git;useris 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
| Approach | Notes |
|---|---|
| 1. Multiple checkouts, separate terminal tabs | Simplest to understand; most disk and setup overhead. Each checkout is a fully independent copy. |
| 2. One checkout, git worktrees | The modern version of this is a single command — claude --worktree <name> — which creates and manages the worktree for you. |
| 3. SSH + tmux | Still legitimate for a remote box. On your own machine, background agents (below) largely replace the need for this. |
| 4. GitHub Actions, parallel jobs | Right 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." |
claude --worktree flag and other parallel-session patterns, straight from the source.
code.claude.com