<document> — when and how to use it in Claude prompts
Use one
Wraps a single document or passage of reference material. The bedrock of RAG prompts.
When to use <document>
- Any retrieved passage, file, transcript, or article you want Claude to read and ground its answer in.
- When citing — pair with
<source>so the model can name the source in its reply.
When not to use it
- Don't use it for instructions or examples — those have their own tags.
- Don't paste enormous documents in if only a section is relevant; chunk first.
Minimal example
<document>
The mitochondrion is the powerhouse of the cell.
</document>
Full example
<instructions>
Answer the user's question using only the documents provided.
If the answer isn't in the documents, say "I don't know based on the provided sources."
Cite each claim with the source name in square brackets, e.g. [doc-1].
</instructions>
<documents>
<document>
<source>doc-1: 2025-Q4-board-deck.pdf, slide 12</source>
<document_content>
Q4 revenue was $14.2M, up 23% YoY. Net new ARR was $3.1M.
</document_content>
</document>
<document>
<source>doc-2: 2025-Q4-board-deck.pdf, slide 18</source>
<document_content>
Gross margin held at 72%. Sales efficiency improved to 1.4.
</document_content>
</document>
</documents>
<question>What was Q4 revenue and gross margin?</question>
Common mistakes
- Putting documents before instructions when they're long. Anthropic's guidance is: put long documents first, then instructions, then the question. Claude attends more strongly to instructions placed after the bulk of context.
- Forgetting
<source>and then asking the model to cite — it'll invent source names.
Cite this page
<document> — When and How to Use in Claude Prompts. claudexml.com. https://claudexml.com/tags/document/