Guide

How to Write Prompts for Claude: XML Tags, Context and Examples

Updated · SuperPrompts

Short answer

Claude works best with clearly separated parts. Wrap the background in <context>, the steps in <instructions> and the expected result in <output_format>, and state everything explicitly. Claude follows tagged, direct instructions closely and rarely confuses your examples with your request.

Why use XML tags in Claude prompts?

Tags such as <context> and <instructions> tell Claude where each part of your prompt starts and ends. That matters when you paste documents, examples or data: without tags, Claude can mistake an example for an instruction. Anthropic's own prompting guidance recommends tags for exactly this reason. They are plain labels, not code, and any name works as long as you use it consistently.

What goes in each tag?

Use <context> for who you are, who the answer is for and any background or pasted material. Put the steps in <instructions> as short bullets, one per line. Describe the deliverable in <output_format>: length, structure and tone. Add <examples> only when you want Claude to copy a style. Keep each tag focused on one job.

How do I get Claude to be more specific?

Be explicit about what "good" means: the audience, the length, what to leave out and what success looks like. Claude takes instructions literally, so "under 300 words, no jargon, end with three action items" works far better than "make it concise".

Step by step

  1. 1Put background in <context>. Role, audience and any pasted material.
  2. 2List steps in <instructions>. One short, explicit bullet per line.
  3. 3Describe the result in <output_format>. Length, structure and tone.
  4. 4Add <examples> when style matters. One or two short samples of what you want.

Real example: before and after

Produced by SuperPrompts from the one-line request below.

Before

summarize this research paper for a busy executive

After

<context>
You are an expert summarizer skilled in condensing complex research papers into clear, concise executive summaries.
</context>
<instructions>
- Summarize the key findings, methodology, and implications of the research paper.
- Use clear, jargon-free language suitable for a busy executive.
- Focus on actionable insights and strategic relevance.
- Keep the summary brief and to the point, ideally under 300 words.
- Avoid technical details unless essential for understanding impact.
</instructions>
<output_format>
- A concise executive summary paragraph.
- Highlight main conclusions and potential business or policy implications.
- Use bullet points only if they enhance clarity.
</output_format>

FAQ

Do I have to use XML tags with Claude?+

No, but they help most when a prompt mixes instructions with documents or examples. For a one-line question, plain text is fine.

Can SuperPrompts format prompts for Claude?+

Yes. Choose "For: Claude" and SuperPrompts returns the prompt split into <context>, <instructions> and <output_format>, ready to paste into Claude.

Try it on your own prompt

Free, no credit card. Works for ChatGPT, Claude, Gemini and Midjourney.

Improve your prompt free

Related guides