# <examples> tag — Claude XML prompting reference

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

Home / Tags / <examples>

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

    Groups few-shot examples together so they are clearly demarcated from the live question.

    Wrapper around multiple `<example>` tags. Tells Claude "the next block is demonstrations, not the actual task."


## When to use `<examples>`


- Any time you have two or more examples — wrap them.
- When you want a single, scannable section the model treats as one logical unit.


## When not to use it


- Not needed for a single example, though it doesn't hurt.


## Minimal example


```xml
<examples>
  <example>...</example>
  <example>...</example>
</examples>
```


## Full example


```xml
<instructions>
Convert questions into SQL against the schema in <schema>.
</instructions>

<schema>
users(id, email, signup_date)
orders(id, user_id, total_cents, created_at)
</schema>

<examples>
  <example>
    <q>How many users signed up in March 2026?</q>
    <sql>SELECT COUNT(*) FROM users WHERE signup_date >= '2026-03-01' AND signup_date < '2026-04-01';</sql>
  </example>
  <example>
    <q>Total revenue from each user, descending.</q>
    <sql>SELECT user_id, SUM(total_cents) AS revenue FROM orders GROUP BY user_id ORDER BY revenue DESC;</sql>
  </example>
</examples>

<q>{{ user_question }}</q>
```


## Common mistakes


- Mixing `<example>` tags with unrelated content inside the wrapper. Keep it clean.


Cite this page

`<examples> — When and How to Use in Claude Prompts. claudexml.com. https://claudexml.com/tags/examples/`
