/clearClear between distinct tasks
Start a fresh context when the goal changes. Leftover exploration becomes expensive noise on every later turn.
How to run efficient Claude Code sessions that get the most from every token — less noise in context, smarter model and effort choices, and habits that keep prompt cache working for you.
Quick wins
High-leverage habits that keep sessions lean, cache-friendly, and workflow-aware.
/clearStart a fresh context when the goal changes. Leftover exploration becomes expensive noise on every later turn.
/model · /effortDefault stays Opus 5.5 for open-ended judgment. Use /model sonnet (Sonnet 5.5 from v2.1.284) for well-scoped everyday work. Pick /model once at session start (switches still bust cache). On Opus 5.5 / Fable 5.1 you can raise /effort mid-session without resetting cache — still prefer medium for day-to-day.
/usageEnd a task with /usage (or /cost). Compare turns, cache share, and output. Since v2.1.299 /usage also warns when max effort, workflows, always-on context, or large tool results are driving the bill, and since v2.1.305 you can press f to apply its suggested fixes.
@fileAttaching with @ puts the file in context directly and skips unnecessary Read/search round-trips.
quiet / subagentAdd quiet flags to verbose tools, or run chatty work in a subagent so only the summary returns.
/contextIn a fresh session, run /context to see CLAUDE.md, skills, MCP, and other always-on payload before you start.
/compactOn subscription plans the cache expires around an hour. Since v2.1.299 the terminal auto-compacts idle chats over 200K tokens just before that; for smaller ones, compact yourself before stepping away.
ultracodeDynamic workflows burn far more usage. Ultracode is its own /effort toggle (no longer forces xhigh). Reserve it / “create a workflow” for audits, migrations, and adversarial checks — not everyday edits.
claude agentsUse agent view (or the desktop sidebar) when several tickets should each keep their own transcript. Background with /bg; jump in only when a row needs you.
ProjectsFor cloud builds that span repos or long-running outcomes, open a Project: Claude routes threads, keeps shared memory, and you steer from the main chat (or your phone).
skillsKeep CLAUDE.md lean. Move multi-step playbooks, scripts, and verification checklists into on-demand skills so they load only when the task matches.
AGENTS.md · /memoryReuse AGENTS.md when the repo already has one (or @-import it from CLAUDE.md). Use /memory to audit auto memory so corrections stick without bloating the shared file.
/scheduleFor backlog triage, deploy checks, or PR babysitting, schedule a routine so Claude runs on web infra without your laptop staying open.
migrationsFor language or framework ports, invest in a rulebook, a mechanical judge, and adversarial review — then fan out. Fixing one file by hand does not scale.
Economics
You are billed for inference work. Model size, input vs output, and caching decide what each turn costs. Efficiency means tokens go toward the ask — not toward noise.
Every Claude Code turn reuses conversation history. Cached tokens are cheap to re-read; new tokens — especially model output and fresh tool results — dominate the bill. Output tends to cost on the order of ~5× input in illustrative terms.
Chart values are illustrative multipliers for teaching — not Anthropic list prices.
Normally Claude requests one tool call, reads the whole result, then decides the next one — every intermediate output re-enters the context. In Code Mode, Claude instead writes a short JavaScript snippet that runs several tool calls (searches, edits, test runs) inside your session, chains results together, and hands back only the slice it needs. Fewer round trips, less noise in the window.
The same edit across many files, searches that need filtering before Claude reads them, and independent commands that can run in parallel.
Start with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude (or set it in the env block of ~/.claude/settings.json — project settings cannot enable it). Confirm the prompt once; press Ctrl+O to inspect the generated code.
Interactive terminal only on Opus/Sonnet/Haiku 5.5 or Fable 5.2 with a subscription or Console account — no -p, SDK, IDE panel, gateways or cloud providers. Auto mode reviews the code as a whole, and such sessions resume only with Code Mode on.
Infographic
A typical fix session writes the prefix once, then rides cheap cache reads — until something busts the key.
System prompt, CLAUDE.md, and your first message establish a stable prefix.
Later turns cache-read that history. You mainly pay full price for new tool results and the model’s reply.
Session start and right after /clear are ideal times to set /model and /effort — no big cache to lose.
Trims the end of the conversation without rewriting the whole history. Useful when you want to undo a dead-end while preserving earlier cache-friendly turns.
Summarizes and replaces history. Worth it before long breaks or when context is bloated — but expect a write cost and a new prefix afterward. From v2.1.299 the terminal does this for you: a conversation over 200K tokens left idle about 54 minutes is compacted before its one-hour cache lapses, so your next message doesn't reprocess the whole history at full price. Tune the threshold with CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS or turn it off with "idleCompaction": false.
Pick the model at session start, compact smaller sessions yourself before you step away (idle compaction only covers 200K+ chats), and on API or cloud keys opt into a one-hour cache lifetime for long runs. Forked subagents can inherit the parent's warm cache instead of rebuilding it.
Context
Sessions are longer and more context-heavy than a year ago. Everything Claude reads or prints stays in the transcript and is re-sent every turn — so keep only necessary context, and ride cheap cache reads for the rest.
Claude Code often writes to a file and shows a preview. Painful, but partially mitigated.
The real problem: verbose test/lint/build logs that fit entirely in context and get re-cached forever. Quiet flags and subagents matter most here.
Illustrative: later turns re-send the whole transcript. Cache-read discounts history, but window pressure remains.
Model family
As of Claude Code 2.1.284, /model sonnet resolves to Sonnet 5.5 (1M context), from 2.1.293 the Haiku slot is Haiku 5.5 (also 1M context), and from 2.1.321 /model fable resolves to Fable 5.2. The default session model stays Opus 5.5. The ladder is still: specialist → expert → everyday helper → fast worker.
| Model | Role | Best for | Cost / speed posture |
|---|---|---|---|
| Fable 5.2 / Mythos 5.2 | Specialist / frontier (v2.1.321+) | Hardest reasoning, hours-long agent runs, otherwise-infeasible migrations, orchestrating agent teams | $8/$40 per Mtok (was $10/$50 on 5.1) · cache reads $0.20 · 1M context · up to ~30% faster output than 5.1 · optional fast mode $16/$80 |
| Opus 5.5 | Expert · daily driver (v2.1.280+) | Open-ended judgment, long-horizon agentic coding, migrations you supervise | 1M context · default model stays Opus · fewer wasted turns on hard work |
| Sonnet 5.5 | Fast everyday coder (v2.1.284+) | Well-scoped bugs/features, iterative polish, design-aware docs/slides, fan-out agents | $2/$10 · cache reads $0.10 per Mtok (halved Oct 7) · ~30%+ faster than Sonnet 5 · medium default in Claude Code |
| Haiku 5.5 | Fast worker (v2.1.293+) | Search/read/summarize subagents, condensing long context, classification, cheap fan-out that is easy to spot-check | $0.10/$0.50 per Mtok · 1M context · medium default effort · not for complex agentic coding, escalate to Sonnet/Opus |
claude-fable-5-2 the default Fable model, and saved Fable 5.1 picks move to fable automatically (on Team and Enterprise once the org allows it). The climb to the top rung got cheaper: list price drops about 20% to $8/$40 per Mtok, cache reads are $0.20, and output streams up to ~30% faster. It still pays to treat it as the specialist rung, not the default: Anthropic positions Opus 5.5 for everyday work and Fable 5.2 for hard, open-ended engineering. Fast mode (up to ~2.5× faster tokens) costs double, $16/$80, so save it for a blocking turn you are actively waiting on. Need the old model for a comparison? /model claude-fable-5-1 switches back./usage./model sonnet for clear-spec everyday work. Same $2/$10 list as Sonnet 5, but fewer tokens per task and ~30%+ faster output — often up to ~30% less cost. Since Oct 7 its cache reads cost $0.10 per Mtok (5% of input, was 10%), so long Sonnet sessions that ride a stable prefix get noticeably cheaper; /cost reflects this from v2.1.296. Default effort in Claude Code is medium; no fast mode.Model × effort
Model = which frozen weights (capability ceiling). Effort = how much work — files read, verification, steps before check-in — not merely “thinking longer.” On Opus 5.5 and Sonnet 5.5 the ladder is low → medium → high → xhigh (plus max for one session).
The approach keeps failing on subtle reasoning or unfamiliar domains. Climb the model ladder; more tokens of a weak model won’t invent capability. Prefer raising effort on Opus 5.5 first — then Fable if high stalls twice on the same blocker. For clear-spec everyday work, try Sonnet 5.5 before burning Opus turns.
The model could do it but rushed: missed call sites, shallow search, incomplete edge cases. Raise effort so it invests more steps before declaring done — and give it a test or build to verify, which often beats burning thinking on every turn.
Like bringing a domain expert. Effort decides how many sources they consult before answering.
× effort = how long they spend before check-in
Daily driver for supervised open work. Default effort is medium — raise to high before you climb models.
× effort = how long they spend before check-in
Strong on clear-spec coding and polish. Default effort is medium in Claude Code; prefer it over Opus when the task is well scoped.
× effort = how long they spend before check-in
Routine work: Sonnet 5.5 or low effort wins on cost/speed. Hard open-ended work: Opus 5.5 that finishes in fewer turns can beat a cheap model that flails — chart is illustrative only.
New model = reset effort. A level you saved before /effort became per-model does not carry to newly released models such as Opus 5.5 or Sonnet 5.5 — they start at their default until you pick again. Run /effort status after upgrading. On Opus 5.5 and Fable 5.1, changing effort mid-session no longer resets the prompt cache — so raise effort before climbing to a heavier model when the same session should continue.
Ultracode is now its own toggle in /effort (Tab, or /effort ultracode on|off). As of Claude Code 2.1.284 it no longer forces xhigh — it stays on at whatever effort you already set and lets Claude decide when to spin up a dynamic workflow. Use it for hard, high-value work; keep it off for everyday tickets so you do not burn usage on orchestration overhead.
One hard turn, not a whole session. Since Claude Code 2.1.311, putting ultrathink in a prompt in the interactive terminal (and, from 2.1.316, the VS Code chat box) runs just that turn at xhigh on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 (Anthropic API). Typed while Claude is already working, it raises effort for the rest of that turn. It is the cheap way to spend extra effort on a single tricky step — a gnarly bug, a design decision — while the session stays at its everyday level. The rainbow highlight only appears where the keyword can actually raise effort, so no rainbow means no boost (for example inside quotes or a file path). Admins who don't want it can switch the keyword off with CLAUDE_CODE_DISABLE_ULTRATHINK.
Persistent context
Project memory loaded every session. Keep instruction files lean — they are always in the prompt. Bootstrap with /init, capture repeating instructions with #, push long procedures into on-demand skills, and let auto memory hold your corrections.
/initBootstrap a starter CLAUDE.md from the repo, then edit ruthlessly.
#Capture a repeating instruction into CLAUDE.md mid-session when you notice the pattern.
subdir CLAUDE.mdIn monorepos, add local CLAUDE.md files so packages get package-specific context.
Repos that already ship an AGENTS.md for other coding agents no longer need a duplicate playbook. When there is no project CLAUDE.md (or CLAUDE.local.md) on the path, Claude Code loads AGENTS.md as project instructions. Prefer a thin CLAUDE.md with an @AGENTS.md import when you also want Claude-specific notes, or set Project instructions in /config to read both files together.
CLAUDE.md wins when present; otherwise AGENTS.md is used alone.
Choose claude-md-and-agents-md in /config when teammates keep separate CLAUDE.md and AGENTS.md.
Some Bedrock / no-telemetry sessions still need an @AGENTS.md import from CLAUDE.md.
Value tip: one shared instruction file beats three drifting copies. Keep Claude-only quirks under a short CLAUDE.md import rather than forking the whole handbook.
Alongside files you write, Claude can save short learnings about your preferences, corrections, and project facts it cannot derive from the code. Notes live under the machine-local project memory folder; the index is loaded every session so you are not re-teaching “always use pnpm” every Monday.
/memoryBrowse CLAUDE.md locations, toggle auto memory, and open the memory folder in your editor.
/contextConfirm which instruction files loaded this session before you burn tokens on a wrong playbook.
.claude/rules/Split path-scoped rules (e.g. API-only conventions) so they load when matching files are in play — keep the root file short.
Value tip: put durable team standards in CLAUDE.md / AGENTS.md (shared via git). Leave personal corrections and ephemeral deadlines to auto memory — and prune the index if it grows past a couple hundred lines. Keep nested CLAUDE.md files in subfolders short too: since v2.1.309 one over the size limit loads only its beginning, so put the rules that matter at the top.
On-demand knowledge
Skills are folders Claude loads when the task matches — instructions plus scripts and assets, not just a markdown note. Good skills teach judgment and close the loop with the same checks you would run yourself.
Think of a skill as a small toolkit: a description that tells Claude when to reach for it, plus files it can follow — prompts, helper scripts, fixtures, screenshots. Discovery is description-driven: if the “when to use” text matches the user’s intent, the skill surfaces; otherwise it stays out of the prompt and keeps context lean.
.claude/skills/ — shared with the repoDo not restate what any competent engineer already knows. Spend skill text on project-specific judgment, naming, and failure modes.
Capture recurring traps — flaky tests, environment quirks, “never do X here” — so Claude stops rediscovering them every session.
Put the trigger description up front; park long scripts, fixtures, and deep docs in sibling files the skill can load only when needed.
The “when to use” description is how Claude discovers the skill. Be concrete about situations, not just the skill’s name.
Guardrails beat rigid scripts. Leave room for Claude to adapt when the repo or error surface does not match the happy path.
Turn the checks you would run by hand (lint, tests, screenshots, diff review) into steps the skill closes itself — so work does not stop at “looks done.”
The highest-leverage skills encode the manual checklist you already trust: typecheck, tests, lint, visual or API smoke checks, then a short “done when” definition. Claude keeps iterating until those gates pass instead of stopping at a plausible-looking diff. That is how skills turn “generate code” into “ship checked work.”
A dedicated verify skill you invoke after a change.
Checks baked into an implementation skill’s final steps.
Build skill hands off to a verify skill before declaring done.
Verification that always runs as part of your PR / review path.
/skill-creatorScaffold or refine a skill folder with structure and a trigger description — then edit the project-specific parts yourself.
/verifyHigh-level entry to run or attach verification so a change is not “done” until the checks you care about actually pass.
/skill-doctorAudit which loaded skills go unused and what they cost in context — prune so always-on skills do not quietly tax every turn.
Delegation
Each subagent gets its own context window and returns only the answer. Dynamic workflows go further: Claude writes an orchestration script that fans work across many parallel agents, verifies results, and keeps coordination out of your main transcript.
Anthropic's Applied AI team now finds that one capable agent with progressively loaded skills and tools often beats a router-plus-specialists design on quality, and costs less time and tokens. The same test works inside a Claude Code session: before adding another subagent, ask whether the main session would do better seeing the whole story.
Coupled steps whose results build on each other. Package the know-how as a skill so it loads only when needed.
Truly independent parallel work, a fresh-context verifier, or a job that needs different permissions or tools.
Merge subagents that always run together first, then try folding the rest one at a time and keep only those that earn their own context.
Read-only codebase discovery without polluting the parent session.
Design an approach and tradeoffs before implementation.
Flexible worker for bounded tasks that should return a summary.
For migrations, audits, adversarial review, or research that a single pass cannot finish cleanly, ask Claude to create a workflow (or include the keyword ultracode). Claude writes a harness that spawns many focused subagents, checks findings before folding them in, and can resume if interrupted. Expect meaningfully more usage than a normal session — scope the first run tightly.
Split many independent units (files, claims, tickets), then merge structured results.
Pair each producer with a skeptic so self-preferential bias does not ship unchecked.
Keep spawning until a stop condition (clean tests, no new findings) instead of one fixed pass.
Session tip: /effort ultracode turns on automatic workflow decisions for substantive tasks while keeping the effort level you already set (it no longer forces xhigh). Toggle it off for routine work. Pair long workflows with auto mode so Claude is not blocked on every tool call.
Per-subagent effort (v2.1.292+): the Agent tool now takes an effort level, so you can ask Claude to run a quick lookup subagent at low effort and a verifier at high, without changing the main session. Combine it with the model choice: Haiku 5.5 at low effort for cheap scans, Opus 5.5 at high for the one agent whose answer you will act on.
A default effort for every subagent (v2.1.316+): subagents used to inherit the session's effort, so an xhigh main session quietly made every helper expensive too. Setting CLAUDE_CODE_SUBAGENT_EFFORT (for example to low) gives subagents their own fallback level whenever nothing more specific is named. Keep the main thread at the effort the hard thinking needs, let fan-out workers run lean by default, and still ask for high effort on the one verifier that matters.
Subagent context and workflow model (v2.1.296+): a custom agent can set autoCompactWindow in its frontmatter so a long-running worker compacts earlier than the main session and stays lean. To keep a whole workflow on one model, set CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL (for example Sonnet 5.5 for a wide fan-out) while your other subagents keep their own model.
Custom agents live under .claude/agents/. Put team policy in CLAUDE.md, reusable multi-step procedures in skills, and consider hooks later for automation around tool events. Saved workflows can live under ~/.claude/workflows or ship inside a skill. For skill design tips and verification loops, see Skills & verification loops. For many independent full sessions (not nested subagents), see Parallel sessions & agent view.
Orchestration
Subagents share one conversation. Agent view and the desktop sidebar steer many independent sessions. Redesigned Projects add a coordinator that owns a goal and fans work into cloud threads with shared memory.
Instead of you splitting a build into handoffs, you describe the outcome and Claude directs the work: scope, delegate, review, assemble. Examples Anthropic highlights include profiling checkout latency across endpoints in parallel, or retiring a deprecated API across web, mobile, and backend repos with one thread per repo.
Brief the goal once. Claude scopes the work, routes tasks to threads, reviews outputs, and assembles what landed — including from your phone.
Each thread is a full Claude Code cloud session on its own branch and repo copy. Overlaps become ordinary merge conflicts.
Decisions, status, and style accumulate across threads so you are not re-explaining “release moved to Friday” every morning.
Files you add and artifacts Claude produces stay collectible, so later threads build on prior deliverables instead of starting blank.
Every thread is a full session, so Projects can burn through plan limits faster than a single chat. Watch project-specific usage. Threads run in the cloud today; local tools and private-network access are still rolling out. Beta access started with select Pro/Max cloud users and expands over time — existing projects keep working until upgraded.
Value tip: treat the coordinator like a chief of staff — clear goals, explicit merge order, and narrow thread scopes. Parallel workers pay off when they touch different surfaces; same-file thrash still costs you merge time.
Run claude agents (or press the left arrow from a session) to open one screen for every background session: waiting on you, still working, or done. Peek the last turn, answer a permission inline, or press enter to attach to the full transcript. Background the current session with /bg, or start detached with claude --bg [task].
Dispatch several bounded tasks (optionally each with a skill), then return to a list of PRs or findings ready to review.
PR watchers, dashboard refreshers, and other looping jobs stay visible with status — jump in only when one needs you.
From a mid-task session, open agent view, ask a quick codebase question elsewhere, then arrow back. Peek shows the answer when it lands.
Status words and peek titles make it obvious which sessions produced a PR versus which are still blocked on a decision.
Value tip: keep each background session narrowly scoped and named (/rename). Parallel sessions multiply usage the same way parallel humans do — agent view reduces the cognitive tax, not the token bill.
The redesigned Claude Code desktop app is built for the same orchestrator seat: a sidebar of active sessions (filter by status, project, or environment), drag-and-drop panes for terminal, diff, preview, and chat, plus an in-app file editor so you can tweak and ship without leaving the app.
⌘/Ctrl + ;) borrows context for a question without writing back into the main threadPrefer one well-scoped unit of work over five vague ones. Parallelism pays when the work units do not thrash the same files.
Automation & artifacts
Routines (research preview) run Claude Code jobs on Anthropic’s web infrastructure — scheduled, webhook-driven, or GitHub-triggered — so your laptop does not need to stay open. Artifacts turn a session into a live, org-private page you can share and republish in place.
Think of a routine as a Claude Code session that starts without you: it wakes on a schedule or an event, does bounded work under your subscription, and reports back. Caps apply per day and differ by plan; routine runs also consume normal usage.
Cron-style or calendar runs — morning triage, nightly health checks, weekly digests.
Kick off from your own systems when an external event fires (deploy finished, alert opened).
Respond to PR opens, reviews, pushes, or issue labels without babysitting the CLI on your laptop.
Label, prioritize, and draft first replies on new issues so humans start from a sorted queue.
After a release signal, smoke-check staging/prod signals and open a short status note if something looks off.
Watch open PRs for CI flakes, review comments, or missing checklist items and nudge or patch within policy.
From Anthropic’s routines announcement — treat as order-of-magnitude, not a billing guarantee. Exact limits can change.
| Plan | Rough daily cap |
|---|---|
| Pro | ~5 / day |
| Max | ~15 / day |
| Team / Enterprise | ~25 / day |
/schedule from the CLI to set up a recurring or event-tied jobArtifacts turn session context into a live, shareable page — PR walkthroughs, incident timelines, design notes — that can republish in place as the story updates. Published artifacts can also call each viewer’s own MCP connectors on open, so a dashboard pulls live data (and can take approved actions) instead of freezing a one-time snapshot. Viewers approve connector access before the first call.
A durable narrative of what changed and why, linked from the pull request.
A living postmortem draft that updates as investigation continues.
Name the connector in the prompt so the page refreshes from GitHub, Notion, or your own tools on each view.
Public links when you need them; editor roles on Team/Enterprise for shared editing.
By default, routines and Claude Code on the web use Anthropic-hosted compute. Team and Enterprise orgs that need sessions next to internal networks, custom toolchains, or compliance boundaries can deploy self-hosted environments (public beta): runners inside your network pick up sessions from web, mobile, desktop, or routines. Prefer hosted unless you have a concrete network or compliance reason — self-hosting needs a platform team to own images and capacity.
Quality
The cheapest bug is the one Claude catches inside the session. Anthropic’s Claude Code team now does most review before a pull request exists — and reports more merged PRs with fewer reverts.
A test command, a build, a linter, or a screenshot to compare against. Put these in a short CLAUDE.md so every session knows how to prove its work.
Request the actual command output in the reply. A claim of success without a run is the most common way bad changes slip through.
Spin up a subagent (or run /code-review and /security-review) that sees only the diff, not the reasoning that produced it. Fresh eyes catch what the author session rationalized.
If the same comment keeps appearing, move it into CLAUDE.md, a lint rule, a skill, or a REVIEW.md file instead of correcting it by hand each time.
Each layer filters some problems; bar width shows how much is still in flight (illustrative).
A failed check found now costs one more turn. Found after merge it costs a revert, a new session, and re-loading all the context you already paid for.
Quick pass for routine edits, a deep one where a miss is expensive. Keep auth, billing, CI and release paths behind a human via CODEOWNERS; a bot approval never replaces a required person.
Verification loops are what let you run many sessions in parallel instead of checking every diff yourself. Flaky tests teach the agent to re-run instead of fix, and slow ones get run less, so invest in a few fast, trustworthy kinds.
Drives a real user flow; hard to fool because the feature either works or it doesn’t. Shows what broke, not just a timeout.
State a rule that must always hold (round-trip, invariant, idempotent, matches a naive version) and let a library throw thousands of inputs at it.
Feed old and new systems the same random or sampled inputs; any difference is a bug or an approved change.
Put a skill named verify in .claude/skills/ near the code, explaining how to boot and drive the app. Claude reaches for it before committing; keep it fast and solid.
Let Claude fix failing checks itself, but stop and hand over if a check is still red after three rounds.
Tests, build and lint run locally before a PR, so shared CI and review time is not spent on bugs the session could catch.
A change must never be able to edit the rule that judges it. Keep gating rules on the base branch.
No retries, sleeps or skips to turn red green. Find the root cause, or remove the test and record why.
Log what a new gate would block, review false positives, then enforce, with a written escape hatch so Claude never gets stuck.
For load, failure and memory work, one long-running session acts as a coordinator: pick a failure scenario (kill a node, stall the database, deploy mid-spike), run the load script, read telemetry, propose a fix, ship it to staging, repeat. Subagents take the parallel pieces. Anthropic used this pattern for weeks before a large launch, so it pays off only with a real staging copy and clean metrics.
Ask for a result (“survive 10× real traffic on staging”), not a list of fixes. The agent picks the next failure to chase.
Two or three rules that must never break, e.g. “acknowledged edits are never lost”. Put them in the kickoff prompt or CLAUDE.md so they survive compaction.
Reversible changes (a query rewrite, a flag) Claude ships to staging itself. Schema, storage layout and other one-way doors: stop, list options, recommend one, wait.
Connect your observability MCP and let Claude add missing telemetry every loop. Fewer opaque dependencies means each number traces back to code it can change.
| Watch for | What to do |
|---|---|
| Goal drift after many loops | Keep the goal and invariants written down where every compaction reloads them; restate only if the agent wanders. |
| Token burn | Watch /usage hourly. If the coordinator and subagents cost too much, one agent running the same loop also works. |
| Fixes reaching prod | Ship hardening fixes behind runtime flags so the scenarios you rehearsed become a flag flip in prod. |
Scale
Don’t make Claude invent a map of the whole monorepo every session. For day-to-day work, scope the workspace. For language or framework ports, invest in the process loop — rules, judges, and adversarial review — not one-off file rewrites.
Open Claude Code where the work lives. Smaller trees mean fewer accidental file pulls and clearer defaults.
Local test/lint/build recipes and module conventions beat one giant root file for every package.
Maintain a short map of domains, entrypoints, and “ask before editing” zones. Link it from CLAUDE.md.
Prefer go-to-definition and symbol search over dumping huge grep results into context.
Anthropic’s internal ports treat migration as fixing the loop that produces code: a rulebook agents follow, mechanical verification that grades both sides, and adversarial reviewers that catch drift. Pair with dynamic workflows when the work shards into hundreds of parallel units.
Build a portable referee (tests, parity harness, or scenario diffs) that can score old and new code the same way before you fan out translation.
Write translation rules, a dependency map for batch order, and a gap inventory for idioms the new language will not forgive.
Translate a tiny slice (or attack the redesign doc) only to harden rules. Throw the trial output away; do not ship the shakedown cruise.
Implement in parallel batches, keep reviewers adversarial in fresh contexts, and promote recurring mistakes into the rulebook instead of hand-patching files.
Let compiler errors, crashes, and behavior diffs write the queue. Serialize expensive rebuilds; fix patterns upstream and regenerate touched batches.
Use smaller models for high-volume implementer fan-out; reserve the strongest models for rule writing and review. Track tokens — big migrations are expensive by design.
Practical defaults: make “done” mean an artifact exists on disk so runs resume cleanly; front-load human time on the rulebook and stress test; ignore one-off failures and chase patterns.
Reference
Commands and gestures you’ll reach for when optimizing session value.
| Command | What it does |
|---|---|
/clear | Wipe conversation; start a distinct task with a clean context |
/compact | Summarize history to free window space (costs a rewrite) |
/context | Show what is loaded (CLAUDE.md, skills, MCP, etc.) |
/model | Select model (default stays Opus 5.5; /model sonnet → Sonnet 5.5 from v2.1.284; /model fable → Fable 5.2 from v2.1.321) — set at session start to protect cache |
/effort | Dial how much work before check-in (low→medium→high→xhigh); on Opus 5.5 / Fable 5.1 mid-session changes keep cache |
/effort status | Show the session’s current effort level (re-check after model upgrades) |
/effort ultracode | Toggle Ultracode on/off (Tab in /effort) — auto dynamic workflows; no longer forces xhigh (v2.1.284+) |
subagent effort | Ask for a subagent at a set effort (e.g. “run a low-effort Haiku 5.5 agent to scan logs”), v2.1.292+; set CLAUDE_CODE_SUBAGENT_EFFORT for a default subagent level instead of inheriting the session (v2.1.316+) |
autoCompactWindow | Subagent frontmatter field: let a long worker compact earlier than the main session (v2.1.296+) |
/usage · /cost | Session token and cost readout — compare Sonnet 5.5 vs Opus 5.5 and effort; flags max effort, workflows, always-on context, big tool results (v2.1.299+); press f to apply the suggested one-line fixes (v2.1.305+) |
idleCompaction | settings.json switch (default on, v2.1.299+): auto-compact 200K+ idle chats before the 1h cache expires; threshold via CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS |
/claude-api prompt-audit | Scan CLAUDE.md / skills for prompting anti-patterns after a model migration |
ultrathink (keyword) | Run one turn at xhigh effort without changing session effort; typed mid-turn it raises the rest of that turn (v2.1.311+ terminal, v2.1.316+ VS Code) |
ultracode (keyword) | Opt one prompt into a dynamic workflow without changing session effort |
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 | Experimental Code Mode (v2.1.323+): Claude writes JavaScript that batches many tool calls in one step; Ctrl+O shows the code |
/mcp | Manage MCP server connections and tools |
/agents | Configure custom agents under .claude/agents/ (not the same as agent view) |
claude agents | Open agent view — dashboard of background sessions waiting on you or still working |
/bg | Background the current session into agent view without ending it |
claude --bg … | Launch a fresh session already detached into agent view |
Projects (cloud) | Coordinator + threads with shared memory/library — Claude scopes, delegates, and assembles a multi-part goal |
/fork | Copy the conversation into a new background session while you keep working |
fork subagents | Subagents that inherit the current conversation; on by default everywhere since v2.1.302 (CLAUDE_CODE_FORK_SUBAGENT=0 turns them off) |
/skill-doctor | See which loaded skills go unused and what they cost in context |
/config | Enable dynamic workflows on Pro; other Claude Code settings |
/init | Bootstrap a CLAUDE.md for the project |
AGENTS.md | Shared agent instructions — used when no CLAUDE.md is on the path (v2.1.277+); or @-import from CLAUDE.md |
/memory | Open instruction files, toggle auto memory, browse Claude’s saved notes |
/config · Project instructions | Choose CLAUDE.md only, AGENTS.md fallback, or both files together |
/skill-creator | Scaffold or refine an on-demand skill (instructions + scripts + assets) |
/code-review · /security-review | Run a local review pass on your diff before opening a PR — pair with a fresh-context subagent |
REVIEW.md | Short repo-specific review rules: what “broken” means, paths to skip, evidence required |
/auto-mode-setup | Guided setup that teaches auto mode about your environment from the project and recent sessions (v2.1.304+) |
/verify | Run or attach verification so work is not done until checks pass |
.claude/skills/verify | A repo skill describing how to boot and drive your app end to end; Claude uses it to smoke-test before committing |
hardening loop | One coordinator session + observability MCP repeatedly breaks staging and fixes it; state invariants up front and make it stop for hard-to-undo changes |
/goal | Keep working across turns until a completion check resolves (unattended loops) |
/schedule | Create a routine: scheduled, webhook, or GitHub-triggered Claude Code job |
/rename | Name the session for later recall |
/rewind | Trim the end of history without full rewrite (cache-friendlier) |
Shift+Tab | Cycle permission modes (auto mode helps long workflow runs) |
@file | Attach a file into context (prefer over typing bare paths) |
Ctrl+B | Background a long-running command while you continue |
Attribution
This guide synthesizes themes from Anthropic’s Claude Code blog posts. Read the originals for authoritative detail; copy here is original educational paraphrase.