# Headline A/B variant generator — Claude XML example

> Produce N distinct headline variants for a piece of content, each with a different angle.
>
> Source: https://claudexml.com/examples/headline-ab/ · Last updated 2026-05-25

Home / Examples / Headline A/B variant generator
    Generation · beginner

# Headline A/B variant generator

    Produce N distinct headline variants for a piece of content, each with a different angle.

    Content team needs headline candidates that span angles (curiosity, benefit-led, contrarian) — not minor rewordings.


## The prompt

    Copy this verbatim. Replace the `{{ … }}` placeholders with your values.


```xml
<instructions>
Generate exactly {{ n }} headline variants for the article below. Constraints:

- Each headline ≤ 70 characters.
- Each must take a meaningfully different angle:
  curiosity, benefit, contrarian, data-led, narrative.
- No clickbait (no "you won't believe", no "shocking", no all-caps).
- Return as JSON array inside <result> tags, in this shape:
  [ { "angle": "curiosity|benefit|contrarian|data-led|narrative",
      "headline": "string" } ]
</instructions>

<article>{{ article_text }}</article>

Return inside <result> tags.
```


## Sample input


```xml
n: 5
Article: study showing remote workers report 15% higher focus but 25% more loneliness
```


## Expected output


```xml
<result>
[
  {"angle": "data-led",  "headline": "Remote workers gained 15% focus and lost 25% to loneliness"},
  {"angle": "curiosity", "headline": "Why your most focused employees are also your loneliest"},
  {"angle": "contrarian","headline": "Remote work didn't fail — it just exposed what offices were hiding"},
  {"angle": "benefit",   "headline": "How to keep remote's focus gains without the isolation tax"},
  {"angle": "narrative", "headline": "Three years remote: what the focus data didn't tell us"}
]
</result>
```


## Notes & tuning tips


- Naming distinct angles in the constraint is what produces variety. Without it, all 5 headlines rhyme.
- Cap at 5 variants — beyond that, quality degrades and the angles collapse.
- Filter clickbait server-side too as a safety net.


## What this example uses

    Tags: <instructions> <format>

    Patterns: structured output


## More like this


      generation
### Document summarizer with a librarian persona
Tight, factual summary: TL;DR, 3 key bullets, 1 open question — no fluff.

      generation
### Email tone rewriter
Rewrite a draft in a target tone (warm, neutral, firm) without changing meaning.

      generation
### Test case generator from a spec
Read a feature spec and produce test cases (happy path, edge cases, failure modes).




Cite this page

`Headline A/B variant generator. claudexml.com. https://claudexml.com/examples/headline-ab/`
