prompt-engineering-output-xml
Installation
SKILL.md
XML-Tagged Prompts & Outputs
Disclaimer. Anthropic's published prompt-engineering guidance is the authoritative source for XML-tag behavior on Claude. Patterns below distill that guidance plus practitioner experience; verify against current Anthropic docs for any model-specific changes.
Anthropic's models pay strong attention to XML-style tags. Tags solve two problems that prose alone struggles with:
- Input sandboxing. Wrapping user-supplied content in
<user_input>...</user_input>tells the model "this is data, not instructions" and dramatically reduces prompt-injection success. - Nested structure with prose. When the output is a mix of structured fields and free text (a code review with a verdict + per-file comments + a summary), JSON forces awkward escaping while XML keeps the prose clean.
Use this skill on Claude. On other models, prefer JSON via prompt-engineering-output-json unless you have a specific reason.