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
- System prompt
A system prompt is the initial instruction given to an LLM at the start of a session that sets behaviour, persona, output format, and constraints — distinct from user messages that follow.
- Few-shot prompting
Few-shot prompting provides the model with example input-output pairs in the prompt to demonstrate the desired pattern before asking it to handle the actual input.
- Prompt engineering for software teams
Prompt engineering for software teams is the discipline of writing prompts that consistently produce useful output from LLMs in engineering workflows — code generation, test authoring, PR review, technical writing.