Prompting Claude
Anthropic's advice for prompting Claude is to be clear and direct, explain why, give three to five examples, separate parts of a prompt with XML tags, set a role, and put long documents before the question.
Anthropic's own prompting guide for Claude comes down to a few habits: be clear and direct, say why you want something, show 3 to 5 examples, wrap the parts of a long prompt in XML tags, give Claude a role, and place long documents above the question, which Anthropic says can improve answers by up to 30 percent on complex, multi-document inputs. The guide, "Prompting best practices" on the Claude Platform docs, covers every current model from Claude Haiku 5.5 to Claude Fable 5.1, and Anthropic calls it the living reference. Most of it applies equally to chat in the apps, to Claude Code and to the Claude API.
Quick facts
| Official guide | Prompting best practices, Claude Platform docs (read Nov 6, 2026) |
| Before you start | Success criteria, a way to test against them, a first draft |
| Examples to include | 3 to 5 |
| Long-context gain from asking last | Up to 30 percent in Anthropic's tests |
| Prefill | Not supported from Claude 4.6 models on (a 400 error) |
| Prompt generator and improver | Retired with the Workbench on Aug 17, 2026 |
| Free tutorial | Interactive tutorial on GitHub, written for Claude 3 |
Before you write a prompt
Anthropic's overview asks for three things first: a clear definition of success, a way to test against it, and a first draft to improve (Prompt engineering overview). It also says plainly that not every problem is a prompting problem: latency and cost are often fixed faster by choosing a different model. For a one-off chat this is overkill; for a prompt that will run a thousand times in an app, it is the difference between guessing and knowing.
Be clear and direct
The guide's central image is Claude as a brilliant new employee who knows nothing about your norms. Its test: show the prompt to a colleague with little context, and if they would be confused, so will Claude. In practice:
- Say exactly what output you want: length, format, audience, what to leave out.
- When order matters, give numbered steps.
- If you want more than the bare task, ask for it. Anthropic's example turns "Create an analytics dashboard" into a request to include as many relevant features and interactions as possible.
Explain why
Context behind an instruction lets Claude generalize. Anthropic contrasts "NEVER use ellipses" with an explanation that the text will be read aloud by a speech engine that cannot pronounce them; with the reason, Claude also avoids other things a speech engine would stumble on.
Show examples
A few examples ("few-shot" or "multishot" prompting) are, in Anthropic's words, one of the most reliable ways to steer format, tone and structure. Make them relevant to the real task, varied enough to cover edge cases, and wrap them in <example> tags (several inside <examples>) so Claude does not mistake them for instructions. You can ask Claude itself to check your examples for variety or to write more.
Structure with XML tags
When a prompt mixes instructions, background, examples and input, wrap each in its own tag: <instructions>, <context>, <input>. There are no magic tag names; the guide asks only that they be descriptive and consistent, and nested where the content is nested.
<documents>
<document index="1">
<source>annual_report.pdf</source>
<document_content>...</document_content>
</document>
</documents>
<instructions>
Summarize the risks named in the report for a board member.
</instructions>
Give Claude a role
A single sentence in the system prompt (Anthropic's example: "You are a helpful coding assistant specializing in Python.") focuses tone and judgment. In the apps, the same effect comes from project instructions or Settings > Your Claude > Instructions, which apply to every chat (Styles and Personalization).
Long documents
For inputs of 20,000 tokens or more, put the documents at the top and the question at the end, wrap each document with its source in tags, and for long material ask Claude to quote the relevant passages first and answer from them. Current models read up to a million tokens (Claude Context Window), but the order still matters.
Format and length
Tell Claude what to do rather than what not to do: "write in flowing prose paragraphs" works better than "no Markdown". Current models are terser than older ones and may skip a summary after using tools; ask for one if you want it. Claude Opus 5 is the exception the guide names, with longer default answers that effort settings do not reliably shorten.
Thinking and effort
On the newest models thinking is adaptive: Claude decides how much to reason, and on Fable 5.1 and Opus 5.5 it is always on. The control is the effort setting (low to max), not phrases like "think hard"; Anthropic's Claude Code guidance lists "think hard" and ALL CAPS emphasis among things you can stop writing. If a model explores too much, Anthropic suggests telling it to choose an approach and commit, or lowering effort. See Extended and Adaptive Thinking.
Agents and tools
For agentic work the guide adds: ask Claude to check before hard-to-reverse actions such as deleting files or force-pushing; ask it to clean up temporary files; tell it to keep solutions minimal if it overbuilds; and warn it not to tune code just to pass tests. For a pipeline you want to inspect, chain prompts: draft, review against criteria, revise, each a separate call. Tool Use and Claude Code Subagents cover the mechanics.
Prefill is gone
Developers used to start Claude's reply for it (a "prefill") to force JSON or skip a preamble. From the Claude 4.6 models on, a prefilled final assistant turn returns a 400 error (Prompting best practices). Use Structured Outputs for formats, or simply ask.
Tools for writing prompts
The Console's prompt generator and prompt improver, and their experimental APIs, were retired with the Workbench on Aug 17, 2026; the Workbench became the "playground" in the Claude Console. What remains: the metaprompt notebook in Anthropic's cookbook for a first draft, the interactive tutorial (written for Claude 3, so the guide wins where they differ), a per-model page for each current model, and in Claude Code the /claude-api prompt-audit skill (Extend Claude with skills).
Frequently asked questions
Does Claude prefer XML tags? Claude parses XML tags well, and Anthropic recommends them for prompts that mix instructions, context and examples, but any consistent, descriptive tag names work.
How many examples should I give Claude? Anthropic recommends 3 to 5 relevant, varied examples wrapped in <example> tags for the best results with Claude (Prompting best practices).
Do I still need to tell Claude to "think step by step"? Usually not. Current Claude models decide how much to think, and the effort setting is the control; Anthropic says phrases like "think hard" can be dropped.
Where is the Claude prompt improver? Anthropic retired the Console's prompt generator and prompt improver along with the Workbench on Aug 17, 2026; the playground replaced the Workbench (Release notes).
Should the question go before or after a long document? After. Anthropic says putting long documents first and the query at the end can improve Claude's answers by up to 30 percent on complex inputs.
Can I still prefill Claude's response? Not on Claude 4.6 and later models, which reject a prefilled final assistant turn with a 400 error; use structured outputs or instructions instead.
Sources
- Prompting 101 | Code w/ Claude, Anthropic, Jul 31, 2025 (video)
- Prompting best practices, Claude Platform docs, read Nov 6, 2026
- Prompt engineering overview, Claude Platform docs, read Nov 6, 2026
- Release notes, Claude Platform docs, read Nov 6, 2026
- Best practices for Claude Code, Anthropic, read Nov 6, 2026
- Extend Claude with skills, Anthropic, read Nov 6, 2026
- Prompt engineering interactive tutorial, Anthropic on GitHub, read Nov 6, 2026
Moments
Prompting 101 | Code w/ Claude
Anthropic
- Anthropic's own prompting guide for Claude comes down to a few habits: be clear and direct, say why you want…
- Anthropic's overview asks for three things first: a clear definition of success, a way to test against it, and a first…
- The guide's central image is Claude as a brilliant new employee who knows nothing about your norms. Its test: show the…
- A few examples ("few-shot" or "multishot" prompting) are, in Anthropic's words, one of the most reliable ways to steer…
- When a prompt mixes instructions, background, examples and input, wrap each in its own tag: <instructions>, <context>…
- A single sentence in the system prompt (Anthropic's example: "You are a helpful coding assistant specializing in…
- Developers used to start Claude's reply for it (a "prefill") to force JSON or skip a preamble. From the Claude 4.6…
See also
-
ClaudeClaude is the AI assistant and family of AI models made by Anthropic, used in the claude.ai web, desktop and mobile apps, in Claude Code for programming, and through the Claude API; it is free to start, with paid plans from $20 a month. -
Claude Haiku 5.5Claude Haiku 5.5 is Anthropic's fastest and cheapest current model, released on Oct 7, 2026 at $0.10 input and $0.50 output per million tokens for prompts up to 100,000 tokens. It suits classification, extraction, routing and subagents, and is on every Claude plan including Free. -
Claude Fable 5.1Claude Fable 5.1 is Anthropic's most capable widely released model, released on Sep 1, 2026 and priced at $10 input and $50 output per million tokens on the Claude API. It is included on Claude Max, Ultra, Team premium seats and Enterprise, and paid with usage credits on Pro.
-
Claude CodeClaude Code is Anthropic's agentic coding tool. It reads a codebase, edits files, runs commands and opens pull requests from the terminal, VS Code, JetBrains IDEs, the Claude desktop app, the browser and Slack, and it comes with every paid Claude plan or a pay-as-you-go Console account. -
Claude APIThe Claude API is Anthropic's REST API at api.anthropic.com for building with Claude models: create an API key in the Claude Console at platform.claude.com, then send requests to the Messages API, paying per token.
-
ProjectsClaude Projects are workspaces in the Claude app with their own chats, uploaded knowledge files, instructions and memory. Free accounts can make up to five; paid plans have no cap, and Team and Enterprise can share them.