← Discover

Official guide · Anthropic

Separate instructions, context, and examples so they do not compete

Use clear sections for instructions, background, examples, and the requested output when a task contains long material or multiple constraints.

Original source

Prompting best practices: structure prompts with XML tags

Anthropic · Official guide · checked 2026-07-15

What the source is saying

Anthropic documents XML tags as a way to improve clarity and structure in complex prompts.

Try it in your work

Open the linked pattern for a reusable template, variables to change, and an example output shape.

Open the practical pattern →

Keep in mind

Tags do not fix unclear instructions. The sections still need useful content and a concrete task.