All glossary terms
Cross-cutting

XML-tagged prompt

XML-tagged prompts use XML-style tags to delineate sections of a prompt — <instructions>...</instructions>, <context>...</context>, <example>...</example> — so the model can clearly distinguish parts. Anthropic's prompt guidance specifically recommends XML tags for Claude; the pattern is also effective with other models.

The tag-based structure helps the model parse complex prompts that mix multiple kinds of content: static instructions, dynamic context, few-shot examples, user input. Without tags, the model has to infer where each section starts and ends from formatting and content; with tags, the boundary is explicit and the model is less likely to confuse, say, an example for the actual input. The tags don't need to be valid XML — the model treats them as semantic markers — but consistency matters (use the same tag names across the prompt and across related prompts).

Related terms