# 25 Working Claude XML Prompt Examples — Copy & Paste Library

> 25 complete Claude XML prompts across classification, extraction, RAG, reasoning, generation, and transformation. Each with sample input, expected output, and notes.
>
> Source: https://claudexml.com/examples/ · Last updated 2026-05-25

Home / Examples

# Working Claude XML prompt examples

    25 complete, copy-pasteable prompts across six categories. Tested with the Claude API. Replace the `{{ … }}` placeholders and ship.

    Each example is a single page with the full prompt, a sample input, expected output, and notes on what makes it work. All examples have a `.md` mirror at the same URL with a `.md` suffix for LLM-friendly fetching.


      ClassificationExtractionRAGReasoningGenerationTransformationComplex




## Classification

      Assign a label, score, or route. Few-shot patterns dominate.


      beginner
### Sentiment classifier
Classify customer reviews as positive, neutral, or negative with few-shot examples.

      intermediate
### Multi-label content tagging
Apply zero-to-many tags from a controlled vocabulary to an article.

      intermediate
### Support ticket triage with priority and routing
Classify tickets by category, priority, and the team that should handle them — JSON output.

      intermediate
### Toxicity grader with rubric
Score user-generated comments on a 0–3 toxicity scale with reasoning.





## Extraction

      Pull structured data out of free text. JSON output via .


      beginner
### Email → calendar event
Detect meeting requests in email and emit a structured event with start/end in ISO format.

      beginner
### Structured JSON extractor from email
Pull sender, subject, intent, urgency, and action items from a raw email body.

      intermediate
### Invoice / receipt line-item extractor
Convert an OCR'd invoice into structured JSON: vendor, totals, line items.

      intermediate
### Résumé → structured JSON
Convert a free-form résumé into a normalized candidate profile.





## RAG

      Answer from retrieved passages. Cite, refuse cleanly when sources don't cover the question.


      intermediate
### Hallucination guard: refuse when answer isn't in sources
Force a clean refusal when retrieval comes up empty instead of confabulating.

      intermediate
### RAG over docs with [doc-N] citations
Answer a question from retrieved passages and cite every claim by source ID.

      advanced
### Multi-document compare-and-contrast
Synthesize three vendor quotes into a table plus a one-paragraph recommendation.





## Reasoning

      Multi-step thinking via  + . Math, logic, code review.


      beginner
### Chain-of-thought math word problem
Reason step-by-step inside <thinking>, isolate the final number in <answer>.

      intermediate
### Constraint-satisfaction logic puzzle
Solve a puzzle by enumerating constraints inside <thinking> and concluding in <answer>.

      intermediate
### Natural language → SQL with a schema
Translate plain-English questions into SQL against a provided schema. Few-shot.

      advanced
### Code review with severity levels
Review a diff and produce structured findings (bug, perf, style) with severities.





## Generation

      Produce new text in a controlled shape, tone, or variation set.


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

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

      beginner
### Headline A/B variant generator
Produce N distinct headline variants for a piece of content, each with a different angle.

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





## Transformation

      Multi-stage pipelines that emit several views in one call.


      intermediate
### Transcript cleaner with speaker labels and summary
Multi-stage pipeline: clean fillers, label speakers consistently, produce a 5-bullet summary.





## Complex

      Two-turn protocols, self-critique loops, branching exploration, and validating data pipelines. Multiple stages in one prompt.


      advanced
### Extract → validate → transform pipeline in one call
Four-stage data pipeline: extract raw fields, validate against rules, transform to target shape, emit errors.

      advanced
### Generate → self-critique → revise in one call
Three-stage prompt where Claude drafts, scores its own draft against a rubric, then revises.

      advanced
### Map-reduce summarization over many chunks
Summarize each chunk independently, then synthesize a single coherent summary — two prompts, structured handoff.

      advanced
### Plan-then-act with explicit sub-task scaffolding
Two-turn pattern: first turn produces a numbered plan; second turn executes each sub-task and returns structured results.

      advanced
### Tree-of-thought reasoning with branch scoring
Explore three reasoning paths, score each against criteria, pick the winner — all in one prompt.





Cite this page

`Working Claude XML Prompt Examples. claudexml.com. https://claudexml.com/examples/`
