Prompting Claude Sonnet 5
Source: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-sonnet-5
— snapshot 2026-07-03. If this snapshot is >60 days old and you're doing high-stakes prompt work,
re-fetch and reconcile against the live page.
Sonnet 5 performs well out of the box on existing Sonnet 4.6 prompts, but a few API-level changes will hard-
error or silently truncate if you migrate a 4.6 call unchanged — those are up top. Source: Anthropic's
Prompting Claude Sonnet 5 guide, tuned to Claude Code subagent selection + n8n/OpenRouter-style API paths.
⚠️ Migrating a 4.6 call? Four things break or shift first
- Sampling params now 400-error. Setting
temperature, top_p, or top_k to any non-default value
returns a 400 on Sonnet 5 (new for Sonnet-class). Remove them. For tone/variety, steer via the
system prompt instead (see design section for the variety pattern). Audit any n8n HTTP nodes / API
wrappers — a hardcoded temperature there will now fail the call.
- New tokenizer ≈ +30% tokens for the same text.
max_tokens limits tuned for 4.6 can now truncate
equivalent output. Raise max_tokens. Exact inflation depends on content.
- Manual extended thinking is removed.
thinking: {type:"enabled", budget_tokens:N} returns a 400
(deprecated on 4.6, gone now). Use adaptive thinking + the effort parameter instead.
- Adaptive thinking is ON by default. A request with no
thinking field now runs with adaptive thinking
— a change from 4.6, where the same request ran with none. Consequences: (a) revisit max_tokens for
workloads that ran thinking-off on 4.6; (b) on long tasks thinking can eat the budget, giving a response
that's mostly thinking then a truncated answer + stop_reason: "max_tokens" — raise max_tokens or drop
to medium. To turn it off entirely: thinking: {type:"disabled"}. If it thinks more often than you like
(big system prompts trigger it), steer: "Thinking adds latency; use it only when it meaningfully improves
answer quality — typically multi-step reasoning. When in doubt, respond directly."
Effort
- Default
high (same as 4.6). xhigh for the hardest coding/agentic work. medium/low for
cost/latency, respected strictly — at low/medium it scopes to exactly what's asked; moderately complex
work at low risks under-thinking. Fix shallow reasoning by raising effort, not prompting around it.
- Cross-model mapping when migrating: Sonnet 5 at
medium ≈ Sonnet 4.6 at high; Sonnet 5 at high ≈
Sonnet 4.6 at max. Benchmark by observed thinking length, not effort name.
- Leave headroom in
max_tokens at high/xhigh/max — adaptive thinking can take a large share on
long tasks (see gotcha #4).
Tools, verbosity, literalism, tone
- More agentic than 4.6 — reaches for tools + self-verification loops more readily. But with thinking
disabled it's less likely to reach for tools or consider searching — if you rely on tool calls thinking-
off, add an explicit nudge. Effort is also a lever:
high/xhigh → substantially more tool use in
agentic search/coding.
- Verbosity calibrated to task complexity — tune with "Provide concise, focused responses…"; positive
concision examples beat "don't" lists.
- Literal instruction-following, especially at lower effort — won't generalize an instruction across
items or infer unasked requests. State scope explicitly ("apply to every section, not just the first").
Great for tuned extraction/pipelines.
- Tone may shift on long-form; if you rely on a specific voice, re-check against the new baseline and add
it explicitly ("warm, collaborative; acknowledge the framing first").
Design + frontend
Sonnet 5 can settle into a fixed default house-style on open-ended briefs — fine for some, off for dashboards
/ dev tools / fintech / healthcare / enterprise. Generic negatives just swap one fixed palette for another.
Two reliable moves (same as Opus 4.8):
- Concrete alternative spec — it follows explicit hex/typeface/radius/spacing specs precisely.
- Propose-4-directions-first — and since
temperature is unavailable here, this is the recommended way
to get real variety across runs: "Before building, propose 4 distinct directions (bg hex / accent hex /
typeface + one-line rationale). I'll pick one, then build only that."
Anti-slop snippet still useful:
<frontend_aesthetics>
NEVER use generic AI aesthetics: overused fonts (Inter, Roboto, Arial, system), cliché schemes (purple
gradients on white/dark), predictable layouts, cookie-cutter components. Use unique fonts, cohesive themes,
and animation for micro-interactions.
</frontend_aesthetics>
Code-review harnesses (recall looks lower — harness effect)
Same as Opus 4.8: told "only high-severity / be conservative / don't nitpick", Sonnet 5 follows it faithfully
— same investigation depth, fewer findings reported. Separate coverage from filtering:
Report every issue you find, including uncertain or low-severity ones. Do not filter for importance or
confidence at this stage — a separate step does that. Goal here is coverage. For each, include confidence +
estimated severity for a downstream filter to rank.
For single-pass self-filter, set a concrete bar ("could cause incorrect behavior, a test failure, or a
misleading result; omit only style/naming nits"), not qualitative words. Validate against a subset of evals.
Interactive coding + computer use
- Interactive multi-turn uses more tokens than autonomous single-turn. Maximize performance + efficiency:
xhigh/high, an auto mode, and fully specify task + intent + constraints in the first turn to
minimize human turns.
- Computer use: tool version
computer_20251124, up to 2576px / 3.75MP; 1080p is the sweet spot,
720p / 1366×768 for cost-sensitive runs.
1---2name: prompting-sonnet-53description: How to prompt and scaffold Claude Sonnet 5 — the migration-from-4.6 API breakers (sampling params now error, new tokenizer inflates tokens ~30%, extended-thinking budgets removed), adaptive-thinking-on-by-default, effort mapping, tool-use triggering, and design/code-review tuning. Use when starting Sonnet 5 work, picking Sonnet as a subagent model, migrating a 4.6 prompt or n8n/API call, hitting a 400 error on temperature, or seeing max_tokens truncation.4---56# Prompting Claude Sonnet 578> Source: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-sonnet-59> — snapshot 2026-07-03. If this snapshot is >60 days old and you're doing high-stakes prompt work,10> re-fetch and reconcile against the live page.1112Sonnet 5 performs well out of the box on existing Sonnet 4.6 prompts, but a few **API-level changes will hard-13error or silently truncate** if you migrate a 4.6 call unchanged — those are up top. Source: Anthropic's14*Prompting Claude Sonnet 5* guide, tuned to Claude Code subagent selection + n8n/OpenRouter-style API paths.1516## ⚠️ Migrating a 4.6 call? Four things break or shift first17181. **Sampling params now 400-error.** Setting `temperature`, `top_p`, or `top_k` to any non-default value19 returns a **400** on Sonnet 5 (new for Sonnet-class). **Remove them.** For tone/variety, steer via the20 system prompt instead (see design section for the variety pattern). Audit any n8n HTTP nodes / API21 wrappers — a hardcoded `temperature` there will now fail the call.222. **New tokenizer ≈ +30% tokens for the same text.** `max_tokens` limits tuned for 4.6 can now truncate23 equivalent output. **Raise `max_tokens`.** Exact inflation depends on content.243. **Manual extended thinking is removed.** `thinking: {type:"enabled", budget_tokens:N}` returns a **400**25 (deprecated on 4.6, gone now). Use **adaptive thinking + the effort parameter** instead.264. **Adaptive thinking is ON by default.** A request with no `thinking` field now runs with adaptive thinking27 — a change from 4.6, where the same request ran with none. Consequences: (a) revisit `max_tokens` for28 workloads that ran thinking-off on 4.6; (b) on long tasks thinking can eat the budget, giving a response29 that's mostly thinking then a truncated answer + `stop_reason: "max_tokens"` — raise `max_tokens` or drop30 to `medium`. To turn it off entirely: `thinking: {type:"disabled"}`. If it thinks more often than you like31 (big system prompts trigger it), steer: "Thinking adds latency; use it only when it meaningfully improves32 answer quality — typically multi-step reasoning. When in doubt, respond directly."3334## Effort3536- **Default `high`** (same as 4.6). **`xhigh`** for the hardest coding/agentic work. `medium`/`low` for37 cost/latency, respected strictly — at `low`/`medium` it scopes to exactly what's asked; moderately complex38 work at `low` risks under-thinking. **Fix shallow reasoning by raising effort, not prompting around it.**39- **Cross-model mapping when migrating:** Sonnet 5 at `medium` ≈ Sonnet 4.6 at `high`; Sonnet 5 at `high` ≈40 Sonnet 4.6 at `max`. Benchmark by **observed thinking length**, not effort name.41- Leave **headroom in `max_tokens`** at `high`/`xhigh`/`max` — adaptive thinking can take a large share on42 long tasks (see gotcha #4).4344## Tools, verbosity, literalism, tone4546- **More agentic than 4.6** — reaches for tools + self-verification loops more readily. But **with thinking47 disabled it's less likely to reach for tools or consider searching** — if you rely on tool calls thinking-48 off, add an explicit nudge. Effort is also a lever: `high`/`xhigh` → substantially more tool use in49 agentic search/coding.50- **Verbosity calibrated to task complexity** — tune with "Provide concise, focused responses…"; positive51 concision examples beat "don't" lists.52- **Literal instruction-following**, especially at lower effort — won't generalize an instruction across53 items or infer unasked requests. State scope explicitly ("apply to every section, not just the first").54 Great for tuned extraction/pipelines.55- **Tone** may shift on long-form; if you rely on a specific voice, re-check against the new baseline and add56 it explicitly ("warm, collaborative; acknowledge the framing first").5758## Design + frontend5960Sonnet 5 can settle into a fixed default house-style on open-ended briefs — fine for some, off for dashboards61/ dev tools / fintech / healthcare / enterprise. Generic negatives just swap one fixed palette for another.62Two reliable moves (same as Opus 4.8):63- **Concrete alternative spec** — it follows explicit hex/typeface/radius/spacing specs precisely.64- **Propose-4-directions-first** — and since `temperature` is unavailable here, this is *the* recommended way65 to get real variety across runs: "Before building, propose 4 distinct directions (bg hex / accent hex /66 typeface + one-line rationale). I'll pick one, then build only that."6768Anti-slop snippet still useful:69```70<frontend_aesthetics>71NEVER use generic AI aesthetics: overused fonts (Inter, Roboto, Arial, system), cliché schemes (purple72gradients on white/dark), predictable layouts, cookie-cutter components. Use unique fonts, cohesive themes,73and animation for micro-interactions.74</frontend_aesthetics>75```7677## Code-review harnesses (recall looks lower — harness effect)7879Same as Opus 4.8: told "only high-severity / be conservative / don't nitpick", Sonnet 5 follows it faithfully80— same investigation depth, fewer findings reported. Separate coverage from filtering:81```82Report every issue you find, including uncertain or low-severity ones. Do not filter for importance or83confidence at this stage — a separate step does that. Goal here is coverage. For each, include confidence +84estimated severity for a downstream filter to rank.85```86For single-pass self-filter, set a concrete bar ("could cause incorrect behavior, a test failure, or a87misleading result; omit only style/naming nits"), not qualitative words. Validate against a subset of evals.8889## Interactive coding + computer use9091- **Interactive multi-turn uses more tokens** than autonomous single-turn. Maximize performance + efficiency:92 `xhigh`/`high`, an auto mode, and **fully specify task + intent + constraints in the first turn** to93 minimize human turns.94- **Computer use:** tool version `computer_20251124`, up to 2576px / 3.75MP; **1080p** is the sweet spot,95 720p / 1366×768 for cost-sensitive runs.