Where Should Important Context Go in a Claude Prompt?
With long inputs, put the documents at the top of the prompt and your question at the end. Anthropic says this ordering improves performance across all models. For a short prompt with a paragraph of input, the order matters far less, so write whichever way is clearest.
<documents>
<document index="1">
<source>[filename or title]</source>
<document_content>
[paste the first document]
</document_content>
</document>
<document index="2">
<source>[filename or title]</source>
<document_content>
[paste the second document]
</document_content>
</document>
</documents>
First, find the quotes from these documents that are relevant to my question, and list them with their source.
Then answer, using only those quotes.
My question: [your specific question]
- 1Long documents, in tagstop
- 2Instructions and examplesafter the data
- 3Your specific questionlast
- 20k+tokens, when this order matters
- Up to 30%better response qualitywith the query at the end
Try it now
- 1Take a long document you've been asking about, and paste it into a new chat using the template above.
- 2Put your question in the last line, with nothing after it.
- 3Check two of the quotes Claude lists against the document.
- 4You'll know it's working if each claim points to a real quote from a named source. If quotes are vague, your question is probably too broad.
Use it when
Use this when you're pasting long reports, several documents, a transcript, a large code file or a data export, and especially when you're asking Claude to compare documents or find something across them.
Skip it when
Don't reorganize a short prompt for this. Rule of thumb, not a vendor figure: below about 20k tokens, clarity matters more than order. It also doesn't apply in the same way to uploaded project knowledge, since you don't control where that sits. There, name the file you want in your question.
Why it works
Anthropic's prompting guide says that for large documents or data-rich inputs of 20k tokens or more, you should place long material near the top, above your query, instructions and examples. It says queries at the end can improve response quality by up to 30 percent in tests, especially with complex, multi-document inputs. It also recommends wrapping each document in <document> tags, with <source> and <document_content> inside. Those tags give Claude a name to refer to, so it can tell you which file a claim came from.
Example
You're comparing two supplier contracts on liability, and they run to about 30,000 tokens in total. You wrap each in tags with its filename as the source, and add a last line: "Which contract leaves us more exposed if a shipment is lost, and which clause says so?" The answer can now say which contract each clause comes from, and you can look up both clauses.
Going further
Asking for relevant quotes first is itself part of Anthropic's long-context guidance, and it cuts through a large document before the answer starts. In Claude Code, placement works differently. CLAUDE.md loads every session, so the docs say to keep it short and only include what Claude can't work out from the code. Path-scoped rules in .claude/rules/ load only when Claude works with matching files, which is how you place context near the point it's needed instead of always having it around.
Common mistakes
- Burying your question in the middle of a long paste, followed by more background.
- Pasting several documents with no separators, so Claude can't tell you which one a fact came from.
- Applying a rule meant for long inputs to a three-line prompt, and making it harder to read.
- Putting every rule in
CLAUDE.mdbecause it's always loaded. Every line there takes some of Claude's attention on every task.
Sources
- Prompting best practices, Claude Platform Docs
- Best practices, Claude Code Docs
- How Claude remembers your project, Claude Code Docs
Checked 6 November 2026. Products change often, so confirm details with the vendor.