You’ve seen the basic slash commands. This module covers the commands that experienced Claude Code users reach for once the initial workflow is working — context management, session tools, the bundled skills, and keyboard shortcuts that speed everything up.
Context and Session Management
Every Claude Code session has a context window. /context visualizes it as a colored grid — green for available, yellow for getting full, red for nearly exhausted. When context gets long, /compact compresses the conversation. Pass focus instructions to preserve what matters: /compact focus on the database migration plan.
Auto-compaction runs automatically as the context window fills. To control when it triggers, set the auto-compact window: /autocompact 500k sets a 500K-token window and saves it under the current model in your user settings (modelSettings), while /autocompact auto returns to the window tuned for your model. To set one window for every model instead, use the autoCompactWindow setting in settings.json. Pass --autocompact at launch to override the saved value for a single session without changing it, or set the CLAUDE_CODE_AUTO_COMPACT_WINDOW env var in scripts and cloud environments, where it takes precedence over the command, the flag, and the setting. The window accepts 100K–1M tokens — a plain count (200000), a k/M suffix (500k, 1M), or a bare 100–1000 meaning thousands (200 = 200,000); on Claude Code v2.1.304 or later the env var accepts the k/M suffix too. Requires Claude Code v2.1.221 or later.
Idle compaction is on by default for conversations that meet its conditions. CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS sets the context size, in tokens, at which idle compaction applies to a conversation (default: 200000). It accepts a positive whole number, and anything else is ignored. Values below 100000 are raised to 100000, the lowest threshold — so CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS=300000 claude raises the threshold from its default. Requires Claude Code v2.1.290 or later.
To turn idle compaction off, set idleCompaction to false in settings.json. Requires Claude Code v2.1.290 or later.
CLAUDE_CODE_DISABLE_FILE_MENTIONS=1 stops Claude Code from expanding @ mentions of files and directories. Claude instead gets the mentioned paths with a note to read them using its file tools, so it decides for itself which of them are worth pulling into the context. The variable is ignored in project and local settings, so set it in user settings or in the environment. Requires Claude Code v2.1.299 or later.
/branch creates a parallel conversation from the current point, letting you explore two approaches side by side. /rewind rolls back to an earlier point — useful when Claude went down the wrong path. It optionally reverts file changes too, functioning as an undo for both conversation and code.
Session resumption makes long work possible. /rename my-feature saves the current session with a readable name. /resume my-feature picks it back up later with full context intact. Export a session to a file or clipboard with /export for sharing or archiving.
/context
/compact focus on the auth refactor
/autocompact 500k
/branch
/rename auth-refactor-v2
/export auth-refactor-v2.md
Bundled Skills
Claude Code ships with built-in skills that work like commands. These are always available without installation.
/code-review reviews the current diff for correctness bugs and reports findings without editing files; /simplify is a separate cleanup-only review that applies fixes without hunting for bugs. The two commands share review infrastructure, but their scopes overlap: /code-review looks for correctness bugs and, depending on your model and effort level, also covers reuse, simplification, and efficiency cleanups; /simplify is cleanup-only and applies its fixes — pass --fix or --comment to /code-review to apply findings or post them to the current GitHub PR. As of v2.1.218, /code-review runs as a background subagent so review work no longer fills the conversation. Lower effort levels (/code-review low) return fewer high-confidence findings; medium through max give broader coverage, and /code-review ultra runs a deeper multi-agent review in the cloud. Pass --comment to post findings as inline comments on the current GitHub PR, or pass a path or PR reference to target a specific change. /batch <instruction> is for large-scale changes across many files — it plans the work, uses isolated git worktrees, and can coordinate verification and PR-oriented follow-up. /loop 5m check deploy status runs a prompt repeatedly on an interval, useful for polling long-running operations. /proactive is an alias for /loop — same behaviour, often more readable when the goal is “keep watching and act on what you see” rather than “run this on a timer”. The word ultracode triggers a dynamic workflow run.
/debug enables verbose logging to help diagnose issues with Claude’s behavior or tool use. /claude-api loads the Anthropic SDK reference for the project’s language — it activates automatically when it detects imports from @anthropic-ai/sdk or the Python anthropic package.
/code-review
/code-review high --comment
/batch add JSDoc comments to all public functions in src/
/loop 2m check if the build finished
/debug
Fast Mode
Fast mode is a high-speed API configuration that delivers the same model quality with up to 2.5x faster responses at a higher per-token cost. It’s supported on Fable 5.2, Opus 5.5, Opus 5, and Opus 4.8 — fast mode on Fable 5.2 requires Claude Code v2.1.321 or later, and it is not available on Sonnet, Haiku, or other models. Opus 5.5 is the default since v2.1.280 (it was Opus 5 from v2.1.219), and fast mode for Opus 5 and Opus 4.8 is a research preview. Opus 4.7 and 4.6 don’t support fast mode: switching to one turns fast mode off. Available via /fast or by setting fastMode: true in user settings — except on Fable 5.2, where the setting alone has no effect until you run /fast while using Fable 5.2. When enabled, a ↯ icon appears next to the prompt bar.
Fast mode for Opus 4.8 was deprecated on October 30, 2026, and is removed on November 30, 2026. After that date, the API rejects your requests if Opus 4.8 is still your model with fast mode on. To keep the speedup, switch to Opus 5.5 with /model — fast mode stays on across the switch; to stay on Opus 4.8, run /fast off and keep working at standard speed. (Fast mode for Opus 4.7 was deprecated earlier, on June 25, 2026, and removed on July 24, 2026.)
/fast # toggle on/off
/fast on # explicitly enable
/fast off # explicitly disable
Fast mode switches you to Opus automatically if your current model doesn’t support fast mode — Opus 5.5 by default — and leaves you where you are on Fable 5.2, which supports fast mode. When you turn fast mode off, you stay on your current model — use /model to switch.
Fast mode and effort level are separate speed levers. /fast reduces latency without changing quality. /effort low reduces thinking time, which may lower quality on complex tasks. Combine both for maximum speed on straightforward work:
/fast
/effort low
When the fast mode rate limit is hit, it automatically falls back to standard speed (the ↯ icon turns gray) and re-enables when the cooldown expires. The fast mode rate-limit pool is shared across all supported Opus models (Opus 5.5, Opus 5, and Opus 4.8). Fast mode requires usage credits to be enabled on your account — manage them with /usage-credits (renamed from /extra-usage in v2.1.144; the old name still works) — and is not available on Bedrock, Google Cloud’s Agent Platform, Foundry, or Claude Platform on AWS. The VS Code extension supports it too, offering a Toggle fast mode command when the selected model supports fast mode. Enterprise admins can control availability through managed settings.
Set the model new sessions start on by default with ANTHROPIC_DEFAULT_MODEL (added in v2.1.236). Both ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_MODEL are persistent environment variables that affect every Claude process launched with them, so exporting either one in your shell or setting it through the user’s environment applies across restarts. They differ in model-selection precedence and default semantics, not in lifetime: ANTHROPIC_MODEL is the explicit model override and beats an ordinary user or project model setting (including the value a /model pick writes), while ANTHROPIC_DEFAULT_MODEL is the lower-priority default that an ordinary model setting can override — so a /model pick wins over ANTHROPIC_DEFAULT_MODEL but ANTHROPIC_MODEL wins over that same pick on the next launch. Enforced managed settings override both:
export ANTHROPIC_DEFAULT_MODEL=sonnet
The variable is ignored when its value is one of the special tokens Claude Code treats as “use the normal default” — default, inherit, opusplan, or haiku. Pick a concrete alias or model ID instead, and check the official model configuration reference for the precedence order between ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODEL, the --model flag, and the model setting.
The fable alias resolves to Fable 5.2 as of v2.1.321 — it resolved to Fable 5.1 from v2.1.257, and to Fable 5 before that. Set ANTHROPIC_DEFAULT_FABLE_MODEL=claude-fable-5 if you want the fable alias to keep pointing at Fable 5 instead — the variable must hold the Fable 5 model ID, not just be present. On the Anthropic API, a claude-fable-5 or claude-fable-5[1m] value saved in your user settings — for example from picking Fable in the /model picker before v2.1.257 — is auto-updated to the fable or fable[1m] alias the first time you run v2.1.257 or later, and the startup model line shows (auto-updated) once. The same value in project, local, or managed settings is left untouched. In Claude apps gateway sessions, fable still resolves to Fable 5 unless you override it with ANTHROPIC_DEFAULT_FABLE_MODEL; best is unaffected by that variable.
On the Anthropic API, the default Sonnet model as of v2.1.284 is Claude Sonnet 5.5 (claude-sonnet-5-5), which has a 1M-token context window — so sonnet in the /model picker or ANTHROPIC_DEFAULT_MODEL=sonnet starts new sessions on it there.
Fable Models
Claude Fable models are the most capable models in Claude Code, suited to tasks larger than a single sitting. No Fable model is the account-type default on any plan or provider, so you select one explicitly.
Fable 5.2 (claude-fable-5-2) requires Claude Code v2.1.321 or later. Run /model fable, or launch with claude --model fable. The fable alias resolves to Fable 5.2 everywhere except Claude apps gateway sessions, where it still resolves to Fable 5 — in a gateway session run /model claude-fable-5-2 instead, and remember that a gateway which is not configured to serve that model rejects requests for it.
Fable 5.1 and Fable 5 are selected by model ID: on the Anthropic API, run /model claude-fable-5-1 or /model claude-fable-5, or launch with claude --model claude-fable-5-1. On other providers, use your provider’s model ID, or pin it with ANTHROPIC_DEFAULT_FABLE_MODEL. Fable 5.1 requires Claude Code v2.1.257 or later.
A claude-fable-5-1 model saved in your user settings moves to the fable alias on Pro, Max, Team, and Enterprise plans. On Pro and Max the move happens the first time you run v2.1.321 or later, and the startup model line can show (auto-updated) once. On Team and Enterprise the move waits for your organization’s settings, so it can come at a later startup, or not at all — it applies from the next session, with no (auto-updated) line, and you can check which model you are on by running /model. After the move, sessions start at Fable 5.2’s default effort unless you have set a level for it. Console accounts, third-party providers, and project, local, or managed settings keep claude-fable-5-1.
/model fable
/model claude-fable-5-1
Keyboard Shortcuts and Power Features
Shift+Tab cycles default → acceptEdits → plan. The other modes aren’t in that default cycle: auto appears once your account meets the auto mode requirements; bypassPermissions appears after you start with --permission-mode bypassPermissions, --dangerously-skip-permissions, or --allow-dangerously-skip-permissions (the --allow- variant adds it to the cycle without activating it); and dontAsk never appears — set it with --permission-mode dontAsk. Enabled optional modes slot in after plan, with bypassPermissions first and auto last. Shift+Tab is the fastest way to switch to plan mode for a complex task and back afterward.
Option+T (macOS) or Alt+T toggles extended thinking — Claude spends more time reasoning before responding. Use /effort to set reasoning depth: low, medium, high, xhigh, or max where the model supports them — /effort auto is not a depth, it clears the saved level for the active model. max applies to the current session only. Ctrl+O toggles the transcript viewer, which shows detailed tool usage and execution — a timestamp and the model used on each assistant message — and expands MCP calls that otherwise collapse to a single line.
/btw your question asks a side question without adding it to the conversation history — useful for checking a fact or asking about syntax without cluttering the context. Ctrl+B backgrounds running bash commands and agents so you can give Claude another instruction while they continue working. If you need to kill all background agents, the official shortcut is Ctrl+X Ctrl+K.
Ctrl+U deletes from the cursor back to the start of the line — press it again to clear across lines in multiline input — and Ctrl+Y pastes back the text you last deleted with a deletion shortcut such as Ctrl+K, Ctrl+U, or Ctrl+W, so a long prompt is recoverable. Ctrl+L forces a full terminal redraw while keeping your prompt input and conversation history in place, useful when terminal output tears or drifts. In the transcript viewer footer, [ dumps the transcript to scrollback and v opens it in your $EDITOR.
The /diff command opens an interactive diff viewer for uncommitted changes — better than reading raw git output when you want to review what Claude has done before committing. /insights generates a session analysis report with statistics on what was accomplished.
# Toggle to plan mode, then back
Shift+Tab
Shift+Tab
/effort high
/btw what's the difference between async and defer on script tags?
Vim Visual Mode
Vim users get visual selection in the input editor. Press v for character-wise selection and V for line-wise selection. Once in visual mode, navigation keys (h, j, k, l, w, e, b, f, F, t, T) extend the selection. Then apply an operator:
d/x deletes, y yanks, c/s changes, p replaces with register contents, r{char} replaces every selected character, ~/u/U toggles or forces case, >/< indents or dedents, J joins lines, and o swaps the cursor and anchor. Text objects like iw, aw, i", a", i(, a( work for precise selections. Block-wise visual mode (Ctrl+V) is not supported.
Reading Huge Files — Partial View
The Read tool now returns a truncated first page with a PARTIAL view notice instead of a hard error when a whole-file read would exceed the token limit. Before, asking Claude to read a 500 KB JSON dump or a generated bundle would fail outright; now it gets the first page plus a clear marker telling it how much it received and how to read more with offset/limit — as long as the file is under 256 KB. A whole-file read of anything over 256 KB still returns an error telling Claude to page through it with offset/limit or grep for the content it needs, so a 500 KB dump is still a hard failure. If you pin an explicit limit that’s still larger than a single read can fit, Read returns an error asking for a smaller limit (or a grep for the specific content) instead of loading the rest. A single read’s token budget can be raised: the CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS env var overrides the default 25,000-token limit, and a read made with the allow_large parameter can go past it when the context window has room. Even so, pagination with offset/limit is the supported way through large files.
In practice you don’t need to do anything to enable this — when Claude sees the partial-view notice, it knows to either narrow with grep first or paginate with offset until it has what it needs. The behavior matters most for migrations, large logs, and tooling like /init that scans many files.
/usage — Unified Session Statistics
The /usage command shows a unified dashboard that supersedes what /cost and /stats used to show separately — total cost estimate, API and wall-clock duration, and lines added or removed. As of v2.1.149, it also includes per-category breakdowns showing what’s driving your limits: skills, subagents, plugins, and per-MCP-server cost. For API users it includes detailed token statistics; for subscribers it shows plan usage bars and activity. Both /cost and /stats still work as shortcuts that open the relevant tab. Dollar figures are locally computed estimates — check the Claude Console for authoritative billing.
After the conversation’s first API response, /usage adds a Prompt cache (main) line to the Session block summarizing your prompt cache use: the request count, the share of input tokens served from cache, cache misses (with when the last one happened and how many tokens it re-cached), any expected rebuilds from compaction or tool-result clearing, and whether the cache is warm right now with the TTL in effect. It covers the main conversation only — not subagents — and status line scripts can read the same numbers from the prompt_cache object. Requires Claude Code v2.1.251 or later.
When the Claude apps gateway runs v2.1.284 or later, /usage and the status line show the gateway spend limit as dollar amounts — for example $271.40 / $500.00 spent this month — and the status line’s rate_limits.spend_limit object gains used_usd, limit_usd, and period fields for scripts that render it. For claude.ai subscribers, v2.1.284 also adds /rate-limit-options to /help and the command menu, so the usage-limit notices that mention it now point at a command you can actually find and open.
/goal — Goal-Directed Sessions
The /goal command sets a completion condition that Claude works toward across multiple turns. Once a goal is active, Claude keeps working autonomously until the condition is satisfied. A live overlay shows elapsed time, turn count, and token usage so you can monitor progress without interrupting.
/goal migrate all API endpoints from REST to GraphQL
/goal all tests pass and coverage is above 80%
Goals pair well with /effort high for complex multi-step tasks. To cap how many turns Claude will take, set CLAUDE_CODE_MAX_TURNS as an environment variable:
export CLAUDE_CODE_MAX_TURNS=50
Session Recap
When you return to the terminal after stepping away, Claude Code shows a one-line recap of what happened while you were gone. The recap generates in the background once at least three minutes have passed since the last completed turn and the terminal is unfocused, so it’s ready when you switch back. Recaps only appear once the session has at least three turns, and never twice in a row.
Run /recap to generate a summary on demand. To turn automatic recaps off, open /config and disable Session recap. Session recap is on by default for every plan and provider. It’s always skipped in non-interactive mode.
Command History and Reverse Search
Claude Code maintains input history per working directory. Submitting the same prompt twice in a row records one entry, so pressing Up steps to the previous distinct prompt. Running /clear starts a new session — recall then lists the new session’s prompts first, with earlier sessions’ prompts after them, and the previous session’s conversation is preserved for /resume.
Press Ctrl+R to interactively search through your command history. Type a query to search and press Ctrl+R again to cycle through older matches. Inline Ctrl+R search always covers prompts from every project. In fullscreen rendering, Ctrl+R opens a search dialog instead and Ctrl+S cycles that dialog’s scope through the current session, the current project, and all projects — in the classic renderer Ctrl+S is the stash-or-restore-prompt shortcut, not a scope toggle. Press Tab or Esc to accept the match and keep editing, Enter to accept and execute immediately, or Ctrl+C to cancel.
Ctrl+R → type "migration" → Ctrl+R (older matches) → Tab (accept)
Custom Themes
The /theme command lets you create and switch between named color themes. Themes are stored as JSON files in ~/.claude/themes/ and can be hand-edited. Plugins can also ship themes via a themes/ directory in the plugin bundle.
Output Styles
Output styles change how Claude responds without changing what it knows. They modify the system prompt to set role, tone, and format. Five built-in styles are available: Default (standard software engineering assistant), Proactive (executes immediately, makes reasonable assumptions instead of pausing — stronger autonomous guidance than auto mode, works independently of permission mode), Concise (leads with the result, skips preamble and narration, and keeps responses short by default while doing the engineering work as thoroughly as Default — it still answers in full when you ask for detail and always keeps the complete text of error reports, security warnings, and destructive-action confirmations; requires Claude Code v2.1.237+), Explanatory (adds educational “Insights” between coding steps), and Learning (collaborative mode where Claude marks strategic pieces with TODO(human) for you to implement).
Switch styles via /config → Output style. The selection is saved to .claude/settings.local.json. Changes take effect from your next message — before v2.1.251, the new style applied only after you ran /clear or started a new session.
Custom output styles are Markdown files with frontmatter. Save them in ~/.claude/output-styles/ (user), .claude/output-styles/ (project), or the managed settings directory (policy). The file name becomes the style name unless you set name: in the frontmatter. Set keep-coding-instructions: true to retain Claude Code’s built-in software engineering instructions alongside your custom ones — leave it out when Claude isn’t doing software engineering at all, like a writing assistant or data analyst:
---
name: Diagrams first
description: Lead every explanation with a diagram
keep-coding-instructions: true
---
When explaining code, architecture, or data flow, start with a Mermaid diagram showing the structure, then explain in prose.
Plugins can ship output styles in an output-styles/ directory, and plugin styles can set force-for-plugin: true to apply automatically when the plugin is enabled.
CLI Flags for Commands
--eval-dir <dir> is not a top-level claude option — it belongs to claude plugin eval and claude plugin eval init, and takes the directory holding the eval cases. claude plugin eval requires Claude Code v2.1.269 or later:
claude plugin eval --eval-dir quality/evals
For unattended headless runs where nobody can answer permission prompts — scheduled jobs, agent hosts without a canUseTool callback, etc. — pass --permission-prompts none (Claude Code v2.1.259+). Anything that would prompt is denied automatically while the active permission mode (including auto mode) keeps deciding every call. With --output-format stream-json, the denied prompts arrive as permission_denied system messages and the final result message lists them under permission_denials:
claude -p "Update the dependency pins and run the tests" --permission-mode auto --permission-prompts none