How to Write an Effective Claude Prompt: The Practical Guide

XML tags, long documents, examples, projects, and skills: what really changes Claude's answers, and what no longer matters much.

9 min read

Open ancient manuscript covered in handwriting
Photo: Fanny (Appleton) Longfellow (1817-1861) · Public domain

A lot of Claude advice revolves around one trick: put everything in XML tags, because it was trained for that. That's not accurate. Anthropic's documentation states that there are no canonical tags Claude was specially trained on, and one of its recent guides explains that clear headings and explicit sentences are enough in most cases.

Tags do have their uses, and we'll get to them. But if your prompt gives poor results, the cause is rarely its formatting. It's what you forgot to say.

The test of the colleague who starts this morning

Anthropic offers a useful image: treat Claude as a brilliant but new employee who knows neither your habits nor your field. And a simple test: show your prompt to a colleague who knows nothing about the subject. If they don't know what to do, neither does Claude.

Take a nonprofit director who writes: "Summarize this grant application." A colleague would immediately ask for whom, for what purpose, and how long. Claude will guess, and it'll return a neutral summary that's useful to no one in particular.

The corrected version takes a few lines:

Prompt
You're going to read the attached grant application. It will be presented on Tuesday to our board of directors, made up of volunteers who haven't read the application and have five minutes to decide whether we submit it.

Write a half-page note that lets them make the call:
- what the grant would fund and the amount
- what the organization commits to do in return
- the conditions that will be hard for us to meet
- the documents we're missing, if any

Write in short sentences, without administrative jargon. If a piece of information doesn't appear in the application, say so instead of assuming it.

The board note, the reading time, and the decision to be made give Claude everything that was missing. It can now sort the application by what matters to those particular readers.

Claude also tends to stick to what you ask. Anthropic is clear on this: if you want it to go beyond the bare minimum, ask for it explicitly. If you want three alternative approaches or a critique of your plan, write that down. Don't count on it to do so on its own.

Explain why you're asking for something

This is one of the most profitable habits with Claude. An instruction on its own gets applied to the letter. An instruction with its reason gets applied with judgment, including to cases you hadn't anticipated.

Without a reason: "No ellipses."

With a reason, modeled on Anthropic's example: "This text will be read aloud by a text-to-speech engine, which can't pronounce ellipses."

In the second case, Claude understands the real need and can also avoid abbreviations, symbols, or parentheses that get misread, none of which you mentioned.

An example from another line of work. A fifth-grade teacher asks for a reading passage. The instruction "short sentences" produces choppy sentences. If she writes "two students in my class are dyslexic and get discouraged by sentences with several clauses," Claude has what it needs to adjust the syntax without breaking the rhythm of the story.

Also phrase your instructions positively when you can. Anthropic recommends describing what you want rather than what you don't: "Write in flowing paragraphs" gives a target, whereas "no lists" only removes one. When you need a prohibition, keep it, but follow it with what to do instead.

When XML tags help, and when to skip them

An XML tag is a label around a chunk of text: <notes> at the start, </notes> at the end. You pick whatever names you want, in whichever language feels natural. Tags serve one purpose: to unambiguously separate your instructions from the content to be processed.

For a simple question, don't use any. For a short text to rephrase, a heading or a line break is enough. They become useful when your prompt mixes several types of content, especially when the documents to process themselves contain text that looks like an instruction. That's the case with a customer email that says "please reply before Friday": you don't want Claude to take that sentence for an instruction addressed to it.

Here's a case where they're justified, for a condo board member who needs to compare quotes:

Prompt
<context>
I'm on the board of a 24-unit condo association. We need to redo the waterproofing on the flat roof. The vote will take place at the next general meeting, and the owners will want to understand the price differences.
</context>

<quotes>
<quote_1 company="[NAME 1]">
[PASTE THE QUOTE]
</quote_1>
<quote_2 company="[NAME 2]">
[PASTE THE QUOTE]
</quote_2>
<quote_3 company="[NAME 3]">
[PASTE THE QUOTE]
</quote_3>
</quotes>

<instructions>
1. Make a table comparing what each quote actually includes: services, materials, warranties, timelines, payment terms.
2. Flag anything that appears in one quote and is missing from the others, without concluding that it's an oversight.
3. List the questions to ask each company before the vote.
Don't recommend a company. If an item isn't specified in a quote, write "not specified."
</instructions>

The data comes before the instructions, and the reason is in the next section.

With long documents, put the request at the end

For long content, Anthropic's documentation recommends placing the documents at the top of the prompt and the question at the bottom, and tagging each document when there are several, along with its source. A more general guide adds to keep the most important information at the beginning or the end, and to break big tasks apart: the model works better on a clear scope.

Don't ask for everything at once, either. For a 60-page report, start by having it extract the passages that relate to your question, with their page or section, then have Claude reason over those extracts. You'll be able to check the first step, which is impossible when everything arrives blended into a summary. The article on long documents covers this two-stage approach in detail.

Claude can also get a document you gave it wrong: misattribute a figure, read a table from a PDF too quickly. For anything involving money or a decision, ask for the exact quote of the passage that supports each claim and check it against the original. This habit applies to every assistant, this one included, and it's explained in the guide on checking an AI answer.

Show an example before adding rules

Anthropic ranks examples among the most reliable ways to steer format, tone, and structure. One of its guides advises starting with a single example and adding more if results remain inconsistent, while its technical documentation cites three to five examples for demanding uses. Take away this: start small and scale up if needed.

Choose your examples carefully, because Claude pays close attention to them and may reproduce even their flaws. If your example contains an empty phrase, you'll find it everywhere. Vary them too: with three examples that all start the same way, you'll get that same opening on every text.

For a developer who wants consistent code review feedback, the prompt therefore combines format, example, and reason:

Prompt
Review the diff below. I'm the only person on this project and I'll fix your comments myself tonight, so I only want what could break in production, not matters of taste.

<diff>
[PASTE THE DIFF]
</diff>

For each problem, use this format:

<example>
**File:** cart.py, line 42
**Risk:** if the cart is empty, `total_price` is not defined and the page crashes.
**Scenario:** a customer removes their last item, then reloads the page.
**Suggested fix:** initialize `total_price = 0` before the loop.
</example>

Rank the problems from most to least serious. If you don't find any serious ones, say so and stop there: don't invent comments to fill space. Flag what you couldn't assess without seeing the rest of the code.

The phrase "say so and stop there" matters. Without that exit, any assistant asked to find problems tends to find some.

On roles, Anthropic's advice is measured: a sentence can be enough to steer the tone, but a heavy role rarely adds anything and can limit how useful the answer is. It's often more effective to specify the expected point of view directly. "Analyze this budget from the perspective of a cautious manager who refuses any overdraft" beats three lines about her years of experience.

File your instructions in the right place in Claude

Menus and names change and depend on your plan, so check in the tool as you read this. Here's the general logic.

NeedFeatureGood use
Preferences that apply everywhereProfile instructions, in settingsYour language, your job, your response style. Keep it brief
A topic followed over timeProject, with its knowledge and instructionsA document base, a client, a school year
A repeated procedureSkillA monthly report or a review with a specific method. It only loads when it's useful
A deliverable to keep and editArtifactA document or small interactive tool, to pick back up and share
A question that requires a lot of readingResearchCited report. Allow several minutes
Your own toolsConnectorsLet Claude look at your emails, calendar, or files if you connect them

For skills, polish the description above everything else: according to Anthropic's documentation, Claude reads only the name and description before deciding whether to load the skill. "Help with quotes" will trigger poorly. "Use when I ask to prepare or review a plumbing quote" will trigger much better.

The same scope principle applies to your instructions. The profile gets what's true all the time, a project gets what concerns one file, a skill gets what describes a procedure. Put everything in the profile and your everyday conversations will carry unnecessary weight. The article on system instructions helps you sort it out.

Memory fills up as you use it, and you can view and edit it. An incognito conversation isn't used to improve Claude, even if that setting is turned on in your privacy settings: look at those options before pasting anything sensitive, and check the terms of your plan.

Claude doesn't produce photos or illustrations the way image generators do, either. It can create diagrams, charts, and interactive visuals, and it can analyze images you send it. If your need is about images, the ChatGPT, Claude, or Gemini comparison will point you in the right direction.

Have it review your prompt, not just your text

Before running an important prompt, ask Claude to put itself in the shoes of whoever executes it. It often saves several attempts:

Prompt
Here is a prompt I'm going to use regularly:

<prompt_to_review>
[PASTE YOUR PROMPT]
</prompt_to_review>

Don't run it. Tell me:
1. What you would have misunderstood or had to assume
2. What information is missing to do the job well
3. The real-world case where this prompt would give the worst result
Then suggest a corrected version, flagging each change and its reason.

Anthropic also offers tools like this in its developer console, but this prompt works in the regular app. Still, read its suggestions with a critical eye: a longer prompt isn't necessarily better, and you know your job better than it does.

Try it right now on the prompt you use most. Add one sentence explaining what the result is for and who will read it, then compare it with your usual version.

By tool

How to Write an Effective Gemini Prompt: Guide and Examples

Persona, task, context, format, Gmail and Drive, Deep Research: how to talk to Gemini and make the most of Google without giving it free rein.

8 min read

By tool

Generating images in ChatGPT: what changes in the prompt

In ChatGPT, you ask for an image in conversation and correct it one sentence at a time. How to describe the scene, add text, and iterate without starting over.

3 min read

By tool

Running an AI model on your own computer

What a locally installed AI model makes possible: privacy, the hardware you need, tools to get started, and how to adapt your prompts to a small model.

6 min read