A Claude prompt generator built on Anthropic’s prompting guide
This Claude prompt generator turns your request into the structure Anthropic recommends for Claude: a role in the system prompt, long documents at the top, your instructions after them, and each part in its own XML tag — <context>, <examples>, <instructions>, <constraints> and <output_format>.
Use it for claude.ai or the Claude API. The plain-text view pastes straight into a chat; the Markdown view labels what belongs in the system prompt and what in the user message; the JSON view is a Messages API body with a separate system field. Options add Anthropic’s quote-first technique and its “no preamble” line, and the checklist warns about a habit newer models reject.
How to build a Claude prompt
- Pick a template or start blank, and fill in the variables.
- Write the Role and the Instructions; paste material into Documents or context and, if you like, name the document.
- Tick Quote the relevant parts first for long documents and Start with the answer to skip introductions.
- Add examples, rules and the output format.
- Read the checklist, choose a view, then copy, download, share or save.
Claude Prompt Generator features
Consistent XML tags
Every part gets its own descriptive tag, named the same way each time.
Documents first, request last
Long material sits at the top and the instructions after it.
Document source tags
Name the file and the context becomes <document> with <source> and <document_content>.
Prefill, with a warning
Kept out of the chat version and flagged, because Claude 4.6 models and later reject it.
System prompt split for the API
The JSON puts the role in the top-level system field and the rest in the user message.
Anthropic’s advice, applied
- Be clear and direct. Anthropic’s golden rule: if a colleague with little context would be confused by the prompt, Claude will be too.
- Explain why. A reason behind a rule (“this will be read aloud, so…”) lets Claude generalise.
- Use examples. Three to five relevant, varied ones, each in
<example>tags. - Use XML tags. No tag names are special; choose descriptive ones, keep them consistent and nest them for hierarchy.
- Give Claude a role in the system prompt — even one sentence helps.
- Long documents at the top. For inputs of roughly 20,000 tokens or more, Anthropic reports that a query at the end can improve answers by up to 30% in its tests.
- Say what to do, not what to avoid: “write in flowing prose paragraphs” rather than “no Markdown”.
Source: Anthropic’s “Prompting best practices” for current Claude models, platform.claude.com, checked 14 October 2026.
Prefill: what changed
Prefilling meant writing the first words of Claude’s reply — an opening { to force JSON, say — as a final assistant message in an API call. Anthropic’s guide now says that from Claude 4.6 models on, a prefilled last assistant turn is no longer supported and returns a 400 error; earlier models still accept it. It suggests instead a direct instruction such as “Respond directly without preamble”, asking for the answer inside XML tags, or structured outputs for JSON.
So prefill is an older-models option here: it never appears in the plain-text version, the JSON adds it as an assistant message, and the checklist warns whenever it is set. claude.ai has no prefill at all, so use “Start with the answer” there.
Where each part goes
| Order | Tag | Contents |
|---|---|---|
| System prompt | — | Role, plus the no-preamble line if ticked |
| 1 | <documents> or <context> | Long material |
| 2 | <audience> | Who the answer is for |
| 3 | <examples> | Input and output pairs |
| 4 | <instructions> | The request, the quote step, numbered steps |
| 5 | <constraints> | Rules |
| 6 | <output_format> | Format, tone, length, language, JSON schema |
Worked example
The “Executive summary” template with a short operations report, the document name and both options ticked produces:
You are a chief of staff.
Respond directly without preamble. Do not start with phrases like "Here is..." or "Based on...".
<documents>
<document index="1">
<source>q3-operations-report.txt</source>
<document_content>
Q3 revenue was ₹4.2 crore, up 12% on Q2, but late deliveries rose to 9% of orders after the Pune warehouse lost two of its five forklifts in August. Replacing them costs ₹18 lakh; leasing costs ₹1.1 lakh a month. Customer complaints doubled in September.
</document_content>
</document>
</documents>
<instructions>
Write an executive summary of the report for the leadership team.
First, find the quotes from the document that are most relevant to the task and put them in <quotes> tags. Then complete the task using those quotes.
</instructions>
<constraints>
- Start with the single most important conclusion
- Include the numbers that drive the decision
- Finish with the decision or action needed
</constraints>
<output_format>
Respond with a bulleted list.
Length: under 150 words.
</output_format>To shorten a long report before prompting, try the article summarizer.
Claude Prompt Generator FAQ
Does Claude need XML tags?
No, but they help when a prompt mixes instructions, context, examples and input. Anthropic says no tag names are special — descriptive and consistent is what counts.
Where does the role go in claude.ai?
At the top of your message, as in the plain-text view. With the API, put it in the system parameter, as the JSON view does.
Can I still prefill Claude’s answer?
Only through the API and only with models older than Claude 4.6. For current models, use “Start with the answer”, ask for the answer inside XML tags, or use structured outputs.
How many examples should a Claude prompt have?
Anthropic suggests three to five, close to your real task and varied enough that Claude does not copy an accidental pattern.
Why does the Claude prompt generator put documents before the question?
Anthropic’s guide says long inputs work best at the top with the query after them, especially with several documents.
Is this tool made by Anthropic?
No. It is an independent page that follows Anthropic’s published guidance and does not connect to Claude. For a model-neutral layout, try the AI prompt generator.