AI Tools
Tutorial11 minMarch 24, 2026By AIGCDev

Claude Sonnet 4.6 Prompting Best Practices for Code Review & Planning

Quick Answer

Yes, Claude Sonnet 4.6 is now good enough to be the default first pass for large-repo code review and planning, but the highest-leverage workflow is still review first, patch second. As of 2026-03-24, Anthropic says Sonnet 4.6 is the default model for Free and Pro users in Claude, available in Claude Code and the API, priced at $3 input / $15 output per million tokens, and documented with up to a 1M-token context window plus 64K max output. Anthropic still positions Opus 4.6 as the stronger choice for deep refactoring, multi-agent coordination, and tasks where being wrong is expensive.

The safest practical loop looks like this:

  • put stable repo rules in CLAUDE.md
  • start in Plan Mode or a read-only review pass
  • ask for the repo map, unknowns, and failure modes before any code
  • approve a bounded file list and test list
  • apply the patch separately
  • run /review or an equivalent diff review before merge

One nuance matters: Anthropic's current docs treat the 1M context window as a real capability, but the context-window docs still describe it as a beta/API feature. Treat long context as a comfort boost, not permission to skip scope control.

What Changed with Sonnet 4.6

Anthropic announced Sonnet 4.6 on 2026-02-17. The useful change is not just that Sonnet got better at coding. The more important shift is that the surrounding Claude Code workflow is now much easier to keep explicit.

Sonnet 4.6 gives you a cheaper first pass on repo understanding, risk review, and planning. Claude Code adds the pieces that keep that pass from turning into chat-only folklore: CLAUDE.md memory, built-in slash commands such as /init and /review, Plan Mode, and reusable project commands or skills.

That combination makes a practical large-repo workflow possible:

  • shared rules live in the repository, not only in chat history
  • review and planning happen before editing
  • the model has a written boundary it should not cross
  • the final patch is still checked against tests and a diff

What The Official Sources Actually Change

Official detail Why it matters for large-repo review
Sonnet 4.6 is the default in Claude Free and Pro, and Anthropic says it is available across Claude plans, Claude Code, the API, and major clouds More developers can try the same workflow without special setup
Sonnet pricing stays at $3 input / $15 output per million tokens A planning-first pass is cheap enough to use daily
Opus 4.6 is listed at $5 input / $25 output per million tokens and positioned as the strongest choice for deep reasoning You have a clear escalation rule instead of using the expensive model by default
Anthropic's model docs list Sonnet 4.6 with 64K max output Long review notes, plans, and issue lists fit in one response
Anthropic's release note and context docs describe 1M context as beta, while the model docs list Sonnet 4.6 with 1M context support Large repos and long specs are more realistic, but you should not assume 1M is universally available on every surface
Anthropic documents adaptive thinking and extended thinking for Sonnet 4.6 You can raise reasoning effort on ambiguous tasks before switching models
Anthropic still positions Opus 4.6 as the better model for codebase refactoring, multi-agent coordination, and exacting high-stakes work Sonnet should be your default reviewer, not your final approval gate

One practical takeaway is easy to miss: long context helps only when the boundary is already clear. It does not remove the need for a shortlist of files, explicit unknowns, and an outside verification step.

When Sonnet 4.6 Is The Right Default

Use Sonnet 4.6 first when all of these are true:

  • you need to understand an existing repository before changing it
  • the task can be reduced to review, planning, or a bounded edit
  • you can name the verification step before the patch exists
  • a wrong first pass is annoying, not catastrophic

Good fits:

  • mapping a repo before a bug fix
  • reviewing a pull request for likely breakpoints
  • tracing shared logic before a bounded refactor
  • comparing two implementation options against existing conventions
  • extracting a test plan from a large diff or ticket

Bad fits:

  • auth, billing, security, or compliance changes
  • schema migrations and rollback-sensitive data work
  • cross-system refactors with hidden second-order effects
  • incidents where the root cause is still unclear
  • tasks that depend on product intent nobody has written down

The Best Claude Code Workflow For Large Repos

Step 1: Put the stable repo rules in CLAUDE.md

Anthropic's Claude Code docs explicitly support a project memory file named CLAUDE.md, and the memory docs also support importing other files with @path. That is a better place for stable review rules than repeating the same prompt every session.

A small example is enough:

# Review defaults

Read @README.md for architecture and @package.json for scripts.

- Map files and unknowns before suggesting edits.
- Prefer the smallest diff that solves the task.
- Name tests and manual checks explicitly.
- Stop if the task crosses a public API, schema, or auth boundary.

If the repo does not have a CLAUDE.md yet, Anthropic documents /init as the built-in command that can help bootstrap it.

Why this matters:

  • the rules survive across sessions
  • new review runs inherit the same boundary
  • human teammates can inspect and edit the workflow itself

Step 2: Start in Plan Mode or a read-only pass

If you are in Claude Code, Plan Mode is the safest first move because it keeps the model in analysis mode before any patch gets written.

A concrete CLI entry point is:

claude --permission-mode plan

A good first prompt is:

Analyze this repository task in review mode.

Return only:
1. the files or directories to inspect first
2. the architecture you infer from them
3. what is still unclear
4. likely failure modes
5. whether this should stay on Sonnet 4.6 or escalate

Do not write code yet.

Task:
[paste the ticket, bug, or PR description]

This step does three jobs at once:

  • it forces repo reading before implementation
  • it creates a file shortlist you can verify yourself
  • it makes uncertainty explicit instead of hiding it inside a confident patch

If you are not using Claude Code, keep the same structure in Claude chat or the API. The important part is not the UI. The important part is separating analysis from editing.

Step 3: Ask for a risk-first review, not a fix

Once Sonnet has the repo map, ask it to look for ways the patch could go wrong.

Based on the repository context you gathered, review this task as if you were trying to prevent a bad patch.

Return:
- likely files affected
- public contracts that might break
- hidden dependencies or assumptions
- tests and manual checks that must pass
- one reason to stop before editing

Do not write code yet.

This is the highest-value Sonnet step in day-to-day work. The model is fast enough to cover a lot of surface area, and the cost is low enough that you can afford to reject the plan before anyone touches a file.

If the answer still feels guessy, that is the signal to either raise thinking effort or escalate to Opus instead of forcing Sonnet to keep going.

Step 4: Make Sonnet produce the smallest safe plan

After the review pass, ask for the narrowest implementation path that still solves the task.

Now produce the smallest safe implementation plan.

Constraints:
- touch no more than 5 files unless you hit a blocker
- preserve public API names unless change is unavoidable
- avoid new dependencies
- stop if the fix implies an architecture or schema change

Return only:
1. files to edit
2. exact change summary by file
3. tests or commands to run
4. what would make this plan invalid

This is where Sonnet 4.6's longer output and better instruction following help. A bounded plan is more useful than a clever patch because it is legible, comparable, and easy to reject.

Step 5: Keep the thinking loop separate from the editing loop

Do not let the same session both discover the architecture and quietly rewrite half the repository.

The safer sequence is:

  1. Sonnet maps the repo
  2. Sonnet writes a risk review
  3. Sonnet writes a bounded plan
  4. you or another tool applies the patch
  5. Sonnet reviews the resulting diff

If you are already inside Claude Code, Anthropic documents /review as a built-in command. That makes it a natural final pass after the diff exists.

You can also use a plain diff-review prompt:

Review this diff against the approved plan.

Flag:
- scope drift
- duplicated logic
- missing tests
- claims the patch does not actually prove
- places where the repository's conventions were ignored

Separating the loops keeps the workflow legible. It also makes it much harder for the model to redefine the task mid-session without being noticed.

Step 6: Use long context as a bonus, not a crutch

Sonnet 4.6's long-context story is real, but the fine print matters. Anthropic's current context-window docs still describe 1M context as a beta feature for Claude Sonnet 4 in the API, while the model overview lists Sonnet 4.6 with 1M context support.

The safe operational rule is:

  • assume structured prompts matter more than raw context size
  • use 1M context only when you genuinely need a large spec, PR, logs, and code together
  • keep asking for file shortlists and unknowns even in long-context sessions

If the session starts to sprawl, reset the boundary. Anthropic also documents /compact, which is useful for carrying forward the approved plan instead of the entire wandering conversation.

How To Choose Between Standard Sonnet, Higher Thinking, And Opus

Anthropic's current positioning makes the routing rule fairly clear.

Situation Best first move Why
repo orientation, file discovery, first-pass PR review Sonnet 4.6 standard Fast, cheap, and usually sufficient
ambiguous but still bounded bug or refactor Sonnet 4.6 with more thinking effort Better reasoning without immediately paying Opus cost
high-risk architecture change or multi-system refactor Opus 4.6 Anthropic still positions Opus as the stronger model for deeper reasoning
final sign-off on a costly production change Opus 4.6 or human review The mistake cost matters more than speed
unclear product intent or business rule human decision first No model can invent the right requirement

The key idea is simple: Sonnet is the default reviewer and planner. Opus is the escalation path when the expensive part of the task is judgment.

A Copyable Daily Prompt Stack

If you only want one repeatable workflow, use this stack.

Prompt 1: Repo map

Read this repository context and identify the smallest set of files I should inspect first.
Explain the architecture in plain English, list unknowns, and do not propose fixes yet.

Prompt 2: Risk review

Review this task for likely regressions, hidden dependencies, and tests that must pass.
Prefer warnings over solutions.

Prompt 3: Bounded plan

Produce the smallest safe plan.
List exact files to touch, what changes in each file, and what would make this plan invalid.

Prompt 4: Diff review

Review this diff against the original plan.
Flag:
- scope drift
- duplicated logic
- missing tests
- claims the patch does not actually prove

That stack is intentionally boring. Boring is good. It keeps Sonnet working as a reviewer and planner instead of as an overconfident autopilot.

Common Failure Modes

Failure mode What actually goes wrong Practical fix
treating long context as guaranteed understanding A 1M-token context window lets you load more material, but it does not prove the model understood the repo correctly always ask for unknowns, weak assumptions, and the smallest relevant file list
keeping repo rules only in chat The next session has to relearn the same boundaries, so the workflow gets less consistent over time store durable rules in CLAUDE.md, not just in prompts
asking for implementation before review The model optimizes for momentum instead of correctness and starts patching too early force a repo map and risk review first
letting the model change scope quietly Large-context models can justify broad rewrites because they see more cleanup opportunities than you asked for require an exact file list and reject scope expansion unless the reason is concrete
using Sonnet where only a human decision will do No model can invent product intent or hidden business rules that nobody has written down use Sonnet to expose tradeoffs, then make the decision yourself

FAQ

When should you escalate from Sonnet to Opus?

Escalate when the expensive part of the task is judgment instead of reading speed. That usually means high-risk architecture work, multi-system refactors, risky production sign-off, or any task where one wrong assumption is costly.

Do you need the 1M-token context window to use this workflow?

No. The workflow still works with smaller context windows because the real gain comes from structure: file shortlist, unknowns, risk review, and bounded plan. The 1M beta window mainly makes big sessions more comfortable when it is available.

Should you start with /review or Plan Mode?

Start with Plan Mode or a read-only analysis pass. Use /review after a diff exists.

Should every repo have a CLAUDE.md?

If you use Claude Code repeatedly on the same repository, yes. A small CLAUDE.md is usually a better long-term investment than retyping the same rules in every session.

Bottom Line

Claude Sonnet 4.6 is worth using now because it makes the cheapest part of AI-assisted development much better: understanding the repo before you touch it.

Use Sonnet 4.6 as the default reviewer and planner for large repositories. Keep stable rules in CLAUDE.md, keep the patch bounded, keep verification outside the model, and save Opus for the changes where being wrong is more expensive than being slow.

Verification Note

Verified on 2026-03-24. Checked Anthropic's official Sonnet 4.6 announcement for the 2026-02-17 launch date, default availability in Claude, availability across Claude Code and the API, Sonnet pricing staying at $3 input / $15 output per million tokens, 1M-context beta language, and Opus-versus-Sonnet positioning: https://www.anthropic.com/news/claude-sonnet-4-6. Checked Anthropic's official models overview for current Sonnet 4.6 and Opus 4.6 positioning, max output, and thinking-mode support: https://platform.claude.com/docs/en/about-claude/models/overview. Checked Anthropic's official context-window docs for the current 1M-context beta scope and API requirements: https://docs.anthropic.com/en/docs/build-with-claude/context-windows. Checked Anthropic's official Claude Code docs for CLAUDE.md memory, @path imports, /init, /review, /compact, and common workflow guidance: https://docs.anthropic.com/en/docs/claude-code/memory, https://docs.anthropic.com/en/docs/claude-code/slash-commands, and https://docs.anthropic.com/en/docs/claude-code/common-workflows. Checked Anthropic's official pricing page for current Claude pricing context: https://claude.com/pricing.

claudecode-reviewdeveloper-workflowpromptinglarge-codebaseai-coding