Blog › Guide

Claude Prompts: How to Write Them, with a Template

GuideNov 28, 2026SharPrompt Editorial
Claude Prompts: How to Write Them, with a Template

How to write Claude prompts that work: Anthropic's official principles, XML tags, long-document order, a before/after example and a template to copy.

The key to writing good Claude prompts is simple: treat Claude as a brilliant new hire who knows nothing about your company, and tell it everything it needs. Anthropic's official prompting guide opens with the same analogy. Add the reason behind each instruction, examples, XML tags to separate sections, and a clear role, and the same question returns a far more useful answer. This post turns the official guide's principles into a working method and gives you a template you can copy right away.

Why Claude gives off-target answers

Send only "Analyze our competitors" and Claude does not know which competitors, who the analysis is for, or how deep to go. So it gives you an average answer. The official guide says to think of Claude as a brilliant new employee who lacks context on your norms and workflows. The more precisely you explain what you want, the better the result.

The guide's check is just as simple: show your prompt to a colleague who knows little about the task and ask them to follow it. If they would be confused, Claude will be too. And if you want more than the task strictly requires, ask for it explicitly instead of hoping Claude will guess.

Five principles from Anthropic's official guide

Group the guide's general principles into five boxes for everyday work, and you get this.

General principles in the official guide Be clear Format, limits Explain why Why it matters Give examples Show a sample XML tags Split task, data Assign a role Viewpoint, tone Order to follow with long material ① Material (docs, data) Put it at the top ② Quote key parts Pull them out first ③ Task and question Put them at the bottom
Figure 1. The five principles decide what to say; the order decides where to put it
  1. Be clear. Spell out the output format and constraints you want, and when order matters, give the steps as a numbered list.
  2. Explain why. The guide explains that "Don't use ellipses" works less well than "Don't use ellipses, because this text will be read by a text-to-speech engine that can't pronounce them." Claude generalizes rules from the explanation.
  3. Give examples. Examples are one of the most reliable ways to steer format, tone and structure. The best ones resemble the real task, vary from one another, and sit inside <example> tags.
  4. Separate sections with XML tags. When instructions, context, examples and input material are mixed, wrapping each in its own tag leaves less room for misreading.
  5. Assign a role. The official guide says that even a single sentence setting a role in the system prompt changes Claude's behavior and tone.

XML tags and long material

XML tags are the most distinctly "Claude" habit in prompt writing. There are no required tag names; just use names that are consistent and self-explanatory. With several documents, nest them: one <document> per file inside a <documents> tag.

TagWhat goes in itEffect
<context>Background, reader, purposeTells Claude why the work matters
<instructions>The task and its stepsInstructions don't get buried in material
<example>A sample of the result you wantLocks in format and tone
<document>Pasted source text and its sourceMaterial isn't confused with instructions

When the material is long (about 20,000 tokens or more, by the guide's measure), placement matters. The official guide recommends putting long documents at the top of the prompt, with the question and instructions below. It also explains that asking Claude to quote the relevant parts first, before the main task, helps it focus on what matters and filter out the rest.

Say what to do, not what not to doFor formatting, too, the official guide says to describe what you want rather than what you forbid. "Write in smoothly flowing prose paragraphs" works better than "Don't use markdown." Also keep in mind that the style of your prompt influences the style of the answer.

BEFORE / AFTER: same request, different prompt

BEFORE
Summarize these customer interviews.
AFTER
<interviews> [Paste interview transcripts] </interviews> <context> You are a product manager for a B2B service. I will use this summary to set improvement priorities at next week's team meeting. </context> <instructions> 1. First, quote verbatim every sentence related to a complaint. 2. Group the quotes by theme and pick the top 3 problems. 3. For each problem, add one supporting quote and one question to verify. Do not invent anything that is not in the transcripts; mark it [needs checking]. </instructions> Format: one-sentence conclusion on the first line, then a table (Problem / Supporting quote / Question to verify)

The AFTER version follows the official guide's principles directly. It puts the material on top, states the role and purpose, asks for quotes first, and separates sections with tags. It looks long, but most of it is filling in blanks, so it takes a few minutes.

A Claude prompt template you can copy

<documents> [Paste reference material; delete this section if there is none] </documents> <context> Role: You are a [job title, with the criteria you judge by]. Background: [2~3 lines on the situation] Purpose: [Who] will read this to decide [what]. </context> <instructions> 1. [First step; if there is material, start by quoting the relevant parts] 2. [Second step] 3. [Third step] A good answer: [2~3 criteria] Mark any fact or number not in the material as [needs checking]. </instructions> <example> [A short sample of the result you want, if you have one] </example> Format: [table / five-line summary / one-page report]; first line is the conclusion

Before you send it, run the colleague check mentioned above. If someone unfamiliar with the task could read it and know what to deliver and in what shape, it is good enough. If the result falls short, another method the guide describes is to have Claude review its first draft against your criteria, then revise based on that review.

If filling in the boxes every time is a chore

SharPrompt takes a question written the way it came to mind and rewrites it as a brief with role, purpose, deliverable, constraints and evaluation criteria. It never invents missing facts; it leaves them as [brackets] and shows a "What changed" list explaining each edit and why. Paste the rewritten prompt into Claude and add the tag structure from the template above.

Turn a rough request into a strategist's brief

SharPrompt rewrites quick questions into structured prompts and builds conclusion-first slide decks.

Talk to us about your team

For team or company rollout, training or custom templates, email us at the address below.

Get new posts by email

We'll email you when a new guide, template or worked example goes up. Unsubscribe any time with one click at the bottom of any email.

#claude prompts#how to write claude prompts#claude prompt template#claude xml tags#anthropic prompting best practices