Claude Prompt Generator
Build a Claude prompt using the XML-tag structure Anthropic recommends — separate role, task, context, and reference material blocks.
Claude was trained to respond well to XML-tag structure specifically — separating role, task, context, and reference material into distinct tags rather than one continuous paragraph, a structure Anthropic itself recommends. This tool builds a Claude prompt using that exact tag structure.
How to use it
These become the role and task tags in the generated prompt.
This goes into a separate context tag, kept distinct from the task instructions.
Ready to paste directly into Claude, tags included.
Tips for better results
- Keep reference material in the context tag, never inline in the task. Claude reads tag-separated content more reliably than material embedded mid-instruction.
- Use this structure even for shorter prompts. The tag structure helps consistency even when a prompt easily could be written as plain text.
- Nest multiple documents in separate tags if referencing more than one source. Distinct tags per document help Claude keep sources from blending together in its response.
Example output
“role: Senior technical editor. task: Review this API documentation section for clarity and flag ambiguous parameter descriptions. context: [pasted documentation]”
TL;DR
Claude follows plain, well-structured prose without any special syntax — but Anthropic’s own prompting documentation consistently recommends one technique that measurably improves results on longer or more complex prompts: wrapping distinct parts of a prompt in simple XML-style tags like <task>, <context>, and <document>.
Why XML tags help with Claude specifically
Without tags, a long prompt that mixes background information with an actual instruction can genuinely confuse which parts of your message are “things to do” versus “things to know.” Wrapping the reference material in <document> tags and the instruction in <task> tags removes that ambiguity entirely — Claude can see structurally, not just contextually, which block is source material and which is the actual request. This matters most for prompts pasting in an article to summarize, a contract to review, or code to refactor, where the reference text itself might otherwise be mistaken for part of the instructions.
The reasoning toggle maps to another documented Claude behavior: explicitly asking Claude to reason through a problem before answering tends to improve results on genuinely multi-step tasks (analysis, comparison, debugging) more than it helps on simple, single-step ones — which is why it’s a toggle here rather than automatic.
What each field does
- Role sets the perspective Claude answers from.
- Task is the only required field, and becomes the
<task>block. - Context becomes a separate
<context>block — background Claude needs but that isn’t the instruction itself. - Reference material becomes a
<document>block, clearly separated from your instructions. - Format and tone become part of an
<instructions>block alongside the reasoning toggle.
Task: “Summarize the key risks in this document,” Reference material: (a pasted contract clause), Format: “a bulleted list,” Reasoning: on. This produces:
<task>
Summarize the key risks in this document.
</task>
<document>
(the pasted clause)
</document>
<instructions>
Format the response as a bulleted list. Reason through this step by step before giving your final answer.
</instructions>
Who this is for
Anyone using Claude for document review, analysis, coding, or writing tasks that mix reference material with instructions — the structure helps most once a prompt gets long enough that plain prose starts to blur which part is which.
FAQ
Do I have to use XML tags with Claude, or is it optional?
Optional. Claude understands plain prose fine. Tags are a documented technique that helps most on longer or multi-part prompts, not a requirement for every message.
Can I use custom tag names instead of task/context/document?
Yes, Claude will follow consistent custom tags too — this generator uses task/context/document/instructions because they’re the most broadly documented and readable choice.
Does the reasoning toggle trigger Claude’s extended thinking feature?
No, this is a plain-text instruction asking Claude to reason visibly in its response, which works on any Claude model. It’s a different thing from the dedicated extended-thinking mode available in some Claude interfaces.
Is this useful for the Claude API, not just claude.ai?
Yes, the same tagged structure is recommended in Anthropic’s own API prompting documentation.
Does this tool store what I type?
No, everything runs locally in your browser.