Use this Claude long context prompt to place source documents first, label them consistently, extract relevant passages and answer only after the evidence is visible. The structure helps Claude keep several large inputs separate and gives reviewers a clear trail back to the original material.

Anthropic’s current prompting best-practices guide gives three specific recommendations for data-rich inputs: put the documents near the top, structure them with XML tags and ask for relevant quotes before the analysis. This guide turns those recommendations into a reusable template.

On this page

The long-context prompt template

Replace the bracketed fields and paste the document text inside the matching tags:

<documents>
  <document index="1">
    <source>[file name or source label]</source>
    <document_content>
      [document text]
    </document_content>
  </document>
  <document index="2">
    <source>[file name or source label]</source>
    <document_content>
      [document text]
    </document_content>
  </document>
</documents>

<task>
Answer this question:
[question]

Use only the documents above for factual claims.
First, extract the passages that are relevant to the question.
For each passage, name the source and section.
Then write the answer using those passages.

If the documents disagree, show the disagreement.
If the evidence is incomplete, say what is missing.
Do not fill gaps with an unsupported assumption.
</task>

<output_format>
1. Relevant passages
2. Answer
3. Conflicts or missing evidence
4. Items to verify
</output_format>

The documents come first. The question, instructions and output format come after them. Anthropic says this order improves performance for long inputs across its current models, especially once the material reaches roughly 20,000 tokens or more.

Why the source labels are part of the prompt

A long prompt often contains several kinds of material: a policy, a report, an email thread and a table. Without clear labels, a response can blur who said what.

Use a short, stable source label:

  • customer_interviews_q3.txt
  • security_policy_v4.pdf
  • supplier_proposal_2026.docx
  • meeting_notes_october.md

Do not rename the same source halfway through the conversation. If you paste an updated version, give it a new label and say which version should control.

The XML does not need to be complicated. Consistent tags are more useful than clever ones. Promptline’s Claude XML tags guide explains how to separate instructions, examples and inputs when a prompt has several moving parts.

Ask for quotes before analysis

Anthropic recommends grounding long-document answers in quotes first. That intermediate step makes the evidence visible before the model starts combining it.

For a shorter answer, change the quote instruction to:

Extract up to eight short passages that directly answer the question. Keep each passage under 35 words and label its source.

For a comparison, use:

For each comparison criterion, extract one relevant passage from each source before stating the difference.

For a gap review, use:

List the requirements in Document 1. For each requirement, quote the best matching evidence from Document 2 or write "no supporting passage found".

Quotes are evidence for review, not a guarantee that every relevant passage was found. Check the original source before relying on a number, deadline, exception or legal requirement.

Put the question after the documents

The order can feel backwards if you normally start with “Please analyse these files.” Anthropic’s long-context guidance is explicit: place the long-form data near the top, above the query, instructions and examples.

That does not mean the task should be vague. Put a clear task block immediately after the documents. State:

  1. the question;
  2. the allowed sources;
  3. the decision or audience;
  4. the output shape;
  5. what to do when evidence is missing.

A weak task asks for “insights.” A stronger one asks for the three repeated complaints, the source for each complaint and one counterexample that challenges the pattern.

A prompt for several reports

<documents>
  [paste the labelled documents here]
</documents>

<task>
Identify the five findings that appear across at least two reports.

For every finding:
- name the reports that support it;
- quote one short passage from each report;
- separate measured results from the authors' interpretation;
- note any report that reaches a different conclusion.

Do not count repeated wording from the same underlying source as independent evidence.
</task>

This prompt adds a minimum evidence rule. It also prevents one report from looking like a consensus simply because the same claim appears in several sections.

A prompt for policy and procedure checks

<documents>
  [policy and procedure text]
</documents>

<task>
Treat the policy as the requirement source and the procedure as the implementation source.

For each policy requirement, return:
- requirement;
- policy passage;
- matching procedure passage;
- status: covered, partly covered, not covered or unclear;
- explanation;
- question for the document owner.

Do not mark a requirement covered when the procedure only implies it.
</task>

Keep the policy and procedure in separate document blocks. The task assigns each one a role, so the answer does not treat them as interchangeable.

A prompt for one very long document

You can use the same structure with a single source:

<documents>
  <document index="1">
    <source>[document name and version]</source>
    <document_content>
      [document]
    </document_content>
  </document>
</documents>

<task>
Find the sections relevant to [question].
Quote those sections first.
Then answer in no more than [length].
Preserve every stated exception and condition.
List any part of the question the document does not answer.
</task>

Adding the version to the source label helps you notice when a later conversation introduces an older copy.

Break a broad review into stages

Long context does not remove the need to plan the task. If one prompt asks for extraction, comparison, scoring, recommendations and a final presentation, the output can become difficult to check.

Use a short chain:

  1. Index: list the documents, sections and dates.
  2. Extract: collect the passages for the question.
  3. Compare: organize agreements and conflicts.
  4. Decide: draft the requested answer from reviewed evidence.
  5. Verify: list claims that still need a human check.

The output of each stage becomes the input to the next. See prompt chaining examples for ways to define the handoff.

What not to put in the prompt

Avoid instructions that conflict with the evidence rules, such as “always give a definitive answer.” If the documents are incomplete, a forced conclusion hides the gap.

Also avoid:

  • pasting several files without source labels;
  • putting a long example between the documents and the actual task;
  • asking for exact quotations without naming which source should be quoted;
  • using “the report” when the prompt contains several reports;
  • requesting a score without defining the scale.

A long prompt should be explicit, not crowded. Remove instructions that do not change the result.