The Claude prompting guide from Anthropic boils down to a few habits: say exactly what you want, explain why, show 3 to 5 varied examples, separate parts of the prompt with XML tags, and put long documents above the question. This article summarises that guidance as published in Anthropic's docs (checked November 2026) and shows how to apply it.
Anthropic's test for any prompt: show it to a colleague with minimal context on the task and ask them to follow it. In the guide's words, "If they'd be confused, Claude will be too." The sections below are the techniques the guide lists for current Claude models.
Be clear and direct
The guide describes Claude as "a brilliant but new employee who lacks context on your norms and workflows." It says Claude responds well to explicit instructions, and that if you want more than the task strictly requires, you should ask for it rather than expect Claude to infer it from a vague prompt. Anthropic's own example:
Less effective:
Create an analytics dashboard
More effective:
Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation.
Two further points from the same section: be specific about the output format and constraints, and use numbered lists or bullets when the order or completeness of steps matters.
Explain why, not just what
Giving the motivation behind an instruction lets Claude "generalize from the explanation." The guide's example replaces a bare rule with a reason:
Less effective:
NEVER use ellipses
More effective:
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.
With the reason, Claude can also avoid other things a speech engine would stumble over, which a one-word prohibition does not cover.
Use examples (3 to 5, varied)
Anthropic calls examples "one of the most reliable ways to steer Claude's output format, tone, and structure." The guide asks that they be:
- Relevant: they mirror your actual use case.
- Diverse: they cover edge cases and vary enough that Claude does not pick up unintended patterns.
- Structured: wrapped in
<example>tags, with several inside<examples>, so they are not mistaken for instructions.
The guide's tip is to include 3 to 5 examples. It also suggests asking Claude to evaluate your examples for relevance and diversity, or to generate more from your initial set. For the general technique across models, see few-shot prompting.
Structure the prompt with XML tags
When a prompt mixes instructions, context, examples and variable input, wrapping each kind of content in its own tag "reduces misinterpretation." The guide's advice is to use consistent, descriptive tag names and to nest tags when content has a natural hierarchy. A template following that advice (the placeholders in double braces are yours to fill):
<context>
We are a small accounting firm. Clients are non-technical.
</context>
<instructions>
Rewrite the email below in plain language, under 120 words.
If it contains a deadline, put the deadline in the first sentence.
</instructions>
<input>
{{EMAIL_TEXT}}
</input>
This template is our own illustration of the guide's pattern, not a prompt from Anthropic.
Give Claude a role
The guide says setting a role in the system prompt "focuses Claude's behavior and tone for your use case," and that even a single sentence helps. Its example is "You are a helpful coding assistant specializing in Python." passed as the system parameter of the Messages API. In the Claude apps there is no system field to fill in per message, so put the role at the start of your first message instead. System prompt vs user prompt explains which instructions belong where.
Order matters for long documents
For inputs of 20k tokens or more, the guide says to put long documents "near the top of your prompt, above your query, instructions, and examples." It adds that putting the query at the end "can improve response quality by up to 30 percent in tests, especially with complex, multidocument inputs." For several documents, it recommends this structure:
<documents>
<document index="1">
<source>annual_report_2023.pdf</source>
<document_content>
{{ANNUAL_REPORT}}
</document_content>
</document>
<document index="2">
...
</document>
</documents>
Analyze the annual report and competitor analysis. Identify strategic advantages and recommend Q3 focus areas.
Control the format of the answer
The guide lists four ways to steer formatting:
- Say what to do, not what to avoid. Instead of "Do not use markdown in your response", write "Your response should be composed of smoothly flowing prose paragraphs."
- Use XML format indicators. For example: "Write the prose sections of your response in <smoothly_flowing_prose_paragraphs> tags."
- Match your prompt style to the output you want. The formatting in your prompt can influence the response, so removing markdown from the prompt can reduce markdown in the output.
- Give detailed formatting guidance when you need tight control. The guide includes a full sample block for reducing bullet points and bold text in long-form writing.
Formatting defaults differ by model. The guide says Claude Fable 5.1 already formats less than earlier models, so a heavy "avoid markdown" block on that model can remove structure the content needs. If you use a newer model, check the model-specific section of the guide before copying a block.
Let Claude say it does not know
Anthropic's hallucination guide lists "Allow Claude to say 'I don't know'" first, noting that explicit permission to admit uncertainty "can drastically reduce false information." For documents over 20k tokens it also suggests asking Claude to extract word-for-word quotes first and then answer using only those quotes. A prompt in that style:
<policy>
{{POLICY}}
</policy>
1. Extract exact quotes from the policy that are relevant to data retention.
If you cannot find any, write "No relevant quotes found."
2. Answer the question using only those quotes, citing them by number.
If the quotes do not answer it, say "I don't have enough information to answer this."
Anthropic is explicit that these techniques reduce hallucinations but do not eliminate them, so check anything that matters. Why AI hallucinates and how to reduce it covers the wider picture.
Prefilling is gone on newer models
Older advice often suggested starting Claude's reply for it (a "prefill") to force JSON or skip a preamble. Anthropic's docs say that starting with Claude 4.6 models, prefilled responses on the last assistant turn are no longer supported, and requests that include one return a 400 error. Earlier models still support it. The replacements the docs name:
| Old use of prefill | What the docs suggest instead |
|---|---|
| Force JSON or another format | Structured outputs, or ask Claude to match the structure. For classification, a tool with an enum field of valid labels. |
| Skip the preamble | A direct instruction such as "Respond directly without preamble. Do not start with phrases like 'Here is...', 'Based on...', etc." |
| Continue an interrupted reply | Put the end of the interrupted text in the user message and ask Claude to continue from where it left off. |
Thinking and effort
Newer models use adaptive thinking, where Claude decides when and how much to think based on the effort setting and the complexity of the question. The docs say Claude Fable 5.1, Claude Mythos 5.1, Claude Fable 5, Claude Mythos 5 and Claude Opus 5.5 always have thinking on. On Claude 4.7 and later, setting budget_tokens returns a 400 error; the docs recommend lowering effort or using max_tokens as a hard limit. These are API settings. In the Claude apps you only choose the model and, where offered, whether to use extended thinking. For the prompting side of reasoning, see chain-of-thought prompting.
If Claude's answer is still off
Re-read the prompt as the new employee from the guide would. Usually something is missing: the audience, the length, what to do when information is absent, or an example of a good answer. Add that before changing anything else. Then test on several real inputs rather than one, because a prompt that works once can fail on the next. A beginner-level companion to this article is how to write a good AI prompt.
Frequently asked questions
- Do I need XML tags to prompt Claude well?
- No, but Anthropic's guide says they help Claude parse prompts unambiguously when a prompt mixes instructions, context, examples and variable inputs. The tag names are not special. The guide asks for consistent, descriptive names such as <instructions>, <context> and <input>.
- How many examples should a Claude prompt include?
- Anthropic's guide says to include 3 to 5 examples for best results. They should be relevant to the real task, varied enough that Claude does not copy an accidental pattern, and wrapped in <example> tags (several of them inside <examples>).
- Can I still prefill Claude's response?
- Not on newer models. Anthropic's docs say that starting with Claude 4.6 models, a prefilled assistant message on the last turn is no longer supported, and such requests return a 400 error. Earlier models still accept prefills. Use direct instructions, XML tags or structured outputs instead.
- Does the same advice apply to every Claude model?
- The general techniques apply to current models, but Anthropic notes that some behaviour is model-specific, such as response length and how much a model formats. Where the guide names a model, treat the advice as measured on that model and re-check it against your own tests before applying it to another.