Where Do Instructions Go in a Long Claude Prompt?
Put long documents at the top and your instructions and question at the bottom. Anthropic's docs recommend this for inputs of 20,000 tokens or more. This page used to give the opposite advice, and the docs don't support it. In a short prompt, the order matters much less.
<documents>
<document index="1">
<source>[file name]</source>
<document_content>
[paste the first document]
</document_content>
</document>
<document index="2">
<source>[file name]</source>
<document_content>
[paste the second document]
</document_content>
</document>
</documents>
First, find word-for-word quotes that bear on the question below, and put them in <quotes> tags. If there are none, say so.
Then answer using only those quotes, and refer to each by its document number.
Question: [your question]
- 1The documentsin tags, at the top
- 2Examples, if you have thembelow the documents
- 3Instructions and your questionat the end
Try it now
- 1Pick a long document you need something from, and paste the prompt above with your text in the tags.
- 2Put your real question on the last line, and check that no instructions are left in the middle.
- 3Read the
<quotes>section first. You'll know it worked when the answer refers to quotes you can find in the original.
Use it when
Reviewing a contract, comparing several reports, asking questions about a transcript, or any prompt where the pasted material is much longer than your request. It matters most when you're using several documents at once.
Skip it when
A short prompt with a paragraph or two of text. Rule of thumb, not a vendor figure: put it in whichever order reads clearly. The docs' advice is aimed at large inputs, and it doesn't need rebuilding for a quick rewrite.
Why it works
Anthropic's prompting docs say that placing long documents above your query, instructions and examples improves performance across all models. They also say queries at the end can raise response quality by up to 30 percent in its tests, especially with complex, multi-document inputs. That's Anthropic's figure, and it's an upper bound for those tests, so don't expect it on every prompt. Tags help too. The docs say XML tags reduce misreading when a prompt mixes instructions, context and inputs, because each part is clearly labeled. By the ratio in Anthropic's model docs, 20,000 tokens is about 11,000 words, so this applies to a long report or contract, not an email.
Example
Say you're comparing two 40-page supplier contracts for how each one handles termination. Paste both into <document> tags, each with its file name in <source>. End with: "Which contract lets us leave sooner, and at what cost?" Claude pulls the termination clauses into <quotes> first. It then compares them, and you can check each quote against the page.
Going further
The quote step comes from the same docs, which say that asking Claude to quote first helps it focus on what's relevant and ignore the rest. Anthropic's hallucination guide suggests it for documents over 20,000 tokens. Use descriptive tag names and keep them the same across prompts. If a document might contain instructions, such as an email you're analyzing, tags make the boundary clear. Rule of thumb, not a vendor figure: add a line saying that text inside the tags is material to analyze, not instructions to follow.
Common mistakes
- Putting your question above a long paste, then adding nothing after it. This is the order Anthropic's docs advise against for large inputs.
- Scattering instructions between documents, so it's unclear which rule applies to what.
- Pasting several documents with no labels, then asking about "the second report." Give each one a
<source>. - Expecting the 30 percent figure on your own task. It's Anthropic's best case from its tests.
Sources
- Prompting best practices, Claude Platform Docs
- Reduce hallucinations, Claude Platform Docs
- Models overview, Claude Platform Docs
Checked 6 November 2026. Products change often, so confirm details with the vendor.