← All lessons
Prompt Engineering~14 min
Structuring Inputs: XML Tags and Multishot Examples
Delimit data, instructions, and examples with XML tags, separate untrusted data from commands, and teach format by demonstration with few-shot examples.
What you will be able to do
- ✓Explain why Claude is trained to recognize XML-style tags and how consistent tagging delimits prompt structure
- ✓Separate untrusted user data from instructions to reduce prompt-injection-style failures
- ✓Use multishot (few-shot) examples to convey desired format, tone, and edge cases, keeping example structure consistent
- ✓Order long-context prompts with longform data near the top and the query/instructions at the bottom
4 concepts·5 hands-on exercises·3-question check