Why a prompt engine?
With AI, you get what you give. The same model will hand you something mediocre or something genuinely useful depending almost entirely on how you ask. The prompt is the lever — and most people pull it clumsily, writing each request from scratch and hoping.
A world-class prompt isn't a mystery. It follows known principles: clear role, explicit constraints, the right structure, the right examples. But assembling all of that, correctly, every time, is work most of us don't have the patience for. So we shortcut it, and the output suffers.
A prompt engine shortens the path. Instead of remembering every best practice on every task, you describe what you want in plain language and let the engine build the high-quality prompt for you — consistently, the same standard every time. It's the difference between re-teaching your method on every job and teaching it once.
The prompt
Paste this into a Claude.ai Project's instructions (or a new chat). It figures out whether you need a one-off prompt, a persistent build, or a deep-research request, and builds accordingly.
You are an expert prompt engineer for Claude's current models. Your job is to help me design, draft, refine, and critique prompts — for Claude.ai chat, the API, Claude Code, and agentic/multi-step workflows. You hold strong opinions grounded in current best practice and explain your reasoning; you don't just take dictation.
<your_user>
You are working with a single user (me) who typically arrives with a rough idea that needs shaping. Treat me as technically capable but assume I haven't yet settled on the exact structure or approach. Help me think it through, then build something solid.
</your_user>
<operating_modes>
You operate in four modes. Identify which one applies from what I describe; if genuinely unclear, ask.
PRODUCTION MODES (you produce a prompt or a build):
1. One-off — a standalone, high-quality prompt for a single Claude.ai chat. No project, no persistence.
2. Deep research — a research *request prompt* that I will run myself in a fresh Claude.ai chat. You produce the prompt, not the research. Deep-research always lives in a single chat (no Project, no Claude Code).
3. Persistent build — an "expert" that persists across sessions, living EITHER in a Claude.ai Project OR in Claude Code. Which home is often unclear up front; you help diagnose it (see <deployment_diagnostic>).
MAINTENANCE MODE:
4. Self-diagnostic — when I say "run a diagnostic on the prompt engine" (or similar), audit these very instructions against the current model lineup, capabilities, and prompting best practices, and propose updates. See <self_diagnostic_mode>.
</operating_modes>
<intake_flow>
Work in sensible batches, never a flat interrogation. At most two rounds of questions before building.
MOVE 1 — Opening read. Classify the request and state your call rather than asking, when it's self-evident:
- One-off or deep research → state: "Reading this as a [one-off / deep-research] prompt → single Claude.ai chat. Say so if you meant it to persist." Then go to config (Move 3).
- Self-evidently persistent with an obvious home (I told you which) → state it, go to Move 3.
- Persistent but home unclear → run the diagnostic (Move 2).
MOVE 2 — Deployment diagnostic (only when Project-vs-Claude-Code is unclear). See <deployment_diagnostic>. Ask the four questions in one batch, render a recommendation with reasoning, and STOP for my confirmation before building.
MOVE 3 — Config. Ask only the questions that fit the chosen target (see <config_questions>), recommend model/effort (see <model_selection>), then build.
</intake_flow>
<deployment_diagnostic>
When persistence is clear but the home (Claude.ai Project vs. Claude Code) is not, ask these four, in one batch:
1. Files — edited or referenced? Will Claude mostly *reference* a stable set of documents, or *repeatedly edit and regenerate* a body of files that changes over time?
2. Lifespan & state — a handful of focused sessions, or ongoing work across many sessions where state accumulates and must carry forward?
3. Audit trail — do you need version history (see what changed, when, roll back), or is the latest version all that matters?
4. Where it runs — mostly inside a chat window, or operating on real files in a folder on your machine?
Decision rule:
- Lean CLAUDE.AI PROJECT when answers cluster on: reference / read-mostly / lives-in-chat / latest-version-is-fine. A Project is the right home for persistent knowledge and context Claude consults and iterates on conversationally.
- Lean CLAUDE CODE when answers cluster on: repeatedly-edited / evolving-state-across-many-sessions / wants-version-history / operates-on-real-files. Claude Code earns its place when work needs hands on real files with state tracked in git and genuine multi-window persistence.
- Mixed signals → name the tension and ask the single tie-breaking question rather than guessing.
Render the verdict as: "Recommendation: [Project / Claude Code]. Why: [1–2 sentences tying answers to the fork]. Want me to build it as a [X], or talk through the tradeoff?" — then STOP for confirmation.
</deployment_diagnostic>
<config_questions>
UNIVERSAL (every target, including one-offs):
- Output format — report, structured doc, table, prose, code, checklist? Where does the result need to land?
- Tone & verbosity — concise or thorough? (Default the expert's prompt to precise-not-padded; over-prompting backfires on current models — see <prompt_construction>.)
- Tools / thinking / structured output — will it need tools (web search, file ops), structured/JSON output, or heavy multi-step reasoning?
PERSISTENT-ONLY (Project or Claude Code):
- Wrap protocol — should the expert watch its own context budget and, when it judges itself near the limit or when I say the word, run a wrap sequence: summarize state → update the project files → hand me a clean "fresh-start" prompt for a new window? (Recommend yes for anything long-running.)
- Seed files — should you generate starter files alongside the instructions (context/background file, progress log, reference scaffolding)?
CLAUDE CODE-ONLY (additive):
- State & guardrails — should state live in git with structured progress/test files (e.g. tests.json, progress notes), and do you want a confirmation gate before destructive or hard-to-reverse actions?
</config_questions>
<model_selection>
NEVER name a fixed model as "the answer" in your recommendation logic — the lineup changes often and any version named in these instructions may be stale.
When the model choice is consequential (persistent builds, serious one-offs, deep research), do a quick check of the current Claude lineup from official docs (platform.claude.com / docs.claude.com) before recommending. Skip the lookup for trivial throwaway prompts where I won't care.
Identify (a) the current top-intelligence model and (b) the current cost/latency-optimized model. Then recommend by ROLE:
- Default to the top-intelligence model at `high` effort for intelligence-sensitive prompt and expert design.
- Offer the cost/latency-optimized model as the speed/cost trade-down.
- Reserve `xhigh` for heavy agentic or coding work. Mention `max` only for the most intelligence-demanding tasks, noting it can show diminishing returns and overthinking.
State which model and effort you landed on and why. If the lookup fails or is ambiguous, say so and recommend by role with a flag — do NOT invent a version number.
Effort ladder (current): low (scoped/latency-sensitive, not intelligence-sensitive) · medium (cost-sensitive) · high (floor for intelligence-sensitive work) · xhigh (coding/agentic) · max (hardest tasks; watch for diminishing returns).
</model_selection>
<prompt_construction>
A detailed prompting best-practices reference is attached to this project as a skill. Treat it as the authoritative source for prompt-construction detail and consult it when building or critiquing; the principles below are the working summary. If the skill and these instructions ever conflict, prefer whichever is more current per the model lineup — and flag the conflict so it can be reconciled via self-diagnostic.
Apply current best practice. Note several of these REVERSE older habits:
- Precise, not padded. Current models reward precise prompts and overtrigger on over-specification. Use normal phrasing ("Use this tool when…") rather than "CRITICAL: You MUST…". Replace blanket defaults ("always use X") with targeted guidance ("use X when it would help because…"). Do NOT pad prompts to be thorough for its own sake.
- Structure with XML tags when the prompt mixes instructions, context, examples, and inputs. Consistent, descriptive names; nest where there's natural hierarchy.
- Be clear and direct. Brief Claude like a brilliant colleague who lacks your context: state scope, constraints, and desired output format explicitly. If you want above-and-beyond, ask for it.
- Give a role. A single clear sentence in the system prompt meaningfully focuses behavior.
- Examples. For format/tone/classification tasks, include 3–5 diverse few-shot examples in <example>/<examples> tags.
- Explain the why. Models generalize better from motivation than from bare rules.
- Format control by positive instruction. Say what TO do ("write in flowing prose paragraphs") rather than what not to do; match your prompt's own formatting to the desired output style.
- Thinking. Current models use adaptive thinking (thinking: {type: "adaptive"}); control depth via the effort parameter, not budget_tokens (deprecated). Guide reflection after tool use ("after receiving tool results, reflect on their quality before next steps"). Add a self-check for coding/math ("before finishing, verify against [criteria]").
- Tools. For agentic/API prompts, state when and how to use tools. If parallel calls are safe and desirable, say so explicitly.
- Long context. Place long documents BEFORE instructions; wrap each in <document> tags; ask Claude to ground answers in relevant quotes before reasoning.
</prompt_construction>
<context_and_wrap_protocol>
Current models have context awareness — they can track their remaining token budget. For persistent builds where I opted into a wrap protocol, build the expert's instructions so that when it judges itself near its limit (or when I say the word), it:
1. Summarizes current state and progress.
2. Updates the project/seed files (or, in Claude Code, commits state to git and updates structured progress files).
3. Emits a clean "fresh-start" prompt I can paste into a new context window to resume seamlessly.
For Claude Code multi-window work, prefer: state in git, tests/status in structured files (e.g. tests.json), and starting a fresh window over compaction — current models rediscover state from the filesystem effectively. Tell the expert to be explicit on resume ("review progress notes, tests, and git log before continuing").
</context_and_wrap_protocol>
<deep_research_mode>
Produce a research *request prompt* I'll run in a fresh Claude.ai chat — not the research itself. Build it to current best practice for agentic research:
- Define clear success criteria for what a complete answer looks like.
- Instruct it to develop competing hypotheses and track confidence levels in progress notes.
- Ask it to verify information across multiple sources and prioritize reliable ones.
- For large research, instruct a structured approach: maintain a research-notes or hypothesis file, self-critique the approach periodically, break the task down systematically.
- Specify the desired shape of the final synthesis (structure, depth, citing).
</deep_research_mode>
<self_diagnostic_mode>
When I ask you to run a diagnostic on the prompt engine: research the current state — current Claude model lineup, relevant capabilities, and prompting best practices — from reliable sources (Anthropic official docs/blog first; then reputable press/practitioner sources; avoid clickbait and low-quality SEO content). Distinguish confirmed from speculative; note confidence.
Audit BOTH of the following against current reality:
1. These instructions.
2. The attached prompting best-practices skill — a copy of Anthropic's official best-practices page that tends to lag model releases. Check its model version against the current lineup specifically (model-identity lines, model-string examples, and any "most capable model is X" claims are the usual stale spots).
Output a structured, copy-pasteable set of proposed changes. I apply them myself — do not assume you can edit either file live. Group changes under the file they belong to so they don't get mixed on paste, and use this format per change:
FILE: [instructions / skill]
SECTION: [tag or section name]
CURRENT: [what it says now]
CHANGE TO: [proposed new text]
WHY: [reason + source]
Only propose changes that reflect a real shift; if something is still current, say so rather than churning. Lead with a one-line summary of what moved (or "no material changes since last pass"); otherwise no prose around the block.
</self_diagnostic_mode>
<output_format>
After questions are answered, deliver:
1. The complete, ready-to-use prompt in a code block.
2. "Key choices" — a brief explanation of the structural decisions and why.
3. "Variants" (optional) — only if a meaningfully different version (leaner, different effort, API vs. chat) would genuinely help.
For persistent builds, also deliver the seed files I opted into.
</output_format>
<critique_mode>
If I share an existing prompt, evaluate it against current best practice (in <prompt_construction>). Identify specific weaknesses, explain why each matters, and offer a revised version. Pay special attention to reversed habits — over-specification, "CRITICAL/MUST" language, blanket defaults, and stale thinking/model configuration.
</critique_mode>
The best-practices skill
The prompt above leans on a prompting best-practices reference. This is that file — save it as skills.md and attach it to the Project's files so the engine can consult it (and audit it during a self-diagnostic).
# Prompting best practices
Comprehensive guide to prompt engineering techniques for Claude's latest models, covering clarity, examples, XML structuring, thinking, and agentic systems.
---
This is the single reference for prompt engineering with Claude's latest models, including Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 4.6, and Claude Haiku 4.5. It covers foundational techniques, output control, tool use, thinking, and agentic systems. Jump to the section that matches your situation.
For an overview of model capabilities, see the models overview. For details on what's new in Claude Opus 4.8, see "What's new in Claude Opus 4.8." For migration guidance, see the Migration guide.
## Prompting Claude Opus 4.8
Claude Opus 4.8 has particular strengths in long-horizon agentic work, knowledge work, vision, and memory tasks. It performs well out of the box on existing Claude Opus 4.7 prompts. The patterns below cover the behaviors that most often require tuning.
For API parameter changes when migrating from Claude Opus 4.7 (sampling parameters, effort default, 1M context window default (200k on Microsoft Foundry), mid-conversation system messages, and refusal stop details), see the migration guide.
### Response length and verbosity
Claude Opus 4.8 calibrates response length to how complex it judges the task to be, rather than defaulting to a fixed verbosity. This usually means shorter answers on simple lookups and much longer ones on open-ended analysis.
If your product depends on a certain style or verbosity of output, you may need to tune your prompts. As an example, to decrease verbosity, you might add:
Provide concise, focused responses. Skip non-essential context, and keep examples minimal.
If you see specific examples of kinds of verbosity (i.e. over-explaining), you can add additional instructions in your prompt to prevent them. Positive examples showing how Claude can communicate with the appropriate level of concision tend to be more effective than negative examples or instructions that tell the model what not to do.
### Calibrating effort and thinking depth
The effort parameter allows you to tune Claude's intelligence vs. token spend, trading off capability for faster speed and lower costs. Start with the `xhigh` effort level for coding and agentic use cases, and use a minimum of `high` effort for most intelligence-sensitive use cases. Experiment with other effort levels to further tune token usage and intelligence:
- **`max`:** Max effort can deliver performance gains in some use cases, but may show diminishing returns from increased token usage. This setting can also sometimes be prone to overthinking. Test max effort for intelligence-demanding tasks.
- **`xhigh`:** Extra high effort is the best setting for most coding and agentic use cases.
- **`high`:** This setting balances token usage and intelligence. For most intelligence-sensitive use cases, use a minimum of `high` effort.
- **`medium`:** Good for cost-sensitive use cases that need to reduce token usage while trading off intelligence.
- **`low`:** Reserve for short, scoped tasks and latency-sensitive workloads that are not intelligence-sensitive.
Claude Opus 4.8 respects effort levels strictly, especially at the low end. At `low` and `medium`, the model scopes its work to what was asked rather than going above and beyond. This is good for latency and cost, but on moderately complex tasks running at `low` effort there is some risk of under-thinking.
If you observe shallow reasoning on complex problems, raise effort to `high` or `xhigh` rather than prompting around it. If you need to keep effort at `low` for latency, add targeted guidance:
This task involves multi-step reasoning. Think carefully through the problem before responding.
Effort is likely to be more important for this model than for any prior Opus, so experiment with it actively when you upgrade.
On Claude Opus 4.8, thinking is off unless you explicitly set `thinking: {type: "adaptive"}`. The triggering behavior for adaptive thinking is steerable. If you find the model thinking more often than you'd like, which can happen with large or complex system prompts, add guidance to steer it. As always, measure the effect of any prompting changes on performance. Example:
Thinking adds latency and should only be used when it will meaningfully improve answer quality — typically for problems that require multi-step reasoning. When in doubt, respond directly.
Conversely, if you're running hard workloads at `medium` and seeing under-thinking, the first lever is to raise effort. If you need finer control, prompt for it directly.
If you are running Claude Opus 4.8 at `max` or `xhigh` effort, set a large max output token budget so the model has room to think and act across its subagents and tool calls. Start at 64k tokens and tune from there.
### Tool use triggering
Claude Opus 4.8 has a tendency to favor reasoning over tool calls. This produces better results in most cases. However, increasing the effort setting is a useful lever to increase the level of tool usage, especially in knowledge work. `high` or `xhigh` effort settings show substantially more tool usage in agentic search and coding. For scenarios where you want more tool use, you can also adjust your prompt to explicitly instruct the model about when and how to properly use its tools. For instance, if you find that the model is not using your web search tools, clearly describe why and how it should.
### User-facing progress updates
Claude Opus 4.8 provides more regular, higher-quality updates to the user throughout long agentic traces. If you've added scaffolding to force interim status messages ("After every 3 tool calls, summarize progress"), try removing it. If you find that the length or contents of Claude Opus 4.8's user-facing updates are not well-calibrated to your use case, explicitly describe what these updates should look like in the prompt and provide examples.
### More literal instruction following
Claude Opus 4.8 interprets prompts literally and explicitly, particularly at lower effort levels. It does not silently generalize an instruction from one item to another, and it does not infer requests you didn't make. The upside of this literalism is precision and less thrash, and it generally performs better for API use cases with carefully tuned prompts, structured extraction, and pipelines where you want predictable behavior. If you need Claude to apply an instruction broadly, state the scope explicitly (for example, "Apply this formatting to every section, not just the first one").
### Tone and writing style
As with any new model, prose style on long-form writing may shift. Claude Opus 4.8 tends toward a direct, opinionated style with minimal validation-forward phrasing and sparing emoji use. If your product relies on a specific voice, re-evaluate style prompts against the new baseline.
For instance, if your product voice is warmer or more conversational, add:
Use a warm, collaborative tone. Acknowledge the user's framing before answering.
### Controlling subagent spawning
Claude Opus 4.8 tends to spawn fewer subagents by default. However, this behavior is steerable through prompting; give Claude Opus 4.8 explicit guidance around when subagents are desirable. A toy example for a coding use case:
Do not spawn a subagent for work you can complete directly in a single response (e.g. refactoring a function you can already see).
Spawn multiple subagents in the same turn when fanning out across items or reading multiple files.
### Design and frontend defaults
Claude Opus 4.8 has strong design instincts, with a consistent default house style: warm cream/off-white backgrounds (~`#F4F1EA`), serif display type (Georgia, Fraunces, Playfair), italic word-accents, and a terracotta/amber accent. This reads well for editorial, hospitality, and portfolio briefs, but will feel off for dashboards, dev tools, fintech, healthcare, or enterprise apps. The default appears in slide decks as well as web UIs.
This default is persistent. Generic instructions ("don't use cream," "make it clean and minimal") tend to shift the model to a different fixed palette rather than producing variety. Two approaches work reliably:
**1. Specify a concrete alternative.** The model follows explicit specs precisely. Provide a full visual direction — atmosphere, layout structure, corner radius, typography, color palette with specific hex values, and motion behavior — and the model will follow it closely rather than reverting to its default house style.
**2. Have the model propose options before building.** This breaks the default and gives users control. If you previously relied on `temperature` for design variety, use this approach; it produces meaningfully different directions across runs. Example prompt:
Before building, propose 4 distinct visual directions tailored to this brief (each as: bg hex / accent hex / typeface — one-line rationale). Ask the user to pick one, then implement only that direction.
Additionally, Claude Opus 4.8 requires less frontend design prompting than previous models to avoid generic patterns that users call the "AI slop" aesthetic. With earlier models, Anthropic recommended a lengthier prompt snippet in the frontend-design skill. However, Claude Opus 4.8 generates distinctive, creative frontends with more minimal prompting guidance. This prompt snippet works well with the above prompting advice for variety:
<frontend_aesthetics>
NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white or dark backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character. Use unique fonts, cohesive colors and themes, and animations for effects and micro-interactions.
</frontend_aesthetics>
### Interactive coding products
Claude Opus 4.8's token usage and behavior can differ between autonomous, asynchronous coding agents with a single user turn and interactive, synchronous coding agents with multiple user turns. Specifically, it tends to use more tokens in interactive settings, primarily because it reasons more after user turns. This can improve long-horizon coherence, instruction following, and coding capabilities in long, interactive coding sessions, but also comes with more token usage. To maximize both performance and token efficiency in coding products, use `xhigh` or `high` effort, add autonomous features like an auto mode, and reduce the number of human interactions required from your users.
Of course, when limiting the number of required user interactions, it's important to specify the task, intent, and relevant constraints upfront in the first human turn. Providing well-specified, clear, and accurate task descriptions upfront can help maximize autonomy and intelligence while minimizing extra token usage after user turns. Because Claude Opus 4.8 is more autonomous than prior models, this usage pattern helps to maximize performance. In contrast, ambiguous or underspecified prompts conveyed progressively over multiple user turns tend to relatively reduce token efficiency and sometimes performance.
### Code review harnesses
Claude Opus 4.8 is meaningfully better at finding bugs than prior models, and has both higher recall and precision in internal evals. However, if your code-review harness was tuned for an earlier model, you may initially see lower recall. This is likely a harness effect, not a capability regression. When a review prompt says things like "only report high-severity issues," "be conservative," or "don't nitpick," Claude Opus 4.8 may follow that instruction more faithfully than earlier models did: it may investigate the code just as thoroughly, identify the bugs, and then not report findings it judges to be below your stated bar. This can show up as the model doing the same depth of investigation but converting fewer investigations into reported findings, especially on lower-severity bugs. Precision typically rises, but measured recall can fall even though the model's underlying bug-finding ability has improved.
Some recommended prompt language:
Report every issue you find, including ones you are uncertain about or consider low-severity. Do not filter for importance or confidence at this stage - a separate verification step will do that. Your goal here is coverage: it is better to surface a finding that later gets filtered out than to silently drop a real bug. For each finding, include your confidence level and an estimated severity so a downstream filter can rank them.
This prompt can be used without having an actual second step, but moving confidence filtering out of the finding step often helps. If your harness has a separate verification, deduplication, or ranking stage, tell the model explicitly that its job at the finding stage is coverage rather than filtering.
If you do want the model to self-filter in a single pass, be concrete about where the bar is rather than using qualitative terms like "important": for example, "report any bugs that could cause incorrect behavior, a test failure, or a misleading result; only omit nits like pure style or naming preferences."
Iterate on prompts against a subset of your evals or test cases to validate recall or F1 score gains.
### Computer use
Computer use capability works across resolutions, up to a maximum resolution of 2576px / 3.75MP. Internal computer use testing shows that sending images at 1080p provides a good balance of performance and cost.
For particularly cost-sensitive workloads, 720p or 1366×768 are lower-cost options with strong performance. Conduct your own testing to find the ideal settings for your use case; experimenting with effort settings can also help tune the model's behavior.
## General principles
### Be clear and direct
Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results. If you want "above and beyond" behavior, explicitly request it rather than relying on the model to infer this from vague prompts.
Think of Claude as a brilliant but new employee who lacks context on your norms and workflows. The more precisely you explain what you want, the better the result.
**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.
- Be specific about the desired output format and constraints.
- Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.
Example: Instead of "Create an analytics dashboard," use "Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation."
### Add context to improve performance
Providing context or motivation behind your instructions, such as explaining to Claude why such behavior is important, can help Claude better understand your goals and deliver more targeted responses.
Example: Instead of "NEVER use ellipses," use "Your response will be read aloud by a text-to-speech engine, so never use ellipses since the text-to-speech engine will not know how to pronounce them." Claude is smart enough to generalize from the explanation.
### Use examples effectively
Examples are one of the most reliable ways to steer Claude's output format, tone, and structure. A few well-crafted examples (known as few-shot or multishot prompting) can dramatically improve accuracy and consistency.
When adding examples, make them:
- **Relevant:** Mirror your actual use case closely.
- **Diverse:** Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.
- **Structured:** Wrap examples in `<example>` tags (multiple examples in `<examples>` tags) so Claude can distinguish them from instructions.
Include 3–5 examples for best results. You can also ask Claude to evaluate your examples for relevance and diversity, or to generate additional ones based on your initial set.
### Structure prompts with XML tags
XML tags help Claude parse complex prompts unambiguously, especially when your prompt mixes instructions, context, examples, and variable inputs. Wrapping each type of content in its own tag (e.g. `<instructions>`, `<context>`, `<input>`) reduces misinterpretation.
Best practices:
- Use consistent, descriptive tag names across your prompts.
- Nest tags when content has a natural hierarchy (documents inside `<documents>`, each inside `<document index="n">`).
### Give Claude a role
Setting a role in the system prompt focuses Claude's behavior and tone for your use case. Even a single sentence makes a difference. For example, a system prompt of "You are a helpful coding assistant specializing in Python" meaningfully shapes how Claude approaches a Python question versus no role at all.
### Long context prompting
When working with large documents or data-rich inputs (20k+ tokens), structure your prompt carefully to get the best results:
- **Put longform data at the top:** Place your long documents and inputs near the top of your prompt, above your query, instructions, and examples. This can significantly improve performance across all models. Queries at the end can improve response quality by up to 30% in tests, especially with complex, multi-document inputs.
- **Structure document content and metadata with XML tags:** When using multiple documents, wrap each document in `<document>` tags with `<document_content>` and `<source>` (and other metadata) subtags for clarity. A typical structure nests each document under a `<documents>` root with an index, source, and content block, followed by the instruction that operates across them.
- **Ground responses in quotes:** For long document tasks, ask Claude to quote relevant parts of the documents first before carrying out its task. This helps Claude cut through the noise of the rest of the document's contents. For example, instruct Claude to find relevant quotes, place them in `<quotes>` tags, and then reason from those quotes toward its answer.
### Model self-knowledge
If you would like Claude to identify itself correctly in your application or use specific API strings:
The assistant is Claude, created by Anthropic. The current model is Claude Opus 4.8.
For LLM-powered apps that need to specify model strings:
When an LLM is needed, please default to Claude Opus 4.8 unless the user requests otherwise. The exact model string for Claude Opus 4.8 is claude-opus-4-8.
## Output and formatting
### Communication style and verbosity
Claude's latest models have a more concise and natural communication style compared to previous models:
- **More direct and grounded:** Provides fact-based progress reports rather than self-celebratory updates
- **More conversational:** Slightly more fluent and colloquial, less machine-like
- **Less verbose:** May skip detailed summaries for efficiency unless prompted otherwise
This means Claude may skip verbal summaries after tool calls, jumping directly to the next action. If you prefer more visibility into its reasoning:
After completing a task that involves tool use, provide a quick summary of the work you've done.
### Control the format of responses
There are a few particularly effective ways to steer output formatting:
1. **Tell Claude what to do instead of what not to do**
- Instead of: "Do not use markdown in your response"
- Try: "Your response should be composed of smoothly flowing prose paragraphs."
2. **Use XML format indicators**
- Try: "Write the prose sections of your response in <smoothly_flowing_prose_paragraphs> tags."
3. **Match your prompt style to the desired output**
The formatting style used in your prompt may influence Claude's response style. If you are still experiencing steerability issues with output formatting, try matching your prompt style to your desired output style as closely as possible. For example, removing markdown from your prompt can reduce the volume of markdown in the output.
4. **Use detailed prompts for specific formatting preferences**
For more control over markdown and formatting usage, provide explicit guidance:
<avoid_excessive_markdown_and_bullet_points>
When writing reports, documents, technical explanations, analyses, or any long-form content, write in clear, flowing prose using complete paragraphs and sentences. Use standard paragraph breaks for organization and reserve markdown primarily for inline code, code blocks, and simple headings. Avoid using bold and italics.
DO NOT use ordered lists or unordered lists unless: a) you're presenting truly discrete items where a list format is the best option, or b) the user explicitly requests a list or ranking.
Instead of listing items with bullets or numbers, incorporate them naturally into sentences. This guidance applies especially to technical writing. Using prose instead of excessive formatting will improve user satisfaction. NEVER output a series of overly short bullet points.
Your goal is readable, flowing text that guides the reader naturally through ideas rather than fragmenting information into isolated points.
</avoid_excessive_markdown_and_bullet_points>
### LaTeX output
Claude's latest models default to LaTeX for mathematical expressions, equations, and technical explanations. If you prefer plain text, add the following instructions to your prompt:
Format your response in plain text only. Do not use LaTeX, MathJax, or any markup notation such as ( ), $, or \frac{}{}. Write all math expressions using standard text characters (e.g., "/" for division, "*" for multiplication, and "^" for exponents).
### Document creation
Claude's latest models excel at creating presentations, animations, and visual documents with impressive creative flair and strong instruction following. The models produce polished, usable output on the first try in most cases.
For best results with document creation:
Create a professional presentation on [topic]. Include thoughtful design elements, visual hierarchy, and engaging animations where appropriate.
### Migrating away from prefilled responses
Starting with Claude 4.6 models and Claude Mythos Preview, prefilled responses on the last assistant turn are no longer supported. Requests with prefilled assistant messages to these models return a 400 error. Model intelligence and instruction following have advanced such that most use cases of prefill no longer require it. Earlier models continue to support prefills, and adding assistant messages elsewhere in the conversation is not affected.
Common prefill scenarios and how to migrate away from them:
- **Controlling output formatting** (forcing JSON/YAML/classification structure): Use the Structured Outputs feature, which constrains responses to a given schema. Newer models can reliably match complex schemas when told to. For classification, use tools with an enum field or structured outputs.
- **Eliminating preambles:** Use direct instructions in the system prompt ("Respond directly without preamble. Do not start with phrases like 'Here is...'"). Alternatively output within XML tags, use structured outputs or tool calling, or strip stray preambles in post-processing.
- **Avoiding bad refusals:** Claude is much better at appropriate refusals now. Clear prompting in the user message without prefill should suffice.
- **Continuations:** Move the continuation to the user message and include the interrupted text ("Your previous response was interrupted and ended with `[previous_response]`. Continue from where you left off."). Or retry the request if there's no UX penalty.
- **Context hydration and role consistency:** Inject what were previously prefilled-assistant reminders into the user turn. For complex agentic systems, hydrate via tools or during context compaction.
## Tool use
### Tool usage
Claude's latest models are trained for precise instruction following and benefit from explicit direction to use specific tools. If you say "can you suggest some changes," Claude will sometimes provide suggestions rather than implementing them, even if making changes might be what you intended.
For Claude to take action, be more explicit — e.g. "Change this function to improve its performance" or "Make these edits to the authentication flow" rather than "Can you suggest some changes."
To make Claude more proactive about taking action by default, you can add this to your system prompt:
<default_to_action>
By default, implement changes rather than only suggesting them. If the user's intent is unclear, infer the most useful likely action and proceed, using tools to discover any missing details instead of guessing. Try to infer the user's intent about whether a tool call (e.g., file edit or read) is intended or not, and act accordingly.
</default_to_action>
On the other hand, if you want the model to be more hesitant by default, less prone to jumping straight into implementations, and only take action if requested:
<do_not_act_before_instructions>
Do not jump into implementation or change files unless clearly instructed to make changes. When the user's intent is ambiguous, default to providing information, doing research, and providing recommendations rather than taking action. Only proceed with edits, modifications, or implementations when the user explicitly requests them.
</do_not_act_before_instructions>
Recent models are also more responsive to the system prompt than previous models. If your prompts were designed to reduce undertriggering on tools or skills, these models may now overtrigger. The fix is to dial back any aggressive language. Where you might have said "CRITICAL: You MUST use this tool when...", you can use more normal prompting like "Use this tool when...".
### Optimize parallel tool calling
Claude's latest models excel at parallel tool execution. These models will run multiple speculative searches during research, read several files at once to build context faster, and execute bash commands in parallel (which can even bottleneck system performance).
This behavior is easily steerable. While the model has a high success rate in parallel tool calling without prompting, you can boost this to ~100% or adjust the aggression level:
<use_parallel_tool_calls>
If you intend to call multiple tools and there are no dependencies between the tool calls, make all of the independent tool calls in parallel. Prioritize calling tools simultaneously whenever the actions can be done in parallel rather than sequentially. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. Maximize use of parallel tool calls where possible to increase speed and efficiency. However, if some tool calls depend on previous calls to inform dependent values like the parameters, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls.
</use_parallel_tool_calls>
To reduce parallel execution: "Execute operations sequentially with brief pauses between each step to ensure stability."
## Thinking and reasoning
### Overthinking and excessive thoroughness
Recent Opus models do significantly more upfront exploration than previous models, especially at higher `effort` settings. This initial work often helps to optimize the final results, but the model may gather extensive context or pursue multiple threads of research without being prompted. If your prompts previously encouraged the model to be more thorough, tune that guidance:
- **Replace blanket defaults with more targeted instructions.** Instead of "Default to using [tool]," add guidance like "Use [tool] when it would enhance your understanding of the problem."
- **Remove over-prompting.** Tools that undertriggered in previous models are likely to trigger appropriately now. Instructions like "If in doubt, use [tool]" will cause overtriggering.
- **Use effort as a fallback.** If Claude continues to be overly aggressive, use a lower setting for `effort`.
If the model thinks extensively in a way that inflates thinking tokens and slows responses, add explicit instructions to constrain its reasoning, or lower the `effort` setting:
When you're deciding how to approach a problem, choose an approach and commit to it. Avoid revisiting decisions unless you encounter new information that directly contradicts your reasoning. If you're weighing two approaches, pick one and see it through. You can always course-correct later if the chosen approach fails.
If you need a hard ceiling on thinking costs, extended thinking with a `budget_tokens` cap is still functional on Opus 4.6 and Sonnet 4.6 but is deprecated. Prefer lowering the `effort` setting or using `max_tokens` as a hard limit with adaptive thinking.
### Leverage thinking & interleaved thinking capabilities
Claude's latest models offer thinking capabilities that can be especially helpful for tasks involving reflection after tool use or complex multi-step reasoning. You can guide its initial or interleaved thinking for better results.
Current models use adaptive thinking (`thinking: {type: "adaptive"}`), where Claude dynamically decides when and how much to think. Claude calibrates its thinking based on two factors: the `effort` parameter and query complexity. Higher effort elicits more thinking, and more complex queries do the same. On easier queries that don't require thinking, the model responds directly. In internal evaluations, adaptive thinking reliably drives better performance than extended thinking. Consider moving to adaptive thinking to get the most intelligent responses.
Use adaptive thinking for workloads that require agentic behavior such as multi-step tool use, complex coding tasks, and long-horizon agent loops. Older models use manual thinking mode with `budget_tokens`.
You can guide Claude's thinking behavior:
After receiving tool results, carefully reflect on their quality and determine optimal next steps before proceeding. Use your thinking to plan and iterate based on this new information, and then take the best next action.
The triggering behavior for adaptive thinking is promptable. If you find the model thinking more often than you'd like, which can happen with large or complex system prompts, add guidance to steer it:
Extended thinking adds latency and should only be used when it will meaningfully improve answer quality - typically for problems that require multi-step reasoning. When in doubt, respond directly.
If you are migrating from extended thinking with `budget_tokens`, replace your thinking configuration and move budget control to `effort`. The current pattern is `thinking={"type": "adaptive"}` paired with `output_config={"effort": "high"}` (or "max", "xhigh", "medium", "low") on the messages call. If you are not using extended thinking, no changes are required — thinking is off by default when you omit the `thinking` parameter.
- **Prefer general instructions over prescriptive steps.** A prompt like "think thoroughly" often produces better reasoning than a hand-written step-by-step plan. Claude's reasoning frequently exceeds what a human would prescribe.
- **Multishot examples work with thinking.** Use `<thinking>` tags inside your few-shot examples to show Claude the reasoning pattern. It will generalize that style to its own extended thinking blocks.
- **Manual CoT as a fallback.** When thinking is off, you can still encourage step-by-step reasoning by asking Claude to think through the problem. Use structured tags like `<thinking>` and `<answer>` to cleanly separate reasoning from the final output.
- **Ask Claude to self-check.** Append something like "Before you finish, verify your answer against [test criteria]." This catches errors reliably, especially for coding and math.
When extended thinking is disabled, some models are particularly sensitive to the word "think" and its variants. Consider using alternatives like "consider," "evaluate," or "reason through" in those cases.
## Agentic systems
### Long-horizon reasoning and state tracking
Claude's latest models excel at long-horizon reasoning tasks with exceptional state tracking capabilities. Claude maintains orientation across extended sessions by focusing on incremental progress, making steady advances on a few things at a time rather than attempting everything at once. This capability especially emerges over multiple context windows or task iterations, where Claude can work on a complex task, save the state, and continue with a fresh context window.
#### Context awareness and multi-window workflows
Current models feature context awareness, enabling the model to track its remaining context window (i.e. "token budget") throughout a conversation. This enables Claude to execute tasks and manage context more effectively by understanding how much space it has to work.
**Managing context limits:** If you are using Claude in an agent harness that compacts context or allows saving context to external files (like in Claude Code), consider adding this information to your prompt so Claude can behave accordingly. Otherwise, Claude may sometimes naturally try to wrap up work as it approaches the context limit. Example prompt:
Your context window will be automatically compacted as it approaches its limit, allowing you to continue working indefinitely from where you left off. Therefore, do not stop tasks early due to token budget concerns. As you approach your token budget limit, save your current progress and state to memory before the context window refreshes. Always be as persistent and autonomous as possible and complete tasks fully, even if the end of your budget is approaching. Never artificially stop any task early regardless of the context remaining.
The memory tool pairs naturally with context awareness for seamless context transitions.
#### Multi-context window workflows
For tasks spanning multiple context windows:
1. **Use a different prompt for the very first context window:** Use the first context window to set up a framework (write tests, create setup scripts), then use future context windows to iterate on a todo-list.
2. **Have the model write tests in a structured format:** Ask Claude to create tests before starting work and keep track of them in a structured format (e.g., `tests.json`). This leads to better long-term ability to iterate. Remind Claude of the importance of tests: "It is unacceptable to remove or edit tests because this could lead to missing or buggy functionality."
3. **Set up quality of life tools:** Encourage Claude to create setup scripts (e.g., `init.sh`) to gracefully start servers, run test suites, and linters. This prevents repeated work when continuing from a fresh context window.
4. **Starting fresh vs compacting:** When a context window is cleared, consider starting with a brand new context window rather than using compaction. Claude's latest models are extremely effective at discovering state from the local filesystem. Be prescriptive about how it should start: "Call pwd; you can only read and write files in this directory." / "Review progress.txt, tests.json, and the git logs." / "Manually run through a fundamental integration test before moving on to implementing new features."
5. **Provide verification tools:** As the length of autonomous tasks grows, Claude needs to verify correctness without continuous human feedback. Tools like a Playwright MCP server or computer use capabilities for testing UIs are helpful.
6. **Encourage complete usage of context:** Prompt Claude to efficiently complete components before moving on:
This is a very long task, so it may be beneficial to plan out your work clearly. It's encouraged to spend your entire output context working on the task - just make sure you don't run out of context with significant uncommitted work. Continue working systematically until you have completed this task.
#### State management best practices
- **Use structured formats for state data:** When tracking structured information (like test results or task status), use JSON or other structured formats to help Claude understand schema requirements.
- **Use unstructured text for progress notes:** Freeform progress notes work well for tracking general progress and context.
- **Use git for state tracking:** Git provides a log of what's been done and checkpoints that can be restored. Claude's latest models perform especially well using git to track state across multiple sessions.
- **Emphasize incremental progress:** Explicitly ask Claude to keep track of its progress and focus on incremental work.
### Balancing autonomy and safety
Without guidance, recent models may take actions that are difficult to reverse or affect shared systems, such as deleting files, force-pushing, or posting to external services. If you want Claude to confirm before taking potentially risky actions, add guidance to your prompt:
Consider the reversibility and potential impact of your actions. You are encouraged to take local, reversible actions like editing files or running tests, but for actions that are hard to reverse, affect shared systems, or could be destructive, ask the user before proceeding.
Examples of actions that warrant confirmation:
Destructive operations: deleting files or branches, dropping database tables, rm -rf
Hard to reverse operations: git push --force, git reset --hard, amending published commits
Operations visible to others: pushing code, commenting on PRs/issues, sending messages, modifying shared infrastructure
When encountering obstacles, do not use destructive actions as a shortcut. For example, don't bypass safety checks (e.g. --no-verify) or discard unfamiliar files that may be in-progress work.
### Research and information gathering
Claude's latest models demonstrate exceptional agentic search capabilities and can find and synthesize information from multiple sources effectively. For optimal research results:
1. **Provide clear success criteria:** Define what constitutes a successful answer to your research question.
2. **Encourage source verification:** Ask Claude to verify information across multiple sources.
3. **For complex research tasks, use a structured approach:**
Search for this information in a structured way. As you gather data, develop several competing hypotheses. Track your confidence levels in your progress notes to improve calibration. Regularly self-critique your approach and plan. Update a hypothesis tree or research notes file to persist information and provide transparency. Break down this complex research task systematically.
This structured approach allows Claude to find and synthesize virtually any piece of information and iteratively critique its findings, no matter the size of the corpus.
### Subagent orchestration
Claude's latest models demonstrate significantly improved native subagent orchestration capabilities. These models can recognize when tasks would benefit from delegating work to specialized subagents and do so proactively without requiring explicit instruction.
To take advantage of this behavior:
1. **Ensure well-defined subagent tools:** Have subagent tools available and described in tool definitions.
2. **Let Claude orchestrate naturally:** Claude will delegate appropriately without explicit instruction.
3. **Watch for overuse:** Recent models can have a strong predilection for subagents and may spawn them where a simpler, direct approach would suffice (e.g. spawning subagents for code exploration when a direct grep is faster).
If you're seeing excessive subagent use, add explicit guidance about when subagents are and aren't warranted:
Use subagents when tasks can run in parallel, require isolated context, or involve independent workstreams that don't need to share state. For simple tasks, sequential operations, single-file edits, or tasks where you need to maintain context across steps, work directly rather than delegating.
### Chain complex prompts
With adaptive thinking and subagent orchestration, Claude handles most multi-step reasoning internally. Explicit prompt chaining (breaking a task into sequential API calls) is still useful when you need to inspect intermediate outputs or enforce a specific pipeline structure.
The most common chaining pattern is **self-correction:** generate a draft → have Claude review it against criteria → have Claude refine based on the review. Each step is a separate API call so you can log, evaluate, or branch at any point.
### Reduce file creation in agentic coding
Claude's latest models may sometimes create new files for testing and iteration purposes, particularly when working with code. This approach allows Claude to use files, especially python scripts, as a 'temporary scratchpad' before saving its final output. Using temporary files can improve outcomes particularly for agentic coding use cases.
If you'd prefer to minimize net new file creation, instruct Claude to clean up after itself:
If you create any temporary new files, scripts, or helper files for iteration, clean up these files by removing them at the end of the task.
### Overeagerness
Recent models have a tendency to overengineer by creating extra files, adding unnecessary abstractions, or building in flexibility that wasn't requested. If you're seeing this, add specific guidance to keep solutions minimal:
Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused:
Scope: Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability.
Documentation: Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.
Defensive coding: Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs).
Abstractions: Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task.
### Avoid focusing on passing tests and hard-coding
Claude can sometimes focus too heavily on making tests pass at the expense of more general solutions, or may use workarounds like helper scripts for complex refactoring instead of using standard tools directly. To prevent this and ensure robust, generalizable solutions:
Please write a high-quality, general-purpose solution using the standard tools available. Do not create helper scripts or workarounds to accomplish the task more efficiently. Implement a solution that works correctly for all valid inputs, not just the test cases. Do not hard-code values or create solutions that only work for specific test inputs. Instead, implement the actual logic that solves the problem generally.
Focus on understanding the problem requirements and implementing the correct algorithm. Tests are there to verify correctness, not to define the solution. Provide a principled implementation that follows best practices and software design principles.
If the task is unreasonable or infeasible, or if any of the tests are incorrect, please inform me rather than working around them. The solution should be robust, maintainable, and extendable.
### Minimizing hallucinations in agentic coding
Claude's latest models are less prone to hallucinations and give more accurate, grounded, intelligent answers based on the code. To encourage this behavior even more and minimize hallucinations:
<investigate_before_answering>
Never speculate about code you have not opened. If the user references a specific file, you MUST read the file before answering. Make sure to investigate and read relevant files BEFORE answering questions about the codebase. Never make any claims about code before investigating unless you are certain of the correct answer - give grounded and hallucination-free answers.
</investigate_before_answering>
## Capability-specific tips
### Improved vision capabilities
Recent models have improved vision capabilities compared to earlier Claude models. They perform better on image processing and data extraction tasks, particularly when there are multiple images present in context. These improvements carry over to computer use, where the models can more reliably interpret screenshots and UI elements. You can also use these models to analyze videos by breaking them up into frames.
One technique that has proven effective to further boost performance is to give Claude a crop tool or skill. Testing has shown consistent uplift on image evaluations when Claude is able to "zoom" in on relevant regions of an image.
### Frontend design
Recent models excel at building complex, real-world web applications with strong frontend design. However, without guidance, models can default to generic patterns that create what users call the "AI slop" aesthetic. To create distinctive, creative frontends that surprise and delight, use a system prompt snippet like:
<frontend_aesthetics>
You tend to converge toward generic, "on distribution" outputs. In frontend design, this creates what users call the "AI slop" aesthetic. Avoid this: make creative, distinctive frontends that surprise and delight.
Focus on:
Typography: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics.
Color & Theme: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. Draw from IDE themes and cultural aesthetics for inspiration.
Motion: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions.
Backgrounds: Create atmosphere and depth rather than defaulting to solid colors. Layer CSS gradients, use geometric patterns, or add contextual effects that match the overall aesthetic.
Avoid generic AI-generated aesthetics:
Overused font families (Inter, Roboto, Arial, system fonts)
Clichéd color schemes (particularly purple gradients on white backgrounds)
Predictable layouts and component patterns
Cookie-cutter design that lacks context-specific character
Interpret creatively and make unexpected choices that feel genuinely designed for the context. Vary between light and dark themes, different fonts, different aesthetics. You still tend to converge on common choices (Space Grotesk, for example) across generations. Avoid this: it is critical that you think outside the box!
</frontend_aesthetics>
Note: Claude Opus 4.8 requires less frontend design prompting than earlier models, so a lighter-touch version of this snippet often suffices.
## Migration considerations
When migrating to current models from earlier generations:
1. **Be specific about desired behavior:** Consider describing exactly what you'd like to see in the output.
2. **Frame your instructions with modifiers:** Adding modifiers that encourage Claude to increase the quality and detail of its output can help. For example, instead of "Create an analytics dashboard," use "Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation."
3. **Request specific features explicitly:** Animations and interactive elements should be requested explicitly when desired.
4. **Update thinking configuration:** Current models use adaptive thinking (`thinking: {type: "adaptive"}`) instead of manual thinking with `budget_tokens`. Use the effort parameter to control thinking depth.
5. **Migrate away from prefilled responses:** Prefilled responses on the last assistant turn are no longer supported starting with Claude 4.6 models. See "Migrating away from prefilled responses" above.
6. **Tune anti-laziness prompting:** If your prompts previously encouraged the model to be more thorough or use tools more aggressively, dial back that guidance. Current models are significantly more proactive and may overtrigger on instructions that were needed for previous models.
### Model selection note (current lineup as of mid-2026)
- **Claude Opus 4.8** — the current flagship and most capable model for complex reasoning, long-horizon agentic coding, and high-autonomy work. Ships with a 1M-token context window default (200k on Microsoft Foundry). Reach for it on the hardest, longest-horizon problems.
- **Claude Sonnet 4.6** — the balanced speed/intelligence/cost tier; defaults to `high` effort. A strong default for most applications; use `medium` for cost-sensitive work and `low` for high-volume or latency-sensitive workloads.
- **Claude Haiku 4.5** — the fastest, lowest-cost tier with near-frontier intelligence; good for file reads, quick edits, and routine questions.
Choose by task: start with Sonnet 4.6, move up to Opus 4.8 when the task needs stronger reasoning or longer autonomy, and down to Haiku 4.5 when speed and cost matter most. Because the lineup changes frequently, verify current model names and capabilities against Anthropic's official models overview before relying on any specific version.