Claude Tips mascot
Claude Tips & Tricks
Prompt Engineering beginner Featured

Use XML Tags to Structure Prompts

Claude responds better to XML-delimited sections than plain text or markdown headers in system prompts.

When writing prompts for Claude, use XML tags to clearly delineate different sections. Claude was specifically trained to recognize XML structure.

<context>
You are a senior code reviewer at a tech company.
</context>

<instructions>
Review the following code for bugs, security issues, and style.
Provide feedback in a structured format.
</instructions>

<code>
{user's code here}
</code>

This works better than markdown headers or plain-text separation because Claude was trained on lots of XML-structured prompts.

Paste into Claude Code
Rewrite my last prompt using XML tags to structure it better. Use <context>, <instructions>, <constraints>, and <output_format> sections.