Advanced Prompt Engineering · Lesson 2
Structuring prompts: XML, markdown, roles
XML tags for Claude, markdown for GPT/Gemini, separating system/user/assistant, and defending against delimiter injection.
Practical exercise
What to do after this lesson
Take the task 'translate a review into English'. Implement two prompts — XML for Claude and markdown for GPT/Gemini. Then write a malicious review attempting delimiter injection and prove that the version with a unique delimiter (<review_<random>>) + explicit distrust warning does NOT execute the injection, while the naive version does.
Ready-to-use prompt
Template for this lesson
Copy and adapt to your context. Text in angle brackets should be replaced.
Help me structure this prompt for the target model. Model: <Claude / GPT-4 / Gemini> Task: <…> Untrusted user input: <yes/no, what exactly> Give: (1) markup (XML for Claude / markdown for GPT-Gemini), (2) system/user separation, (3) a unique delimiter and a distrust warning for the user block.