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.
Classification
Assign a label, score, or route. Few-shot patterns dominate.
Sentiment classifier
Classify customer reviews as positive, neutral, or negative with few-shot examples.
intermediateMulti-label content tagging
Apply zero-to-many tags from a controlled vocabulary to an article.
intermediateSupport ticket triage with priority and routing
Classify tickets by category, priority, and the team that should handle them — JSON output.
intermediateToxicity 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
Email → calendar event
Detect meeting requests in email and emit a structured event with start/end in ISO format.
beginnerStructured JSON extractor from email
Pull sender, subject, intent, urgency, and action items from a raw email body.
intermediateInvoice / receipt line-item extractor
Convert an OCR'd invoice into structured JSON: vendor, totals, line items.
intermediateRé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.
Hallucination guard: refuse when answer isn't in sources
Force a clean refusal when retrieval comes up empty instead of confabulating.
intermediateRAG over docs with [doc-N] citations
Answer a question from retrieved passages and cite every claim by source ID.
advancedMulti-document compare-and-contrast
Synthesize three vendor quotes into a table plus a one-paragraph recommendation.
Reasoning
Multi-step thinking via
Chain-of-thought math word problem
Reason step-by-step inside <thinking>, isolate the final number in <answer>.
intermediateConstraint-satisfaction logic puzzle
Solve a puzzle by enumerating constraints inside <thinking> and concluding in <answer>.
intermediateNatural language → SQL with a schema
Translate plain-English questions into SQL against a provided schema. Few-shot.
advancedCode 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.
Document summarizer with a librarian persona
Tight, factual summary: TL;DR, 3 key bullets, 1 open question — no fluff.
beginnerEmail tone rewriter
Rewrite a draft in a target tone (warm, neutral, firm) without changing meaning.
beginnerHeadline A/B variant generator
Produce N distinct headline variants for a piece of content, each with a different angle.
advancedTest 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.
Complex
Two-turn protocols, self-critique loops, branching exploration, and validating data pipelines. Multiple stages in one prompt.
Extract → validate → transform pipeline in one call
Four-stage data pipeline: extract raw fields, validate against rules, transform to target shape, emit errors.
advancedGenerate → self-critique → revise in one call
Three-stage prompt where Claude drafts, scores its own draft against a rubric, then revises.
advancedMap-reduce summarization over many chunks
Summarize each chunk independently, then synthesize a single coherent summary — two prompts, structured handoff.
advancedPlan-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.
advancedTree-of-thought reasoning with branch scoring
Explore three reasoning paths, score each against criteria, pick the winner — all in one prompt.
Working Claude XML Prompt Examples. claudexml.com. https://claudexml.com/examples/