XML Tags in Prompts

Prompting

Definition

A Claude-native prompting pattern using XML-style tags (e.g., <document>, <instructions>, <example>) to clearly delimit sections of a prompt. Helps Claude unambiguously identify context, instructions, and data. Reduces prompt injection risk by separating instructions from untrusted input.

Example Usage

Wrap user-supplied content in <user_input> tags and instructions in <instructions> tags to prevent content from overriding your system prompt.