Anthropic prompt engineering guide: prompts to copy for Claude

Updated on November 9, 2026 · By Editorial team promptdonuts.com

This Anthropic prompt engineering guide boils Anthropic's own advice down to a few habits: say exactly what you want, give the reason, show examples, and separate your instructions from your data with tags. Each habit comes with a prompt you can paste into Claude.

Below you get a prompt that rewrites your prompts, a Claude system prompt template, a few-shot template, a note on the Claude Code system prompt, and how the Anthropic prompt generator and prompt improver fit in.

Start here: a prompt that rewrites your Claude prompt

Anthropic's documentation describes Claude as a brilliant but new employee who lacks context on your norms and workflows. Its test: show your prompt to a colleague with minimal context and ask them to follow it. If they would be confused, Claude will be too. This prompt runs that test for you.

Claude

Prompt reviewer and rewriter

You are reviewing a prompt as if you were a new colleague who knows nothing about my work. Here is my prompt, between the triple quotes: """ [PASTE YOUR PROMPT] """ What I want the result to be used for: [PURPOSE AND AUDIENCE] Do this in order: 1. List every point where you would have to guess: missing context, unclear output format, vague words, steps with no clear order. 2. Ask me up to 3 questions only if the answer changes the prompt a lot. If you ask, stop and wait for my answers before step 3. 3. Write an improved version. State the task, the reason behind it, the output format and the limits. Put pasted material in its own XML tags, such as context and input tags. 4. Show the improved prompt in one block I can copy, then list what you changed in a few bullets.

Change the purpose line to your real use. It breaks when your original prompt is very short: Claude will invent a task, so answer its questions in step 2 rather than skipping them.

The habits Anthropic's guide keeps repeating

The official prompting best practices page is the living reference for current Claude models. These are the parts you will use every day.

  • Be clear and direct. Be specific about the output format and constraints. If you want more than the task strictly requires, ask for it; do not expect Claude to infer it.
  • Give the reason. The guide contrasts "NEVER use ellipses" with a version that explains the text will be read aloud by a text-to-speech engine. Claude can generalize from the explanation.
  • Use examples. A few well-crafted examples improve accuracy and consistency. Make them relevant, diverse and structured, and the guide suggests 3 to 5.
  • Use XML tags. Wrap instructions, context, examples and inputs in their own tags, such as <instructions>, <context> and <input>, so they are not mixed up.
  • Give Claude a role. Even one sentence in the system prompt focuses its behavior and tone.

Anthropic also says to establish success criteria and a way to test against them before you tune a prompt. Not every failure is a prompt problem: sometimes a different model fixes latency or cost more easily.

Write a Claude system prompt that does not drift

A Claude system prompt sets the role and the standing rules for a whole conversation. Anthropic's engineering team says to aim for the "right altitude": enough specificity to guide behavior, not brittle hardcoded logic and not vague guidance that assumes shared context. They suggest starting minimal, testing, and adding instructions only where it fails.

Claude

System prompt template

ROLE You are [ROLE, E.G. A SUPPORT ASSISTANT FOR YOUR COMPANY]. CONTEXT [WHO THE USERS ARE AND WHAT THEY USUALLY NEED] INSTRUCTIONS - Answer in [LANGUAGE] in [LENGTH, E.G. UNDER 120 WORDS]. - [RULE 1] because [REASON]. - [RULE 2] because [REASON]. - If the answer is not in the KNOWLEDGE section, say so and tell the user [NEXT STEP]. Do not guess. KNOWLEDGE [PASTE POLICIES OR FACTS]

Replace every bracket, and keep the reason after each rule. If you build this into an app, you can wrap each section in its own XML tag, such as <role> and </role>, instead of a label. It tends to break when the knowledge block grows long and contradicts a rule, so cut it back to what the assistant needs.

Teach the format with examples

Examples steer format, tone and structure more reliably than a long description. Anthropic's context engineering article advises a small set of diverse, canonical examples instead of a pile of edge cases.

Claude

Few-shot template

I need you to [TASK, E.G. TURN RAW CUSTOMER COMMENTS INTO ONE-LINE SUMMARIES]. Here are three examples. Match their format and tone. EXAMPLE 1 Input: [EXAMPLE INPUT 1] Output: [EXAMPLE OUTPUT 1] EXAMPLE 2 Input: [EXAMPLE INPUT 2, DIFFERENT FROM THE FIRST] Output: [EXAMPLE OUTPUT 2] EXAMPLE 3 Input: [EXAMPLE INPUT 3, AN AWKWARD CASE] Output: [EXAMPLE OUTPUT 3] Now do the same for this input, between the triple quotes: """ [YOUR REAL INPUT] """

Swap in your own task and real samples. Anthropic's guide suggests wrapping each example in <example> tags, and all of them in <examples>, when you build the prompt in code. If every example looks alike, Claude may copy an unintended pattern, so vary length and difficulty. You can also ask Claude to judge your examples for relevance and diversity, or to write more.

The Claude Code system prompt and CLAUDE.md

Claude Code ships with its own system prompt, and you add to it rather than rewrite it. According to the Claude Code docs, the --append-system-prompt flag adds text to the default prompt without removing anything, while --system-prompt replaces it and drops the default tool guidance and safety instructions.

For project rules, the docs point to CLAUDE.md. It is loaded as context, not enforced configuration, and the more specific and concise your instructions, the more consistently Claude follows them. To block an action no matter what, the docs recommend a hook instead.

Claude

CLAUDE.md starter

Read this repository and draft a CLAUDE.md for it. Keep it under [MAX LINES, E.G. 60] lines. Include only what you could not guess from the code: - the commands to build, test and lint, exactly as I run them - conventions that differ from the usual ones for [LANGUAGE OR FRAMEWORK] - folders or files that must not be edited: [PATHS] - one line of reasoning for each rule that is not obvious Write each rule so it can be checked, for example "run [TEST COMMAND] before finishing" rather than "test carefully". Then list the rules that would be better enforced by a hook than by an instruction.

Give it your real commands and protected paths. Check the draft by hand: a generated file can state a command that does not exist.

Claude prompt generator and prompt improver

Anthropic offers two tools, and they do different jobs. The Anthropic prompt generator is for when you have no first draft: the overview page points to a metaprompt recipe in the Claude Cookbook that generates one. The Claude prompt improver works on a draft you already have.

ToolUse it whenWhat it needsWatch for
Prompt generator (metaprompt recipe)You have no first draftA description of the taskTreat the output as a draft and test it
Prompt improver in the ConsoleYou have a prompt that works but not well enoughA prompt template, plus feedback on current outputs and ideal example outputs if you have themPer the docs, results can be longer, more thorough and slower

The docs describe the improver as four steps: example identification, an initial draft, chain-of-thought refinement and updating the examples to match. If you cannot open the Console, the prompt at the top of this page does a lighter version of the same job. For other tools in the same family, see prompts that write better prompts.

Test the prompt before you trust it

A prompt is a draft until it has met several real inputs. Run the same prompt on a handful of cases, including a hard one, and compare against the success criteria you wrote down. For the general basics, see prompt engineering and how to build an AI prompt on this site.

Claude

Prompt test planner

Here is a prompt I use, between the triple quotes: """ [PASTE YOUR PROMPT] """ It should [SUCCESS CRITERIA, E.G. RETURN VALID JSON WITH THREE FIELDS AND NEVER INVENT A PRICE]. Write a test set of [NUMBER, E.G. 8] inputs for it: 3 typical, 3 awkward (missing data, odd wording) and 2 that try to make it break a rule. For each input, state what a correct output must contain, so I can mark pass or fail myself. Do not run the tests.

Adjust the criteria to something you can check. It breaks if the criteria are vague, because then every output looks fine. Remember that Anthropic's page says a technique measured on one model should be re-checked on your own tests before you rely on it with another.

Questions

Is there an official Anthropic prompt engineering guide?

Yes. Anthropic's documentation has a prompt engineering overview and a prompting best practices page, which it calls the living reference for current Claude models.

What is the difference between a Claude prompt and a Claude system prompt?

The prompt is your message in the conversation. The system prompt sets the role and standing rules for the whole conversation, for example a one-sentence role such as a coding assistant specializing in Python.

Can I change the Claude Code system prompt?

You can add to it with the --append-system-prompt flag. Replacing it with --system-prompt removes the default tool guidance and safety instructions, per the Claude Code docs. For project rules, use CLAUDE.md.

Should I use the Claude prompt generator or the improver?

Use the generator when you have no draft, and the improver when you have a draft that needs to be more robust. Both outputs still need testing on your own cases.

Do I need XML tags in every Claude prompt?

No. Anthropic says they help most when a prompt mixes instructions, context, examples and variable inputs. A short, single-purpose request can do without them.

Sources

  1. Prompting best practices – Anthropic
  2. Prompt engineering overview – Anthropic
  3. Console prompting tools – Anthropic
  4. Effective context engineering for AI agents – Anthropic
  5. How Claude remembers your project – Anthropic
  6. CLI reference – Anthropic

MORE GUIDES