XML-Structured Prompt Template

Anthropic docs

Submit a prompt

Overview

Structure a complex LLM task with XML tags for context, constraints, and output format.

Use cases

Prompt
Copied 0
<instructions>
Do the task specified in <task>. Follow <constraints>. Use <context>. Return output in <output_format>.
</instructions>

<task>
<<<what you want done>>>
</task>

<context>
<<<background docs, audience, examples>>>
</context>

<constraints>
- <<<tone, length, must/must-not>>>
</constraints>

<output_format>
<<<bullets / markdown / JSON schema>>>
</output_format>

Can AI?

Alternatives

  • Critique a prompt for ambiguity and conflictsThis prompt checks a prompt written for an LLM for unclear wording, missing definitions, instructions that clash, and assumptions left unstated. It returns a list of issues, suggested edits to specific lines, and a rewritten version.ai agent framework
  • Grade an AI response against expert workThis prompt rates an AI answer on how well it follows its original instructions, measured against what a top human expert would deliver. It returns a letter grade from A+ to F, five reasons for the grade, a score out of 100, and how the score was reached.ai agent framework