Using XML Tags as Delimiters
Wrapping sections in , , for clarity.
Why Delimiters Matter
When a prompt contains multiple distinct sections — instructions, context, examples, output rules — the model needs clear boundaries to know where one section ends and another begins.
Without delimiters, sections blur together and the model may misinterpret which text is an instruction versus which is data to process.
XML tags are one of the most reliable delimiter styles available.
XML Tags as Structural Containers
XML tags wrap content in named containers. The model reads the tag name as a semantic label for what the content represents.
Common tags used in prompt engineering:
<instructions>— what the model should do<context>— background information<document>— source text to process<examples>— few-shot demonstrations<output>— desired response format
All lessons in this course
- Using XML Tags as Delimiters
- Modular Prompt Sections
- Header-Body-Footer Prompt Pattern
- Prompt Organization Best Practices