Chapter 2 · Practice 1 of 4
Separate instructions, context, examples and input with consistent delimiters
Why it matters
When a prompt mixes several kinds of content, the model has to work out where each one starts and stops. Give it clear boundaries.
All three vendor guides recommend structure:
- Anthropic: wrap each type of content in its own XML tag, such as
<instructions>,<context>and<input>, and nest tags when content has a hierarchy. - OpenAI: use Markdown headers and lists for sections and XML tags to mark where reference content starts and ends.
- Google: for Gemini 3, use consistent delimiters, either XML tags or Markdown headings.
Pick one convention and use the same tag names across all your prompts. Then your code, your reviewers and the model all know where to look.
text
<instructions>
Summarise the contract for a non-lawyer in five bullet points.
</instructions>
<contract>
{{contract_text}}
</contract>
Do
- Use descriptive tag names and reuse them across prompts
Avoid
- Pasting user input straight after instructions with no boundary