AI Guides › Workbench

Thirty Claude Code Commands, Sorted by the Moment You Need Them

By Nigel Guy · 7 min read

Most people learn five Claude Code commands and stop. Everything else becomes a plain-English request ("undo that", "what have you changed?") that Claude answers from memory, while a built-in command that does the job exactly sits one slash away. At time of writing, Anthropic's commands reference has about 120 rows. Some are aliases, a few are retired, and many are niche. Around thirty are worth learning, and they make more sense grouped by when you'd reach for them than read alphabetically.

The rule: if a command exists for the job, use the command rather than asking Claude to do it. The command checks real state; Claude answering from memory doesn't.

Everything below was checked against Anthropic's commands reference on 2026-10-04. Type / in a session to see what your version has. If a command is missing, run claude update in your terminal; several of these only arrived in recent versions.

Cost at time of writing

The commands themselves cost nothing extra. You pay for the plan underneath them. Anthropic lists Pro at $20 a month ($17 a month billed annually) and Max from $100 a month, in US dollars, so check the £ figure and VAT at checkout. Two things cost more than they look. /batch and /code-review ultra both run many agents, so they use up your allowance quickly. Ultrareview also comes with 3 free runs on Pro and Max, after which you need usage credits.

1. Set up and run the work

Command What it does Best for Catch
/init Writes a starter CLAUDE.md from your codebase First session in a project Only knows what's in the files
/memory Edits CLAUDE.md files and the auto memory switch Rules you keep retyping Memory is guidance, not enforcement
/permissions Sets allow, ask and deny rules for tools Stopping approval prompts for safe actions A broad allow rule is hard to spot later
/mcp Manages connected servers and their sign-ins; /mcp reconnect all retries failures A connector that has stopped responding Every server is another source of untrusted content
/plan [task] Enters plan mode: Claude reads and proposes but doesn't edit Any change touching more than one file A vague task still gets a vague plan
/model [model] Switches model and saves it as your default Swapping a heavy model for a light one Saves as default; press s in the picker to switch for this session only
/effort [level] Sets reasoning effort, low to xhigh or max Easy jobs (lower) or hard bugs (higher) max lasts only for the session
/goal [condition] Keeps Claude working across turns until a checked condition holds Work with a clear finish line A fuzzy condition can keep it going for a long time

/goal is the newest of these, and the one beginners misuse most. After each turn a separate model checks whether your condition is met, so the condition needs to be something it can actually verify. Fill in the brackets:

/goal Every file in [FOLDER] uses [NEW_PATTERN] instead of [OLD_PATTERN],
[TEST_COMMAND] passes with no failures, and no file outside [FOLDER] has
changed. If a change would need a decision from me, such as a new dependency
or a deleted file, stop and ask rather than choosing.

Clear an active goal early with /goal clear.

2. Hand work off, and undo it when it goes wrong

Command What it does Best for Catch
/subtask <task> A background subagent takes the whole conversation and reports back here A side job while you carry on Its edits aren't covered by /rewind
/fork [prompt] Copies the conversation into a separate background session Running two approaches side by side Takes up a second session's worth of usage
/background [prompt] Detaches this session to keep running and frees your terminal Long jobs you don't need to watch Check on it later with claude agents
/tasks Lists background work, including finished subagents Seeing what's still running Shows the current session only
/batch <instruction> Splits a codebase-wide change into 5 to 30 units, each in its own worktree Large mechanical migrations Needs git (or a worktree hook); heavy on usage
/branch [name] Branches the conversation so you can try another direction "What if we did it the other way?" Go back to the original with /resume
/rewind Restores code, conversation or both to an earlier prompt (Esc twice also works) Claude has just gone the wrong way Misses shell-command edits and most subagent edits
/resume [session] Reopens an earlier conversation by name or ID Picking up yesterday's work Easier if you used /rename first

The trap in this group is mixing up three similar commands. /subtask brings its result back into your conversation. /fork makes a separate session that keeps running alongside. /branch switches you into the copy. If you want the answer here, use /subtask.

Then there's undo. Checkpoints only cover edits made with Claude's own file tools during your turn. Changes made by shell commands such as rm or mv, by background subagents (including a background /code-review --fix), or by you outside the session aren't restored. Snapshots are cleared after about 30 days by default. Commit to git before you hand anything off.

3. Manage the context window

Command What it does Best for Catch
/context Shows what's filling the context window, with suggestions Working out why a session feels sluggish /context all expands the breakdown
/compact [focus] Summarises the conversation to free space Long sessions on one task An unsteered summary may drop the detail you needed
/clear [name] Starts an empty conversation; project memory stays Switching to unrelated work Name it so /resume can find it
/btw [question] Asks a side question without adding it to history "Remind me what that flag does?" Answers don't feed later turns
/autocompact [size] Sets how full the window gets before auto-compacting Sessions that compact too early or too late Saves to user settings, not just this session
/rename [name] Names the session Anything you might come back to Without a name, one is generated for you

Anthropic's own cost advice is to /clear between unrelated tasks, because stale context costs tokens on every later message. When you compact rather than clear, tell it what to keep:

/compact Keep: the decisions we made about [TOPIC], the exact file paths we
changed, the open bugs still to fix, and any command that failed and why.
Drop: exploratory reading, abandoned approaches and full file contents.

4. Check what you've actually got

Command What it does Best for Catch
/diff Shows working-tree changes, including Claude's edits Before you accept anything You still have to read it
/code-review [level] Reviews the diff for correctness bugs; --fix applies the findings A second pass before commit Finds bugs, not style; ultra runs in the cloud
/security-review Checks your branch's changes for vulnerabilities Anything touching auth, input or data Needs an origin remote
/verify Builds and runs your app to confirm a change works Changes that pass tests but might still be broken Only runs when you call it
/usage Session cost, plan limits and a breakdown of usage Before a big job The dollar figure matters only on API billing
/status Version, model, account and connectivity "Which model am I even on?" Read-only
/doctor Checks installation and config, and offers fixes Odd behaviour after an update Asks before changing anything; read what it proposes
/skill-doctor Shows each skill's context cost and how often it's used Trimming a bloated setup Needs v2.1.252 or later

How to choose

Work by moment, not by list. The first time you open a project: /init, /memory, /permissions. Before a change: /plan. During it: /context, then /compact or /clear. Before you accept the result: /diff, then /code-review. When it goes wrong: /rewind. If you only add three this week, make them /plan, /diff and /rewind. None needs setup.

What to skip

Guardrails

Sources

All 751 AI guides · JulieMango plans from £17/mo