# Claude Code — AI Coding Agent for the Terminal

> Anthropic's official AI coding agent: interactive or scripted sessions, MCP servers, subagents, plugins, worktrees and IDE integration.

Source: https://www.jpkc.com/db/en/cheatsheets/ai-cli/claude-code/

Claude Code is Anthropic's official agentic coding tool: it reads, writes and runs code right in your terminal, driven by the `claude` command. By default it opens an interactive session in the current directory; with `-p`/`--print` it turns into a scriptable, pipe-friendly one-shot tool. Beyond the CLI it also runs as a desktop and web app and as an IDE extension, and it taps the latest Claude models — currently Opus 5.5, Sonnet 5.5, Fable 5.1 and Haiku 5.5. This cheat sheet collects the flags, subcommands and slash commands you reach for every day, from session management, background and cloud sessions and permission modes to MCP servers, subagents, plugins and git worktrees. As of October 2026, Claude Code 2.1.294 — Claude Code moves fast, so a look at `claude --help` and `/help` pays off after every update.

## Basic Usage

`claude` — Start an interactive Claude Code session in the current directory.

```bash
claude
```

`claude "<prompt>"` — Start an interactive session with an initial prompt.

```bash
claude "Explain the architecture of this project"
```

`claude --version` — Show the installed Claude Code version.

```bash
claude --version
```

`claude --help` — Show all available options and commands.

```bash
claude --help
```

`claude update` — Check for updates and install the latest version if available. Alias: `claude upgrade`

```bash
claude update
```

`claude doctor` — Check the health of the installation without starting a session (reads settings files in the current directory without a trust prompt). For a full checkup that can also fix issues, run `/doctor` in a session.

```bash
claude doctor
```

`claude install [target]` — Install a specific Claude Code native build (stable, latest, or a version number). `--force` reinstalls even if it is already installed.

```bash
claude install stable
```

`claude purge [path]` — Delete all local Claude Code state for a project: transcripts, task lists, debug logs, file-edit history, prompt history lines and its entry in `~/.claude.json`. Without a path an interactive list opens; `--dry-run` previews, `-i` confirms each item, `-y` skips the confirmation, `--all` purges every project (cannot be combined with a path). Renamed from `claude project purge` in v2.1.288 (the old name still works and prints a notice).

```bash
claude purge --dry-run ~/projects/old-app
```

`claude gateway --config <path>` — Run the enterprise auth/telemetry gateway from a YAML config.

```bash
claude gateway --config ./gateway.yaml
```

`claude ultrareview [target]` — Run a cloud-hosted multi-agent code review of the current branch (or a PR number / base branch) and print the findings. `--post` posts them to the PR as one comment, `--json` prints the raw payload, `--timeout` sets the wait limit in minutes (default 45). In a session, use `/code-review ultra`.

```bash
claude ultrareview 42
```

`claude import [source]` — Import configuration from another AI coding agent — codex, gemini or cursor: instruction files, MCP servers, commands, subagents and skills. `--dry-run` shows what would be imported without writing anything.

```bash
claude import codex --dry-run
```

## Session Management

`claude -c` — Continue the most recent conversation in the current directory. Long: --continue

```bash
claude -c
```

`claude -r` — Open an interactive picker to resume a previous conversation, optionally filtered by a search term. Long: `--resume`

```bash
claude -r
```

`claude -r <session-id|name>` — Resume a specific conversation directly by its session ID or name.

```bash
claude -r "auth-refactor" "Finish this PR"
```

`claude -n <name>` — Set a display name for this session (shown in the prompt box, the `/resume` picker and the terminal title). Resume it later with `claude --resume <name>`. Long: `--name`

```bash
claude -n "refactor auth module"
```

`claude --fork-session` — When resuming, create a new session ID instead of continuing the original.

```bash
claude -c --fork-session
```

`claude --session-id <uuid>` — Use a specific UUID as the session ID.

```bash
claude --session-id 550e8400-e29b-41d4-a716-446655440000
```

`claude --from-pr <number>` — Resume a session linked to a pull request by number or URL; without a value, a picker opens.

```bash
claude --from-pr 42
```

## Background Sessions

`claude --bg "<prompt>"` — Start the session in the background and return immediately. Prints the short ID that `claude attach`, `logs`, `stop` and `rm` take; `claude agents` lists all sessions. With `--resume <session-id>`, continues that session in the background. Long: `--background`

```bash
claude --bg "Run the full test suite and summarize failures"
```

`claude agents` — Open agent view to monitor and dispatch parallel background sessions. In the view, `n:<text>` filters by session name or task (v2.1.287 or later); Ctrl+F finds a session by name, Enter opens the best match, and Alt+↑/↓ jumps between groups (v2.1.288 or later). `--cwd <path>` shows only sessions started under that directory; `--model`, `--effort` and `--permission-mode` set defaults for the sessions you dispatch.

```bash
claude agents --cwd ~/projects/app
```

`claude agents --json` — Print active sessions (interactive and background) as a JSON array for scripting; `--all` also includes completed background sessions.

```bash
claude agents --json --all
```

`claude attach <id|name>` — Open a background session in this terminal. Takes the short ID that `claude --bg` prints and `claude agents` lists, or part of the session name — quote names with spaces (v2.1.290 or later). ← returns to agent view, Ctrl+Z drops back to the shell; the session keeps running.

```bash
claude attach "auth refactor"
```

`claude logs <id|name>` — Print a background session's recent terminal output. Part of the session name works in place of the ID — quote names with spaces (v2.1.290 or later).

```bash
claude logs auth
```

`claude stop <id>` — Stop a background session. Its conversation is kept: `claude attach <id>` opens it again, and `claude --resume` works once it is stopped. Alias: `claude kill`

```bash
claude stop 7c5dcf5d
```

`claude rm <id>` — Delete a background session, and its worktree when that is safe. Works on sessions that have already exited.

```bash
claude rm 7c5dcf5d
```

`claude respawn <id>` — Restart a background session with its conversation intact so it runs the current Claude Code version; `--all` restarts every running session.

```bash
claude respawn --all
```

`claude --bg --exec '<command>'` — Run a shell command as a PTY-backed background job instead of starting a Claude session.

```bash
claude --bg --exec 'pytest -x'
```

`claude daemon status` — Print the background-session supervisor's state, version, socket directory and worker count for diagnostics.

```bash
claude daemon status
```

`claude daemon stop --any` — Stop the background-session supervisor and the sessions it hosts, to recover from a stuck supervisor; `--keep-workers` leaves the sessions running.

```bash
claude daemon stop --any --keep-workers
```

## Non-Interactive Mode (--print)

`claude -p "<prompt>"` — Print the response and exit. Non-interactive for scripting and pipes.

```bash
claude -p "What does this function do?" < src/utils.js
```

`echo "<prompt>" | claude -p` — Pipe a prompt into Claude and get a single printed response.

```bash
echo "Summarize this" | claude -p
```

`cat <file> | claude -p "<prompt>"` — Pipe file contents as context into a non-interactive prompt.

```bash
cat app.py | claude -p "Find security issues"
```

`claude -p --output-format json "<prompt>"` — Output the response as a single JSON object. Formats: text, json, stream-json.

```bash
claude -p --output-format json "List 3 refactoring tips"
```

`claude -p --output-format stream-json --verbose "<prompt>"` — Stream the response as newline-delimited JSON events in real time. With `-p`, stream-json also requires `--verbose`.

```bash
claude -p --output-format stream-json --verbose "Explain async/await"
```

`claude -p --json-schema '<schema>' "<prompt>"` — Validate output against a JSON Schema for structured, machine-readable responses.

```bash
claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' "Extract info"
```

`claude -p --max-budget-usd <amount> "<prompt>"` — Set a maximum spend limit in USD for this call.

```bash
claude -p --max-budget-usd 0.10 "Summarize these logs"
```

`claude -p --max-turns <n> "<prompt>"` — Limit the number of agentic turns; exits with an error when the limit is reached. No limit by default.

```bash
claude -p --max-turns 5 "Fix the failing test"
```

`claude -p --permission-prompts none "<prompt>"` — Deny every action that would need a permission prompt instead of waiting for an answer; the permission mode still decides everything else. The default `host` sends prompts to the SDK host or `--permission-prompt-tool`.

```bash
claude -p --permission-prompts none "Run the linter and fix what it finds"
```

`claude -p --permission-prompt-tool <mcp-tool> "<prompt>"` — Let an MCP tool answer permission prompts in non-interactive mode.

```bash
claude -p --permission-prompt-tool mcp__approver__check "Deploy to staging"
```

`claude -p --no-session-persistence "<prompt>"` — Don't save the session to disk (cannot be resumed).

```bash
claude -p --no-session-persistence "Quick question"
```

`claude --fallback-model <models>` — Automatically fall back to the specified model when the default is overloaded or unavailable. Takes a comma-separated list tried in order; the primary model is retried at the start of each user turn. Works in interactive sessions too; the `fallbackModel` setting makes it permanent.

```bash
claude -p --fallback-model sonnet,haiku "Generate unit tests"
```

`claude -p --input-format stream-json --output-format stream-json --verbose` — Bidirectional streaming JSON for integration with custom tools or orchestrators (stream-json output needs `--verbose`).

```bash
claude -p --input-format stream-json --output-format stream-json --verbose
```

`claude -p --include-partial-messages ...` — Emit partial message chunks as they arrive (requires `--output-format stream-json` and `--verbose`).

```bash
claude -p --output-format stream-json --verbose --include-partial-messages "Explain this"
```

`claude -p --include-hook-events ...` — Include all hook lifecycle events in the output stream (requires `--output-format stream-json` and `--verbose`).

```bash
claude -p --output-format stream-json --verbose --include-hook-events "Run the build"
```

`claude -p --replay-user-messages ...` — Re-emit user messages from stdin back on stdout for acknowledgment (stream-json in and out, plus `--verbose`).

```bash
claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages
```

`claude -p --prompt-suggestions "<prompt>"` — Emit a prompt_suggestion message after each turn predicting the next user prompt (requires `--output-format stream-json` and `--verbose`; very short conversations may produce none). `--prompt-suggestions=false` switches it off.

```bash
claude -p --output-format stream-json --verbose --prompt-suggestions "Refactor this module"
```

`claude -p --forward-subagent-text ...` — Forward subagent text and thinking blocks as their own messages with `parent_tool_use_id` set (requires `--output-format stream-json` and `--verbose`).

```bash
claude -p --output-format stream-json --verbose --forward-subagent-text "Audit the codebase"
```

## Model & Effort

`claude --model opus` — Use the latest Opus — Opus 5.5 on the Anthropic API (requires v2.1.280 or later). The aliases opus, sonnet, haiku and fable always point to the recommended version of their line; on other providers (Claude Platform on AWS, Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry) some resolve to older models, e.g. sonnet to Sonnet 4.5 or 4.6 and haiku to Haiku 4.5.

```bash
claude --model opus
```

`claude --model fable` — Use Claude Fable 5.1 (v2.1.257 or later), the most capable model, for the hardest and longest-running tasks. Depending on your plan, Fable usage can bill to usage credits.

```bash
claude --model fable
```

`claude --model sonnet` — Use the latest Sonnet — Sonnet 5.5 on the Anthropic API (v2.1.284 or later), for everyday coding.

```bash
claude --model sonnet
```

`claude --model haiku` — Use the latest Haiku — Haiku 5.5 on the Anthropic API (v2.1.293 or later), the fastest and most cost-efficient model, for simple tasks; 1M context, default effort medium. Other providers still resolve haiku to Haiku 4.5.

```bash
claude --model haiku
```

`claude --model best` — Use the most capable model available to you: Fable where you have access, otherwise the same model as opus.

```bash
claude --model best
```

`claude --model opusplan` — Use Opus while in plan mode, then switch to Sonnet for execution.

```bash
claude --model opusplan
```

`claude --model 'opus[1m]'` — Request the 1M-token context window explicitly (sonnet[1m] likewise). Only needed for models that reach 1M only through a `[1m]` variant, such as Opus 4.6 or Sonnet 4.6; Opus 4.7+, Sonnet 5+, Haiku 5.5 and Fable already run with 1M natively on the Anthropic API and behind gateways (Opus 4.7+ and Fable also on Bedrock, Vertex and Foundry since v2.1.287).

```bash
claude --model 'opus[1m]'
```

`claude --model <full-model-id>` — Use a specific model by its full ID. Current: `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-fable-5-1`, `claude-haiku-5-5`; older ones such as `claude-opus-5`, `claude-fable-5` or `claude-haiku-4-5` (pinned snapshot `claude-haiku-4-5-20251001`) remain selectable.

```bash
claude --model claude-opus-5-5
```

`claude --effort <level>` — Set the effort level for this session: low, medium, high, xhigh, max — available levels depend on the model. `ultracode` starts at xhigh with ultracode (dynamic workflows) on. Not saved as a default.

```bash
claude --effort high "Perform a full security audit"
```

`claude --advisor <model>` — Enable the server-side advisor tool for this session, which consults a second model (fable, opus, sonnet or a full ID such as `claude-haiku-5-5`) at key moments. Haiku 5.5 can advise from v2.1.293; Haiku 4.5 can't.

```bash
claude --advisor opus
```

`claude --autocompact <auto|tokens>` — Set the auto-compact window for this session — auto, or 100k–1M tokens — without changing your saved settings.

```bash
claude --autocompact 500k
```

## Permission Modes & Tool Access

`claude --permission-mode manual` — Manual mode: asks before every action except reads. Its config value is `default`, which the CLI also accepts. Without a flag or `defaultMode` setting, non-interactive runs (`-p`) and the Agent SDK start in this mode.

```bash
claude --permission-mode manual
```

`claude --permission-mode acceptEdits` — Auto-accept file edits and common filesystem commands (`mkdir`, `touch`, `mv`, `cp`, `rm` …) inside the working directories; protected paths and anything outside still prompt.

```bash
claude --permission-mode acceptEdits
```

`claude --permission-mode plan` — Plan mode: propose changes but don't execute until approved.

```bash
claude --permission-mode plan
```

`claude --permission-mode auto` — Auto mode: a classifier reviews each action and approves safe ones without prompting. Since v2.1.284, new terminal and VS Code sessions start in auto mode on every plan and provider unless a flag or `defaultMode` says otherwise; where auto mode isn't available, they start in Manual. `Shift+Tab` cycles through the modes.

```bash
claude --permission-mode auto
```

`claude --permission-mode dontAsk` — Never prompt: anything that would need approval is denied automatically. Reads, read-only commands and calls matching your allow rules still run — made for CI with an exact allowlist.

```bash
claude --permission-mode dontAsk
```

`claude --permission-mode bypassPermissions` — Skip permission prompts entirely; deny rules and a few safeguards (ask rules, removal of critical paths) still apply. Only for isolated sandboxes.

```bash
claude --permission-mode bypassPermissions
```

`claude --dangerously-skip-permissions` — Same as `--permission-mode bypassPermissions`: skips permission prompts, while deny rules and a few safeguards still apply. Only for sandboxes with no internet access.

```bash
claude --dangerously-skip-permissions
```

`claude --allow-dangerously-skip-permissions` — Make 'bypass permissions' available as an opt-in mode without enabling it by default.

```bash
claude --allow-dangerously-skip-permissions
```

`claude --allowed-tools "<tools>"` — Tools that run without a permission prompt, with patterns such as `Bash(git *)`. To limit which tools exist at all, use `--tools`.

```bash
claude --allowed-tools "Bash(git *) Edit Read"
```

`claude --disallowed-tools "<tools>"` — Deny rules: a bare tool name removes the tool entirely, a scoped rule such as `Bash(rm *)` only denies matching calls.

```bash
claude --disallowed-tools "Bash(rm *) WebFetch"
```

`claude --tools "<tools>"` — Restrict which built-in tools exist in the session: `""` disables all, `"default"` restores the default set (which on macOS, Linux and WSL leaves out Glob and Grep unless you name them). MCP tools are not affected.

```bash
claude --tools "Read,Glob,Grep"
```

`claude --add-dir <path>` — Grant tool access to additional directories beyond the current working directory.

```bash
claude --add-dir ~/shared-libs --add-dir /etc/nginx
```

`claude --restricted` — Restricted mode for shared machines and evaluation harnesses: removes the built-in tools that run commands or code and WebFetch (unless `--tools` names them), ignores user, project and local settings files, confines the file tools to the working directories and refuses `bypassPermissions`.

```bash
claude --restricted -p "Review this diff"
```

## System Prompts & Agents

`claude --system-prompt "<prompt>"` — Override the default system prompt for this session.

```bash
claude --system-prompt "Reply only in German."
```

`claude --append-system-prompt "<prompt>"` — Append instructions to the default system prompt without replacing it.

```bash
claude --append-system-prompt "Always use Bootstrap 5."
```

`claude --system-prompt-file <path>` — Load the system prompt override from a file instead of an inline string.

```bash
claude --system-prompt-file ./prompts/reviewer.md
```

`claude --append-system-prompt-file <path>` — Append a system prompt loaded from a file to the default system prompt.

```bash
claude --append-system-prompt-file ./prompts/house-rules.md
```

`claude --brief` — Enable the SendUserMessage tool so an agent can send messages back to the user.

```bash
claude --brief
```

`claude --agent <agent-name>` — Run the session as the named agent — a subagent definition from `.claude/agents/`, a plugin or `--agents`. Overrides the `agent` setting.

```bash
claude --agent reviewer
```

`claude --agents '<json>'` — Define inline agents as JSON for the current session; with `--print`, a path to a JSON file also works.

```bash
claude --agents '{"tester":{"description":"Writes tests","prompt":"Write unit tests only"}}'
```

`claude --bare` — Minimal mode: skip hooks from settings and plugins, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads and CLAUDE.md discovery; sets `CLAUDE_CODE_SIMPLE=1`. Since v2.1.286 it connects only the MCP servers passed on the command line (`--mcp-config`), sends the model no system reminders and starts no background tasks; a shell command that hits its timeout stops instead of moving to the background. Anthropic auth is strictly `ANTHROPIC_API_KEY` or apiKeyHelper — OAuth and the keychain are never read; Bedrock, Vertex and Foundry use their own credentials. Provide context explicitly (`--system-prompt[-file]`, `--append-system-prompt[-file]`, `--add-dir`, `--mcp-config`, `--settings`, `--agents`, `--plugin-dir`).

```bash
claude --bare -p "Quick question" --mcp-config ./mcp.json
```

`claude --init-only` — Run the Setup and SessionStart hooks, then exit without starting a conversation — useful for CI and container images. `--init` and `--maintenance` run Setup hooks before a `-p` session.

```bash
claude --init-only
```

`claude --system-prompt-snapshot off` — Rebuild the system prompt on every request instead of reusing the one recorded at the start of the conversation (default `on`) — useful while iterating on prompt text.

```bash
claude --append-system-prompt "Draft rules" --system-prompt-snapshot off
```

`claude -p --append-subagent-system-prompt "<text>"` — Append text to every subagent's system prompt (print mode only; `--append-subagent-system-prompt-file` reads it from a file).

```bash
claude -p --append-subagent-system-prompt "Answer in German." "Audit the repo"
```

## Interactive Slash Commands: Session

`/help` — Show help and available commands.

```bash
/help
```

`/clear` — Start a new conversation with empty context; pass a name to label the previous one in the `/resume` picker. Aliases: `/reset`, `/new`

```bash
/clear
```

`/compact [instructions]` — Compact conversation to save context, with optional focus instructions.

```bash
/compact focus on the auth module changes
```

`/context [all]` — Visualize current context usage as a colored grid; `all` expands the per-item breakdown in fullscreen mode.

```bash
/context
```

`/resume [session]` — Resume a conversation by ID or name. Alias: /continue

```bash
/resume
```

`/branch [name]` — Branch the conversation at this point and switch into the branch; the original stays available through `/resume`.

```bash
/branch experiment-1
```

`/fork [prompt]` — Copy the conversation into a new background session and keep working here; with a prompt, the copy starts on it right away.

```bash
/fork try the alternative approach
```

`/subtask <task>` — Hand a side task to a forked subagent that inherits the full conversation; its result comes back into this conversation when it finishes.

```bash
/subtask write tests for the new parser
```

`/background [prompt]` — Detach the current session to run as a background agent and free this terminal. Alias: `/bg`

```bash
/background finish the test suite
```

`/goal [condition|clear]` — Set a goal: Claude keeps working until the condition is met. Useful for long autonomous runs.

```bash
/goal all tests pass and the linter is clean
```

`/cd <path>` — Move the running session to a different working directory.

```bash
/cd ~/projects/other-repo
```

`/teleport` — Pull a cloud session into this terminal, including its branch and conversation. Alias: `/tp`; requires a claude.ai subscription.

```bash
/teleport
```

`/rename [name]` — Rename the current session; without a name, one is generated from the conversation.

```bash
/rename auth-refactor
```

`/export [filename]` — Export the current conversation as plain text.

```bash
/export conversation.txt
```

`/recap` — Generate a one-line summary of the current session on demand.

```bash
/recap
```

`/stop` — Stop the background session you are attached to; the transcript and any worktree are kept. `/exit` only detaches.

```bash
/stop
```

`/exit` — Exit the CLI; in an attached background session it detaches and the session keeps running. Alias: `/quit`

```bash
/exit
```

## Interactive Slash Commands: Model & Tools

`/model [model]` — Switch the model and save it as your default for new sessions; in the picker, press `s` to switch for this session only.

```bash
/model opus
```

`/effort [level|auto|status|ultracode]` — Set the effort level: low, medium, high or xhigh (saved as the default for this model), max (this session only) or auto; `status` prints it. `ultracode [on|off]` switches ultracode — dynamic workflow orchestration — on or off for the session at the current level.

```bash
/effort ultracode on
```

`/advisor [model|off]` — Enable the advisor tool, which consults a second model (fable, opus, sonnet or a full ID such as `claude-haiku-5-5`) for guidance at key moments; `off` disables it. Experimental, Anthropic API only; fable requires Fable access.

```bash
/advisor opus
```

`/fast [on|off]` — Toggle fast mode: the same Opus model at up to 2.5x output speed for a higher price per token, with no downgrade to a smaller model. Supported on Opus 5.5 (fast mode's default since v2.1.280), Opus 5 and Opus 4.8; on subscription plans it bills to usage credits only. Toggled mid-turn, it takes effect from the next turn.

```bash
/fast on
```

`/usage` — Show session cost, plan usage limits and activity stats. Aliases: `/cost`, `/stats` (opens on the Stats tab)

```bash
/usage
```

`/permissions` — Manage allow, ask and deny rules, working directories and the auto mode rules. Alias: `/allowed-tools`

```bash
/permissions
```

`/tasks` — View and manage background work in the current session, including finished subagents. Alias: `/bashes`

```bash
/tasks
```

`/autocompact [auto|<tokens>]` — Set how full the context window gets before automatic compaction, e.g. `500k`, or `auto` to return to the window tuned for your model. Saved to user settings per model (under `modelSettings`), so each model keeps its own window when you switch (v2.1.288 or later).

```bash
/autocompact 500k
```

`/sandbox` — Toggle sandbox mode (supported platforms only).

```bash
/sandbox
```

## Interactive Slash Commands: Code & Git

`/diff` — Open interactive diff viewer showing uncommitted changes.

```bash
/diff
```

`/rewind` — Rewind the conversation and/or code to a previous point, or summarize from a selected message. Aliases: `/checkpoint`, `/undo`

```bash
/rewind
```

`/code-review [level] [--fix] [--comment] [target]` — Review the current diff — or a PR number, branch or path — for correctness bugs. Levels: low, medium, high, xhigh, max, or ultra (cloud-hosted multi-agent review that needs a claude.ai account; 3 free runs on Pro/Max, then usage credits; `/ultrareview` is an alias). `--fix` applies the findings, `--comment` posts them on the GitHub PR or GitLab merge request; `--max-findings <n>|all` reports more or fewer findings than the usual limit and is remembered until `--max-findings default` (v2.1.288 or later).

```bash
/code-review high --max-findings all
```

`/review [level] [--fix] [--comment] [target]` — Alias of `/code-review`, with the same levels, flags and targets.

```bash
/review 42
```

`/security-review` — Analyze the diff between your branch and origin's default branch for security vulnerabilities such as injection, auth issues and data exposure.

```bash
/security-review
```

`/copy [N]` — Copy the last (or Nth-latest) response to the clipboard; with code blocks, a picker opens where `w` writes the selection to a file.

```bash
/copy
```

`/btw [question]` — Ask a quick side question without adding it to the conversation; without a question, browse your earlier side answers.

```bash
/btw what's the syntax for a ternary in PHP?
```

## Interactive Slash Commands: Configuration

`/config [key=value ...]` — Open the settings (theme, model, output style, editor mode and more) or set values directly, e.g. `/config theme=dark`. The Vim editing mode lives here now; `/vim` was removed. Alias: `/settings`

```bash
/config model=sonnet
```

`/status` — Open the settings on the Status tab: version, model, account and connectivity.

```bash
/status
```

`/theme` — Change the color theme: auto (follows the terminal background), light and dark variants, colorblind-accessible and ANSI themes, and custom themes.

```bash
/theme
```

`/color [color|default]` — Set the prompt bar color: red, blue, green, yellow, purple, orange, pink or cyan; `default` resets it, no argument picks a random color.

```bash
/color blue
```

`/voice [hold|tap|off]` — Toggle voice dictation or pick a mode: hold, tap or off. Requires a Claude.ai account.

```bash
/voice tap
```

`/keybindings` — Open or create keybindings configuration file.

```bash
/keybindings
```

`/terminal-setup` — Set up the newline key for your terminal: Shift+Enter in VS Code, Cursor, Alacritty or Zed; Option+Enter in Apple Terminal; clipboard access in iTerm2.

```bash
/terminal-setup
```

`/tui [default|fullscreen]` — Set the terminal UI renderer and relaunch into it with the conversation intact: `fullscreen` (flicker-free alt-screen renderer, saved as the `tui` setting — `CLAUDE_CODE_NO_FLICKER=1` does the same for a single launch) or `default`. Without an argument, prints the active renderer.

```bash
/tui fullscreen
```

`/statusline` — Configure Claude Code's status line (or auto-configure from shell prompt).

```bash
/statusline
```

`/focus` — Toggle the focus view: only your last prompt, a one-line tool summary and the final response (fullscreen rendering only).

```bash
/focus
```

`/debug [description]` — Enable debug logging for the current session and troubleshoot issues.

```bash
/debug mcp server keeps disconnecting
```

`/heapdump` — Write a JavaScript heap snapshot and a memory breakdown to `~/Desktop` (or your home directory) for diagnosing memory usage. Hidden from the menu — type it in full; share only the `-diagnostics.json` file.

```bash
/heapdump
```

`/memory` — Edit CLAUDE.md, enable/disable auto-memory, view auto-memory entries.

```bash
/memory
```

`/output-style [style]` — List output styles or switch to one.

```bash
/output-style concise
```

`/init` — Initialize the project with a CLAUDE.md guide; `CLAUDE_CODE_NEW_INIT=1` starts an interactive flow that also covers skills, hooks and personal memory files.

```bash
/init
```

`/hooks` — View hook configurations for tool events.

```bash
/hooks
```

`/reload-skills` — Re-scan skill and command directories so skills added or changed on disk become available without a restart.

```bash
/reload-skills
```

`/add-dir <path>` — Add a new working directory to the current session.

```bash
/add-dir ~/other-project
```

## Interactive Slash Commands: Integrations

`/mcp [reconnect <server>|enable|disable]` — Manage MCP server connections and OAuth; `reconnect <server>` or `enable`/`disable` with a server name or `all` act without opening the dialog.

```bash
/mcp reconnect sentry
```

`/ide` — Manage IDE integrations (VS Code, JetBrains) and show status.

```bash
/ide
```

`/chrome` — Configure Claude in Chrome integration.

```bash
/chrome
```

`/plugin [subcommand]` — Manage Claude Code plugins: the menu without an argument, or `list`, `install`, `enable`, `disable` directly.

```bash
/plugin
```

`/reload-plugins [--force]` — Reload all active plugins to apply pending changes without restarting; if the reload would change MCP tools and invalidate the prompt cache, it warns and skips unless you pass `--force`.

```bash
/reload-plugins
```

`/skills` — List available skills; filter by typing, sort by token cost with `t`, and toggle what Claude and the `/` menu see.

```bash
/skills
```

`/skill-doctor` — Show what each skill costs in context and how often it is used, to find skills worth turning off.

```bash
/skill-doctor
```

`/agents` — Since v2.1.198 only a reminder: ask Claude to create or manage subagents, or edit `.claude/agents/` or `~/.claude/agents/` directly.

```bash
/agents
```

`/plan [description]` — Enter plan mode directly from the prompt.

```bash
/plan refactor the authentication module
```

`/schedule [description]` — Create, update, list or run routines, which execute in the cloud; requires a claude.ai subscription. Alias: `/routines`

```bash
/schedule
```

`/import [codex|gemini|cursor]` — Bring instruction files, MCP servers, commands, subagents and skills over from OpenAI Codex, Gemini CLI or Cursor.

```bash
/import cursor
```

`/remote-env` — Choose the default cloud environment for cloud sessions you start from the CLI.

```bash
/remote-env
```

`/web-setup` — Connect your GitHub account for cloud sessions using your local `gh` credentials.

```bash
/web-setup
```

`/workflows` — Open the workflow progress view to watch, pause, resume or save running and completed workflows.

```bash
/workflows
```

`/artifacts` — List the artifacts you own or that are shared with you, then attach one to the session, open it in the browser or copy its link (where artifacts are available).

```bash
/artifacts
```

`/list-agents` — List the subagents, teammates and other sessions Claude can message, with the name to use for each (cross-session messaging only). Alias: `/peers`

```bash
/list-agents
```

## Interactive Slash Commands: Account & Info

`/login` — Sign in to your Anthropic account.

```bash
/login
```

`/logout` — Sign out from your Anthropic account.

```bash
/logout
```

`/doctor` — Skill: a setup checkup that diagnoses issues and can fix them — installation, settings files, unused skills, MCP servers and plugins, slow hooks, updates; asks before changing anything. `/doctor prompt-audit` checks CLAUDE.md and skills for outdated or conflicting instructions. Alias: `/checkup`

```bash
/doctor
```

`/insights` — Generate an HTML report analyzing your recent sessions on this machine: projects, usage patterns, what goes wrong and features to try.

```bash
/insights
```

`/release-notes` — Browse the changelog in an interactive version picker.

```bash
/release-notes
```

`/feedback [report]` — Send feedback or report a bug: opens the same consent dialog as `/bug`, where you choose how much session history to include. Without an argument, it opens the queue of feedback Claude has drafted, if there is any.

```bash
/feedback
```

`/bug [report]` — Report a bug or share your conversation; you choose how much session history to include and confirm before anything is sent. Without Anthropic credentials the report is written to `~/.claude/feedback-bundles/`. Alias: `/share`

```bash
/bug the diff viewer freezes on large files
```

`/desktop` — Continue the current session in the Claude Code Desktop app (macOS or x64 Windows, Claude subscription). Alias: `/app`

```bash
/desktop
```

`/mobile` — Show QR code to download Claude mobile app. Aliases: /ios, /android

```bash
/mobile
```

`/remote-control` — Make the session available for Remote Control from claude.ai (claude.ai subscription; not with API keys). Alias: `/rc`

```bash
/remote-control
```

`/install-github-app` — Install the Claude GitHub App for a repository, optionally with GitHub Actions workflows and secrets (github.com only).

```bash
/install-github-app
```

`/usage-credits` — Configure usage credits — or request them from your admin — when you hit a limit (formerly `/extra-usage`, which still works).

```bash
/usage-credits
```

`/rate-limit-options` — Show ways to keep working when a usage limit blocks a request: wait and continue automatically, add usage credits, or upgrade your plan (claude.ai subscription).

```bash
/rate-limit-options
```

`/team-onboarding` — Generate an onboarding guide for teammates from your Claude Code usage over the past 30 days.

```bash
/team-onboarding
```

`/powerup` — Discover Claude Code features through quick interactive lessons with animated demos.

```bash
/powerup
```

`/upgrade` — Open the upgrade page to switch to a higher plan.

```bash
/upgrade
```

`/privacy-settings` — View and update your privacy settings (Pro and Max).

```bash
/privacy-settings
```

`/setup-bedrock` — Interactive wizard for Amazon Bedrock authentication, region and model pins; hidden until `CLAUDE_CODE_USE_BEDROCK=1` is set (`/setup-vertex` likewise for Google Cloud with `CLAUDE_CODE_USE_VERTEX=1`).

```bash
/setup-bedrock
```

## Bundled Skills & Workflows

`/batch <instruction>` — Orchestrate large-scale changes across the codebase in parallel.

```bash
/batch replace all deprecated API calls with the v2 equivalent
```

`/loop [interval] [prompt]` — Run a prompt repeatedly while the session stays open. Without an interval the model paces itself; without a prompt it runs the built-in maintenance prompt or your `loop.md`. Alias: `/proactive`

```bash
/loop 5m check whether the deploy finished
```

`/verify` — Confirm a change does what it should by building, running and observing your project's app instead of relying on tests alone (runs only when you invoke it).

```bash
/verify
```

`/run` — Launch and drive your project's app to see a change working, not only passing tests.

```bash
/run
```

`/run-skill-generator` — Teach `/run` and `/verify` how to build, launch and drive your project's app by writing a per-project skill.

```bash
/run-skill-generator
```

`/claude-in-chrome [task]` — Have Claude carry out a task in your browser — test a page, fill a form, read console logs — through Claude in Chrome.

```bash
/claude-in-chrome check the signup form for console errors
```

`/simplify [target]` — Four parallel review agents look for reuse of existing helpers, simplification, efficiency and the right level of abstraction, then apply the fixes. No bug hunting — that is `/code-review`.

```bash
/simplify src/auth/
```

`/update-config [request]` — Describe a settings change — allow a command, set an environment variable, add a hook — and Claude edits the matching settings.json.

```bash
/update-config allow npm test without asking
```

`/plugin-authoring [request]` — Load the reference Claude works from to write a mod: a live pane, band, status line, toast or hook inside Claude Code, built as a plugin of function hooks that hot-reloads in the running session. Claude also loads it on its own when you ask for a mod, and since v2.1.290 gives you the one command others run to install it. Requires v2.1.287 or later; it comes from a built-in plugin you can turn off in `/plugin`.

```bash
/plugin-authoring a mod that shows the current git branch above the prompt
```

`/claude-api [subcommand]` — Load Claude API and Managed Agents reference material for your project's language; subcommands such as `migrate` or `cost-optimize` focus it. Since v2.1.290, `managed-agents-onboard <url>` sets up the Managed Agents pattern a page describes as `ant apply` files, and `managed-agents-onboard <quickstart-name>` builds a Console quickstart such as `deep-researcher` with the `ant` CLI.

```bash
/claude-api managed-agents-onboard deep-researcher
```

`/design [brief]` — Draft UI mockups, screen flows or landing pages as artboards on a Claude Design canvas (needs a session where artifacts are available).

```bash
/design a settings screen for a mobile banking app
```

`/slides [brief]` — Make a new presentation as a Claude Slides artifact filled from your brief (needs a session where artifacts are available).

```bash
/slides a quarterly review of the platform team
```

`/fewer-permission-prompts` — Scan your transcripts for common read-only Bash and MCP calls and add a prioritized allowlist to the project's `.claude/settings.json`.

```bash
/fewer-permission-prompts
```

`/dataviz [request]` — Design guidance for charts, graphs and dashboards.

```bash
/dataviz a bar chart comparing quarterly revenue
```

`/deep-research <question>` — Workflow: fan out web searches, cross-check sources and write a cited report. Requires the WebSearch tool; on Pro, turn on dynamic workflows in `/config` first.

```bash
/deep-research how do European accessibility laws differ from WCAG?
```

`/autofix-pr [prompt]` — Spawn a cloud session that watches the current branch's PR and pushes fixes when CI fails or reviewers leave comments (requires the gh CLI and access to cloud sessions).

```bash
/autofix-pr
```

## MCP Servers

`claude mcp list` — List all configured MCP (Model Context Protocol) servers.

```bash
claude mcp list
```

`claude mcp add <name> -- <command> [args...]` — Add a stdio MCP server as a subprocess.

```bash
claude mcp add my-server -- npx my-mcp-server --port 3000
```

`claude mcp add --transport http <name> <url>` — Add an HTTP/SSE MCP server by URL.

```bash
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
```

`claude mcp add <name> -e <KEY>=<val> -- <command>` — Add a stdio MCP server with environment variables. Put `-e` after the server name: it takes several pairs and would read a name that follows it as another pair.

```bash
claude mcp add my-server -e API_KEY=xxx -- npx -y my-mcp-server
```

`claude mcp add -s <scope> <name> ...` — Choose where the server is stored: `local` (default, only you in this project), `project` (shared through `.mcp.json`) or `user` (all your projects). Long: `--scope`

```bash
claude mcp add -s user --transport http sentry https://mcp.sentry.dev/mcp
```

`claude mcp add --transport http <name> <url> --header "Authorization: Bearer <token>"` — Add an HTTP MCP server with a custom auth header.

```bash
claude mcp add --transport http api https://api.example.com/mcp --header "Authorization: Bearer xxx"
```

`claude mcp add-json <name> '<json>'` — Add an MCP server (stdio, SSE, HTTP or WebSocket) from a full JSON config string.

```bash
claude mcp add-json myserver '{"type":"stdio","command":"npx","args":["my-server"]}'
```

`claude mcp get <name>` — Show full configuration details of a specific MCP server.

```bash
claude mcp get sentry
```

`claude mcp remove <name>` — Remove a configured MCP server.

```bash
claude mcp remove my-server
```

`claude mcp login <name>` — Run a configured server's OAuth flow without the `/mcp` panel (HTTP, SSE and claude.ai connectors); `--no-browser` prints the URL instead, for SSH.

```bash
claude mcp login sentry --no-browser
```

`claude mcp logout <name>` — Clear stored OAuth credentials for an MCP server.

```bash
claude mcp logout sentry
```

`claude mcp add-from-claude-desktop` — Import MCP servers from the Claude Desktop app (Mac and WSL only).

```bash
claude mcp add-from-claude-desktop
```

`claude mcp serve` — Start Claude Code itself as an MCP server (for integration with other tools).

```bash
claude mcp serve
```

`claude --mcp-config <path>` — Load additional MCP servers from a JSON config file for this session.

```bash
claude --mcp-config ~/.config/mcp-servers.json
```

`claude --strict-mcp-config --mcp-config <path>` — Only use MCP servers from the specified config, ignore all others.

```bash
claude --strict-mcp-config --mcp-config config.json
```

`claude mcp reset-project-choices` — Reset all approved/rejected project-scoped MCP server choices.

```bash
claude mcp reset-project-choices
```

## Authentication

`claude auth login` — Sign in to your Anthropic account (opens the browser). `--console` bills through the Anthropic Console instead of a Claude subscription, `--sso` forces SSO, `--email` pre-fills the address.

```bash
claude auth login
```

`claude auth logout` — Log out from the current Anthropic account.

```bash
claude auth logout
```

`claude auth status` — Show the current authentication status and active account — as JSON by default, or readable with `--text`.

```bash
claude auth status --text
```

`claude setup-token` — Set up a long-lived authentication token (requires Claude subscription).

```bash
claude setup-token
```

## Worktrees, IDE & Cloud

`claude -w` — Create a new git worktree for this session (isolated branch). Long: --worktree

```bash
claude -w
```

`claude -w <name>` — Create a named git worktree.

```bash
claude -w feature-refactor
```

`claude -w --tmux` — Create a worktree and open it in a new tmux session (iTerm2 native panes when available; --tmux=classic forces traditional tmux).

```bash
claude -w --tmux
```

`claude --ide` — Automatically connect to the IDE on startup if exactly one valid IDE is available.

```bash
claude --ide
```

`claude --cloud "<task>"` — Create a cloud session for the task; with a session ID or claude.ai/code URL (and `-p`), queue a message into an existing one instead. `--remote` is a deprecated alias.

```bash
claude --cloud "Fix the login bug"
```

`claude --environment <id>` — Create a new cloud session that runs on a self-hosted environment (IDs start with `ccpool_`).

```bash
claude -p "Fix the login bug" --environment ccpool_abc123
```

`claude --teleport [session]` — Resume a cloud session in your local terminal.

```bash
claude --teleport
```

`claude --desktop` — Open in the Claude Desktop app instead of the terminal, with `--continue` or `--resume <id>` to pick the session (v2.1.285+, macOS and x64 Windows only, Claude account sign-in required, no prompt argument).

```bash
claude --desktop --continue
```

`claude --remote-control [name]` — Start an interactive session with Remote Control enabled (optionally named) for control from claude.ai. Short: `--rc`; requires a claude.ai subscription.

```bash
claude --remote-control "laptop session"
```

`claude --remote-control-session-name-prefix <prefix>` — Set the prefix for auto-generated Remote Control session names (default: hostname).

```bash
claude --remote-control --remote-control-session-name-prefix laptop
```

`claude remote-control` — Start a Remote Control server without a local interactive session, to control Claude Code from claude.ai or the Claude app.

```bash
claude remote-control
```

## Plugins

`claude plugin list` — List all installed plugins (`claude plugins` works as an alias for the whole command group).

```bash
claude plugin list
```

`claude plugin install <plugin>` — Install a plugin from the available marketplaces; use `plugin@marketplace` for a specific one. `--marketplace <source>` (owner/repo, git or https URL, or a path) installs the bare plugin name from that marketplace, adding the marketplace to your user settings first if needed, under the same checks as `claude plugin marketplace add` (v2.1.292 or later). Alias: `i`

```bash
claude plugin install my-plugin --marketplace your-org/claude-plugins
```

`claude plugin enable <plugin>` — Enable a previously disabled plugin.

```bash
claude plugin enable my-plugin
```

`/plugin enable cc-plugin-you-should-know@builtin` — Turn on You should know, a built-in mod: a side agent watches longer tasks and shows a note above the prompt when it finds something you or Claude might miss (new in v2.1.287; off by default; first-party sessions with telemetry on, where available for your org).

```bash
/plugin enable cc-plugin-you-should-know@builtin
```

`claude plugin disable <plugin>` — Disable an installed plugin without removing it.

```bash
claude plugin disable my-plugin
```

`claude plugin update <plugin>` — Update a plugin to the latest version (restart required).

```bash
claude plugin update my-plugin
```

`claude plugin uninstall <plugin>` — Uninstall a plugin completely. Alias: `remove`

```bash
claude plugin uninstall my-plugin
```

`claude plugin validate <path>` — Validate a plugin or marketplace manifest, or the skills, agents and commands in a directory.

```bash
claude plugin validate ./my-plugin/
```

`claude plugin test [dir]` — Run a mod's tests: every `*.test.ts`/`*.test.tsx` under the folder (default: the current one), importing their kit from `claude-code/testing`. Runs from your shell with no session, sign-in or network, and exits 1 when a test fails. A mod is a plugin whose JavaScript/TypeScript event handlers change how Claude Code looks and behaves (mods are new in v2.1.287).

```bash
claude plugin test ./my-mod
```

`claude plugin eval [target]` — Run a plugin's eval cases (`evals/**/case.yaml` or `prompt.md` + `graders/*.md`) on your machine, as you, and report scored results, by default against a no-plugin baseline (each case runs 3 times; the HTML report goes to claude.ai unless you pass `--no-publish`). The target is a path, a plugin name or `plugin@marketplace`. Only evaluate plugins you trust; `--trust-plugin` answers the first-run prompt in CI.

```bash
claude plugin eval ./my-plugin
```

`claude plugin init <name>` — Scaffold a new plugin at `~/.claude/skills/<name>/`; it loads in the next session as `<name>@skills-dir`. Alias: `new`

```bash
claude plugin init my-helpers
```

`claude plugin details <name>` — Show a plugin's component inventory and projected token cost.

```bash
claude plugin details my-plugin
```

`claude plugin configure <plugin>` — Show a plugin's options and which are unset; `--values-stdin` saves new values from stdin (new in v2.1.285).

```bash
claude plugin configure my-plugin
```

`claude plugin marketplace add <source>` — Add a marketplace from a URL, path or GitHub repo; `list`, `update` and `remove` manage the configured ones.

```bash
claude plugin marketplace add your-org/claude-plugins
```

`claude plugin prune` — Remove auto-installed dependencies that are no longer needed. Alias: `autoremove`

```bash
claude plugin prune
```

`claude --plugin-dir <path>` — Load a local plugin directory or .zip for this session only; a folder of plugins loads each child (repeatable).

```bash
claude --plugin-dir ./my-plugin/ --plugin-dir ./other.zip
```

`claude --plugin-url <url>` — Fetch a plugin .zip from a URL for this session only (repeatable).

```bash
claude --plugin-url https://example.com/my-plugin.zip
```

## Auto Mode

`claude auto-mode config` — Print the effective auto mode config as JSON: your settings where set, defaults otherwise.

```bash
claude auto-mode config
```

`claude auto-mode defaults` — Print the shipped default auto mode rules as JSON (environment, allow, soft_deny, hard_deny).

```bash
claude auto-mode defaults
```

`claude auto-mode critique` — Get AI feedback on your custom auto mode rules.

```bash
claude auto-mode critique
```

`claude auto-mode reset` — Reset auto mode to the shipped defaults by removing the autoMode section from your user settings file; asks for confirmation, `-y` skips it.

```bash
claude auto-mode reset
```

`/auto-mode-setup` — Draft `autoMode.environment` entries from your project and recent sessions, review the draft and save it to your user settings (Pro, Max or Team plan).

```bash
/auto-mode-setup
```

## Debugging & Diagnostics

`claude --debug` — Enable debug mode: verbose logs, tool calls, API requests.

```bash
claude --debug
```

`claude --debug=<filter>` — Filter debug output by category; `!` excludes one (`--debug='!1p,!file'`). The filter only binds in the `=` form — `--debug api,hooks` turns on debug mode without filtering.

```bash
claude --debug=api,hooks
```

`claude --debug-file <path>` — Write debug logs to a file (implicitly enables debug mode).

```bash
claude --debug-file /tmp/claude-debug.log
```

`claude --verbose` — Enable verbose output mode.

```bash
claude --verbose
```

`claude --safe-mode` — Start with all customizations disabled (CLAUDE.md, skills, installed plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, keybindings) to troubleshoot a broken configuration. Policy settings, auth, model selection, built-in tools and plugins, and permissions still work. Sets `CLAUDE_CODE_SAFE_MODE=1`.

```bash
claude --safe-mode
```

`claude --ax-screen-reader` — Render screen-reader friendly output (flat text, no decorative borders or animations).

```bash
claude --ax-screen-reader
```

## Scripting & Automation

`git diff HEAD~1 | claude -p "Summarize these changes"` — Pipe git diff into Claude to generate a commit message.

```bash
git diff HEAD~1 | claude -p "Write a conventional commit message"
```

`claude -p --output-format json "<prompt>" | jq '.result'` — Pipe JSON output to jq for processing in shell scripts.

```bash
claude -p --output-format json "Extract function names" | jq '.result'
```

`claude --settings '<json>'` — Load settings from a JSON file path or inline JSON string.

```bash
claude --settings '{"model":"sonnet","verbose":true}'
```

`claude --setting-sources <sources>` — Control which setting sources are loaded: user, project, local.

```bash
claude --setting-sources user,project
```

`claude -p --betas <feature> "<prompt>"` — Enable a beta feature via API header (API key users only); use the exact, dated header name from the API docs.

```bash
claude -p --betas <beta-header-name> "Think step by step"
```

`claude --disable-slash-commands` — Disable all skills for this session.

```bash
claude --disable-slash-commands
```

`claude --chrome` — Enable Claude in Chrome integration for this session.

```bash
claude --chrome
```

`claude --no-chrome` — Disable the Claude in Chrome integration for this session.

```bash
claude --no-chrome
```

`claude --file <file_id:path>` — Download file resources at startup. Format: file_id:relative_path (repeatable).

```bash
claude --file file_abc:doc.txt --file file_def:img.png
```

`claude --exclude-dynamic-system-prompt-sections` — Move per-machine sections (cwd, env, memory paths, git status) into the first user message for better cross-user prompt-cache reuse.

```bash
claude --exclude-dynamic-system-prompt-sections -p "Review"
```

## Environment Variables

`CLAUDE_CONFIG_DIR=<path> claude` — Use a custom config directory instead of the default ~/.claude. Enables separate configs for different projects or contexts.

```bash
CLAUDE_CONFIG_DIR=~/.claude-work claude
```

`alias claude-<name>="CLAUDE_CONFIG_DIR=~/.<dir> claude"` — Create shell aliases for different Claude configurations (add to .bashrc/.zshrc).

```bash
alias claude-private="CLAUDE_CONFIG_DIR=~/.claude-private claude"
alias claude-work="CLAUDE_CONFIG_DIR=~/.claude-work claude"
```

`ANTHROPIC_API_KEY=<key> claude` — Set the API key directly instead of using OAuth login.

```bash
ANTHROPIC_API_KEY=sk-ant-xxx claude -p "Hello"
```

`ANTHROPIC_MODEL=<model> claude` — Set the model without the `--model` flag — an alias or a full model name.

```bash
ANTHROPIC_MODEL=sonnet claude
```

`ANTHROPIC_DEFAULT_MODEL=<model>` — Choose the model new sessions start on by default (v2.1.236 or later) — only when no `--model`, `ANTHROPIC_MODEL` or saved model setting (e.g. from `/model`) applies.

```bash
export ANTHROPIC_DEFAULT_MODEL=opus
```

`ANTHROPIC_DEFAULT_OPUS_MODEL=<model-id>` — Pin what the opus alias resolves to; `ANTHROPIC_DEFAULT_SONNET_MODEL`, `…_HAIKU_MODEL` and `…_FABLE_MODEL` work the same way. `…_HAIKU_MODEL` also sets the model for background tasks (replaces the deprecated `ANTHROPIC_SMALL_FAST_MODEL`).

```bash
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5 claude
```

`CLAUDE_CODE_DISABLE_1M_CONTEXT=1 claude` — Turn off 1M-context support: `[1m]` variants leave the model picker, and models with a native 1M window (e.g. Opus 4.7+, Sonnet 5.5, Fable) are held to a 200K window (compacting at 200K, or stopping with the context-limit error when auto-compaction is off). This also undoes the 1M default that Opus 4.7+ and Fable get on Bedrock, Vertex, Foundry and the Claude apps gateway since v2.1.287.

```bash
CLAUDE_CODE_DISABLE_1M_CONTEXT=1 claude --model opus
```

`CLAUDE_CODE_SIMPLE=1 claude` — Minimal system prompt and only the Bash, file read and file edit tools; also set by `--bare`. OAuth login isn't read — authenticate with `ANTHROPIC_API_KEY` or an apiKeyHelper.

```bash
CLAUDE_CODE_SIMPLE=1 claude -p "Quick question"
```

`ANTHROPIC_BASE_URL=<url> claude` — Use a custom API endpoint (proxy or compatible provider).

```bash
ANTHROPIC_BASE_URL=https://my-proxy.example.com claude
```

`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS=<ms>` — Set a longer base delay (ms) for the backoff when Claude Code retries a request the API rejected as overloaded (529) (v2.1.292 or later).

```bash
CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS=5000 claude -p "Summarize this repo"
```

`CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS=1` — Stop sending the structured-outputs request field (and its beta header), for Mantle or an LLM gateway whose upstream rejects it. Without it, session titles, memory recall and prompt hooks fail there (v2.1.288 or later).

```bash
CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS=1 claude
```

`MCP_PROTOCOL_NEGOTIATION=legacy claude` — Keep every MCP server on the earlier handshake instead of probing for protocol revision 2026-07-28, which stdio and HTTP servers are asked for by default on the v2 MCP runtime (stdio on every install since v2.1.292). Use it when an older server stops connecting. `auto` probes HTTP, claude.ai connector and stdio servers.

```bash
MCP_PROTOCOL_NEGOTIATION=legacy claude
```

`CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR=<n>` — Set how fast a session's WebSearch cap (200 calls by default) refills, in calls per hour. The default is 100 in interactive sessions and 0 (no refill) in non-interactive `-p` runs; `0` turns refill off (v2.1.290 or later; before that the cap never refilled).

```bash
CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR=300 claude
```

`DISABLE_AUTOUPDATER=1 claude` — Disable automatic background updates; a manual `claude update` still works. `DISABLE_UPDATES=1` blocks both.

```bash
DISABLE_AUTOUPDATER=1 claude
```

`CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1` — Return to the original working directory after each Bash or PowerShell command in the main session.

```bash
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1 claude
```

`CLAUDE_CODE_NO_FLICKER=1 claude` — Enable fullscreen rendering (research preview): less flicker and flat memory in long conversations; same as `/tui fullscreen`.

```bash
CLAUDE_CODE_NO_FLICKER=1 claude
```

## Useful Aliases & Tips

`alias claude-private="CLAUDE_CONFIG_DIR=~/.claude-private claude"` — Separate config for creative/personal projects — own settings, memory, and MCP servers.

```bash
# In ~/.bashrc or ~/.zshrc:
alias claude-private="CLAUDE_CONFIG_DIR=~/.claude-private claude"
```

`alias claude-work="CLAUDE_CONFIG_DIR=~/.claude-work claude"` — Separate config for work projects — own API key, permissions, and agents.

```bash
# In ~/.bashrc or ~/.zshrc:
alias claude-work="CLAUDE_CONFIG_DIR=~/.claude-work claude"
```

`alias cq='claude -p'` — Quick alias for non-interactive one-shot queries.

```bash
cq "What's the regex for an email address?"
```

`alias cr='claude -c'` — Quick alias to continue the last conversation.

```bash
cr
```

`alias claude-review='claude -p --model opus "Review this code for bugs and security issues"'` — Predefined alias for code review with a specific model.

```bash
cat src/auth.py | claude-review
```

`ccommit() { git diff --cached | claude -p "Write a conventional commit message for these staged changes"; }` — Shell function to generate commit messages from staged changes.

```bash
git add -p && ccommit
```

`cexplain() { cat "$1" | claude -p "Explain this file concisely"; }` — Shell function to quickly explain any file.

```bash
cexplain src/config.ts
```

`ultracode` — Keyword trigger: include the word 'ultracode' in a prompt to run that task as a dynamic workflow without changing the session's effort level; `Option+W` / `Alt+W` dismisses the highlight. `/effort ultracode` turns it on for every substantive task in the session.

```bash
ultracode: refactor the auth module and add full test coverage
```

`ultrathink` — Keyword: include `ultrathink` in a prompt to ask for deeper thinking on that turn without changing the effort level.

```bash
ultrathink: why does this race condition only show up under load?
```

## Keyboard Shortcuts (interactive session)

`Enter` — Submit the current prompt (configurable in /keybindings).

```bash
Type your prompt and press Enter to send
```

`Shift+Enter` — Insert a newline without submitting — native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal; elsewhere use `\`+Enter or Ctrl+J, or run `/terminal-setup` (VS Code, Cursor, Alacritty, Zed).

```bash
Write multi-line prompts with Shift+Enter
```

`Ctrl+Enter` — Send now: deliver your queued messages, with your draft, without waiting (v2.1.275+). Running shell commands and subagents move to the background and keep running (v2.1.281+); if Claude is only writing, the turn is interrupted. `Ctrl+X Ctrl+S` does the same in terminals that don't report Ctrl+Enter.

```bash
Type a correction mid-turn and press Ctrl+Enter
```

`Ctrl+C` — Interrupt a running operation; with nothing running, the first press clears the input and a second press exits. Pressing Up on the empty prompt brings a cleared draft back, pasted text and images included (v2.1.288 or later; since v2.1.292 also after a slash command or a sent message).

```bash
Press Ctrl+C, then Up to restore the draft
```

`Escape` — Interrupt Claude mid-turn (the work so far is kept) or close a dialog.

```bash
Press Escape to stop and redirect Claude
```

`Escape Escape` — Clear the input draft (saved to history), or with an empty input open the rewind menu.

```bash
Press Escape twice to rewind to an earlier point
```

`Shift+Tab` — Cycle permission modes: Manual, acceptEdits, plan and, where available, bypassPermissions and auto.

```bash
Press Shift+Tab until the mode indicator shows plan
```

`Ctrl+R` — Reverse-search your prompt history.

```bash
Press Ctrl+R and type part of an earlier prompt
```

`Ctrl+O` — Toggle the transcript viewer with detailed tool usage.

```bash
Press Ctrl+O to see what a tool call did
```

`Ctrl+T` — Show or hide Claude's to-do checklist in the status area (for running shells and subagents use `/tasks`).

```bash
Press Ctrl+T to see Claude's task list
```

`Ctrl+B` — Send running Bash commands and agents to the background (press twice in tmux).

```bash
Press Ctrl+B while a long test run is going
```

`Ctrl+X Ctrl+K` — Stop all running background subagents in this session (press twice within 3 seconds to confirm). Works while a background subagent's permission prompt is open; since v2.1.290 those prompts show this shortcut.

```bash
Press Ctrl+X Ctrl+K twice to stop every background agent
```

`Ctrl+G` — Open the prompt in your default text editor.

```bash
Press Ctrl+G to write a long prompt in your editor
```

`Ctrl+S` — Stash the prompt: with text in the input it is saved and cleared; press again on an empty prompt to restore it, including cursor position, pasted content and shell mode.

```bash
Press Ctrl+S to park a half-written prompt and ask something else first
```

`Ctrl+V` — Paste an image from the clipboard as an `[Image #N]` chip at the cursor (`Cmd+V` in iTerm2, `Alt+V` on Windows; on WSL use `Alt+V` if the terminal intercepts Ctrl+V).

```bash
Press Ctrl+V to paste a screenshot into the prompt
```

`Alt+P / Option+P` — Switch the model without clearing your prompt.

```bash
Press Alt+P (Option+P on macOS) to pick another model
```

`Alt+O / Option+O` — Toggle fast mode.

```bash
Press Alt+O (Option+O on macOS) to toggle fast mode
```

`Up / Down Arrow` — Navigate through prompt history.

```bash
Press Up to recall previous prompts
```

`/` — Open slash command autocomplete. Type to filter.

```bash
Type / to see all available commands
```

`!` — At the start of the prompt: shell mode — run a command directly and add its output to the session.

```bash
!git status
```

`@` — Mention a file path with autocomplete.

```bash
Explain @src/utils/date.ts
```

## Conclusion

Claude Code rewards a deliberate setup: pin sensitive operations behind permission modes (interactive sessions now start in auto mode where it is available; `Shift+Tab` or `--permission-mode manual` brings the prompts back), reserve `--dangerously-skip-permissions` for throwaway sandboxes only, and lean on `-p` plus `--output-format json` when you wire it into scripts and CI. Once you have a feel for sessions, agents and MCP servers, the same binary scales from a quick one-off question to a long-running, multi-step refactor. Treat the flags here as a starting point and check the official docs for new commands between releases.

## Further Reading

- [Claude Code documentation](https://code.claude.com/docs/en/overview) – Anthropic's official guide to installation, configuration, slash commands, hooks and MCP
- [Commands reference](https://code.claude.com/docs/en/commands) – the full list of built-in slash commands and bundled skills
- [CLI reference](https://code.claude.com/docs/en/cli-reference) – every command-line command and option
- [Model configuration](https://code.claude.com/docs/en/model-config) – aliases, model versions per provider and environment variables for model selection
- [anthropics/claude-code on GitHub](https://github.com/anthropics/claude-code) – issue tracker, release notes and reference material

