<claudexml/>

<documents> — when and how to use it in Claude prompts

The canonical pattern for RAG-style prompting with several retrieved passages.

Wrapper for multiple <document> tags. The canonical RAG container.

When to use <documents>

  • Any RAG-style prompt with two or more retrieved passages.
  • When you want Claude to compare or synthesize across sources.

When not to use it

  • Single document — not strictly needed, but harmless.

Minimal example

<documents>
  <document>...</document>
  <document>...</document>
</documents>

Full example

See the full RAG example on the <document> page.

Common mistakes

  • Renaming this tag (e.g., <sources>, <corpus>) without reason. <documents> + <document> is the convention Claude has seen most.
Cite this page
<documents> — When and How to Use in Claude Prompts. claudexml.com. https://claudexml.com/tags/documents/