Anthropic prompt engineering guide: prompts to copy for Claude
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.
Prompt reviewer and rewriter
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.
System prompt template
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.
Few-shot template
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.md starter
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.
| Tool | Use it when | What it needs | Watch for |
|---|---|---|---|
| Prompt generator (metaprompt recipe) | You have no first draft | A description of the task | Treat the output as a draft and test it |
| Prompt improver in the Console | You have a prompt that works but not well enough | A prompt template, plus feedback on current outputs and ideal example outputs if you have them | Per 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.
Prompt test planner
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
- Prompting best practices – Anthropic
- Prompt engineering overview – Anthropic
- Console prompting tools – Anthropic
- Effective context engineering for AI agents – Anthropic
- How Claude remembers your project – Anthropic
- CLI reference – Anthropic
