Source: Claude Docs Prompting Best Practices 2026 04 17 (Anthropic platform docs — https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md)

The authoritative Anthropic prompting reference for the current generation — Opus 4.7, Opus 4.6, Sonnet 4.6, Haiku 4.5. Covers Opus 4.7-specific calibrations (verbosity, effort levels, literalism, tool triggering, subagent spawning, design defaults, code review recall), general prompt engineering principles (clarity, examples, XML structure, long context), output/formatting control, tool use patterns, thinking and adaptive-thinking migration, agentic-system prompts (long-horizon reasoning, autonomy/safety, research, subagent orchestration, overengineering), capability-specific tips (vision, frontend), and explicit migration guidance.

Key Takeaways — Opus 4.7 specifics

  • Verbosity is task-calibrated. Opus 4.7 decides length based on judged complexity. Shorter on simple lookups, much longer on open-ended analysis. If your product needs a specific shape, state it explicitly — positive examples beat negative instructions.
  • xhigh is the new default sweet spot. Between high and max. “Best for most coding and agentic use cases.” max may overthink.
  • Effort is respected more strictly at the low end. low/medium now scope work to what was asked, not what was implied. Risk of under-thinking on moderately complex tasks at low. If you see shallow reasoning, raise effort rather than prompt around it.
  • Adaptive thinking is steerable by prompt — give explicit guidance if thinking is firing too often on complex system prompts.
  • Set a large max output budget at max/xhigh. Anthropic recommends starting at 64k tokens and tuning.
  • Tool use triggers less often. 4.7 reasons more, tools less. If a workflow depends on tool-heavy exploration, explicitly tell the model to use the tools and describe why.
  • Progress updates are now regular and higher-quality. Remove scaffolding like “After every 3 tool calls, summarize progress” — it’s no longer needed.
  • Literal instruction following. 4.7 does NOT silently generalize. State scope explicitly: “Apply this formatting to every section, not just the first one.”
  • Tone is more direct / less validation-forward than 4.6. Fewer emoji. If voice matters, re-evaluate style prompts.
  • Subagents spawn less by default. Steerable: tell Claude when to spawn (fanning out, reading multiple files) and when not to (single-response refactor work).
  • Strong default design style: cream/off-white backgrounds, serif display type, terracotta accent. Reads well for editorial/portfolio, wrong for dashboards/fintech/enterprise. Persistent — generic “don’t use cream” shifts to another fixed palette. Two approaches that work: specify a concrete alternative spec, or have the model propose 4 options before building.
  • Interactive coding uses more tokens than async coding because 4.7 reasons more after each user turn. Counter with xhigh/high + auto-mode + fewer human interactions + well-specified first-turn task.
  • Bug-finding is meaningfully better (+11pp recall on hard Anthropic-PR eval). If your review harness was tuned for an older model and says “only report high-severity,” 4.7 may follow faithfully and self-filter. Prompt for coverage: “Report every issue you find, including uncertain and low-severity ones.”
  • Computer use up to 2576px / 3.75MP. 1080p is the cost/performance sweet spot; 720p or 1366×768 for cost-sensitive.

Key Takeaways — General principles

  • Golden rule: “Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they’d be confused, Claude will be too.”
  • Tell Claude what TO do, not what not to do. “Respond in smoothly flowing prose paragraphs” > “Don’t use markdown.”
  • Add context/motivation. “Don’t use ellipses because text-to-speech engine will mispronounce them” > “NEVER use ellipses.”
  • Examples work. 3-5 few-shot examples, wrapped in <example> / <examples> tags. Relevant, diverse, structured.
  • XML tags > freeform. Use <instructions>, <context>, <input>, <documents> with <document_content> + <source> for complex prompts.
  • Long context positioning matters. Put long-form data at TOP, queries at END. Quality goes up ~30% for complex multi-document prompts.
  • Ground long-doc tasks in quotes. Ask Claude to extract relevant quotes first, then do the task.
  • Role in system prompt focuses behavior — even one sentence (“You are a helpful coding assistant specializing in Python.”) makes a difference.

Key Takeaways — Output, formatting, tool use

  • Prefilled responses on the last assistant turn are deprecated starting 4.6. On Mythos Preview, returns 400. Migration patterns:
    • Formatting → use Structured Outputs, or ask directly
    • Eliminating preambles → “Respond directly without preamble”
    • Continuations → move into user message: “Your previous response was interrupted and ended with [previous_response]. Continue from where you left off.”
    • Context hydration → inject into user turn, or use tools
  • “Can you suggest changes?” → Claude suggests. “Change the function.” → Claude edits. Default-to-action or default-to-conservative via explicit system-prompt blocks.
  • Parallel tool calling is easily steerable to ~100%. Snippet: <use_parallel_tool_calls> block telling Claude to call independent tools in parallel.
  • Opus 4.5/4.6 overtrigger on aggressive language. CRITICAL: You MUST use this tool when... is overkill now — just say “Use this tool when…“.
  • LaTeX is the Opus 4.6 default for math. Force plain text if needed (tools that don’t render LaTeX).

Key Takeaways — Thinking and agentic systems

  • Adaptive thinking (thinking: {type: "adaptive"}) is the recommended mode on Opus 4.6 and Sonnet 4.6. Opus 4.7 only accepts adaptive. See Extended Thinking for the reference and compatibility matrix.
  • Migration from budget_tokens: move budget control to the effort parameter. budget_tokens remains functional but deprecated on 4.6.
  • On Opus 4.5/4.6 when thinking is disabled, Claude is sensitive to the word “think.” Use “consider,” “evaluate,” “reason through” instead.
  • Overthinking. Opus 4.6 explores heavily at high effort. Replace blanket “default to using [tool]” with “Use [tool] when it would enhance your understanding of the problem.” Remove “if in doubt, use tool” — overtriggers now.
  • Context awareness (4.5/4.6): Claude tracks remaining token budget. In harnesses that compact context, tell Claude context will be compacted and to save state/progress rather than stop early.
  • Multi-window workflow recipe:
    1. First context window: set up framework (tests, setup scripts)
    2. Have the model keep tests in tests.json
    3. Add init.sh for env setup
    4. Consider starting fresh vs compacting — Claude 4.x is excellent at discovering state from filesystem
    5. Provide verification tools (Playwright MCP, computer use)
    6. Encourage complete context usage
  • State management: structured JSON for test results / task status; unstructured text for progress notes; git for checkpoints and logs.
  • Autonomy/safety. Without guidance, Opus 4.6 may take irreversible actions. Use the “consider reversibility” prompt block to require confirmation before destructive/hard-to-reverse/externally-visible actions.
  • Research pattern. For hard research: clear success criteria + source verification + structured approach (competing hypotheses, confidence tracking, hypothesis tree).
  • Subagent orchestration is native in 4.x — recognize when to delegate without explicit instruction. But 4.6 may overuse. Guide: “Use subagents when tasks can run in parallel, require isolated context, or involve independent workstreams. For simple tasks, single-file edits, or tasks requiring context across steps, work directly.”
  • Prompt chaining still useful when you need to inspect intermediate outputs. Self-correction is the most common: draft → review → refine.
  • Reduce file creation. If you don’t want Claude creating scratchpad files: “If you create any temporary files for iteration, clean up at end of task.”
  • Overengineering. Opus 4.5/4.6 overengineers. Minimize via a block listing Scope / Documentation / Defensive coding / Abstractions rules (“Only make changes that are directly requested or clearly necessary…”).
  • Test-passing vs. general solution. Ask for “high-quality, general-purpose solution using standard tools. Do not hard-code. If tests are incorrect, inform me rather than working around them.”
  • Hallucination minimization in agentic coding. <investigate_before_answering> block: “Never speculate about code you have not opened.”

Key Takeaways — Capability-specific

  • Vision improved in 4.5/4.6 — especially with multiple images in context. A crop tool/skill boosts image-eval performance further (cookbook exists).
  • Frontend design. Without guidance, 4.5/4.6 default to “AI slop” aesthetics. Use the <frontend_aesthetics> block specifying typography, color/theme, motion, backgrounds, and listing banned defaults (Inter, Roboto, Arial, purple gradients, cookie-cutter layouts).

Key Takeaways — Migration (to Claude 4.6)

  1. Be specific about desired behavior
  2. Frame instructions with modifiers (“Include as many relevant features…”, “Go beyond the basics…“)
  3. Request features explicitly (animations, interactive elements)
  4. Update thinking configuration — 4.6 uses adaptive, not budget_tokens
  5. Migrate away from prefilled responses — deprecated starting 4.6
  6. Tune anti-laziness prompting — 4.6 is more proactive; old instructions overtrigger

Sonnet 4.5 → Sonnet 4.6: Sonnet 4.6 defaults to high effort (4.5 had no effort param). Set medium for most, low for high-volume/latency-sensitive. Large max output (64k) at medium/high. Use Opus 4.7 for hardest longest-horizon problems (large-scale migrations, deep research, extended autonomous work); Sonnet 4.6 optimized for fast turnaround/cost.

Quick-reference: effort tuning

LevelUse when
maxGenuinely hard problems; diminishing returns; prone to overthinking
xhigh (new)Best for most coding and agentic use cases — start here
highBalance intelligence/cost; minimum for intelligence-sensitive use cases
mediumCost-sensitive, reduce tokens with intelligence trade-off
lowShort scoped tasks, latency-sensitive

Open Questions

  • Migration guide URL. Doc references /docs/en/about-claude/models/migration-guide#migrating-to-claude-opus-4-7 but isn’t yet ingested into this wiki — separate research candidate.
  • output_config. Appears in sample code as output_config={"effort": "..."}. Not explicitly defined here; assumed to be a top-level Messages API param — confirm against current API reference.
  • Adaptive thinking triggering transparency. Docs say “steerable by prompt” but don’t quantify how much guidance shifts triggering behavior. No before/after metrics.
  • Mythos Preview access. Repeatedly referenced (summaries, display defaults) but access path not covered.
  • Verbosity control at scale. What’s the measured delta in tokens when adding the standard verbosity-reducing snippet? Docs don’t publish numbers.

Try It

  1. Migrate one prompt to 4.7. Pick a prompt you’ve tuned for 4.6. Run it on Opus 4.7 at default xhigh. Compare outputs and token usage. Note any literalism-related drift — 4.7 won’t generalize silently.
  2. Replace anti-laziness scaffolding. Grep your prompts for “CRITICAL:”, “MUST”, “if in doubt,” and similar forcing language. Dial down to conversational phrasing and measure whether quality drops (usually it doesn’t).
  3. Test literalism. Add a prompt that says “Apply this to the first section” and see if 4.7 applies it to others. Then change to “Apply this to every section” and verify. Confirms the documented literalism shift.
  4. Migrate off prefilled responses. Grep for any API calls with prefill on the last assistant turn. Apply the relevant migration pattern (Structured Outputs, user-turn continuation, etc.).
  5. Add the parallel-tool-call block to any agentic coding system prompt. Measure latency on multi-file read operations; typical uplift is substantial.
  6. Standardize the safety block for any agent with destructive capabilities — file deletion, git force-push, external messaging. Paste the reversibility guidance from the doc verbatim.
  7. Add the overengineering block to any Claude Code CLAUDE.md that’s producing overly speculative implementations. Measure the size of PRs before/after.