# <documents> tag — Claude XML prompting reference

> How to use the <documents> XML tag in Claude prompts: when to use it, when not to, minimal and full examples, common mistakes.
>
> Source: https://claudexml.com/tags/documents/ · Last updated 2026-05-25

Home / Tags / <documents>

# <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


```xml
<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/`
