Claude Prompt XML Helper
Claude XML Prompting Tips
- Use XML tags to clearly structure different parts of your prompt (e.g.,
<instructions>
, <context>
, <example>
).
- Choose descriptive tag names (e.g.,
<document>
, <user_query>
, <persona>
).
- Be consistent with your tag names.
- You can nest tags manually within the "Element Content" if needed. The CDATA section will preserve your structure.
- Content within
<![CDATA[...]]>
is treated as raw text, preserving special characters like <
, >
, and &
.