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:

  1. Say exactly what output you want: length, format, audience, what to leave out.
  2. When order matters, give numbered steps.
  3. 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

Moments

Prompting 101 | Code w/ Claude

Anthropic

  1. Anthropic's own prompting guide for Claude comes down to a few habits: be clear and direct, say why you want…
  2. Anthropic's overview asks for three things first: a clear definition of success, a way to test against it, and a first…
  3. The guide's central image is Claude as a brilliant new employee who knows nothing about your norms. Its test: show the…
  4. A few examples ("few-shot" or "multishot" prompting) are, in Anthropic's words, one of the most reliable ways to steer…
  5. When a prompt mixes instructions, background, examples and input, wrap each in its own tag: <instructions>, <context>…
  6. A single sentence in the system prompt (Anthropic's example: "You are a helpful coding assistant specializing in…
  7. 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

About this page

Last updated Nov 6, 2026 by the Vi.ki team. Page text CC BY-SA 4.0.

Edit History

Hotkeys

/
Jump to the search box
? or Ctrl + /
Open this list
Esc
Close this list, the photo viewer, or the account menu

Video

Space or K
Play or pause
← →
Back or forward 5 seconds
J L
Back or forward 10 seconds
0 to 9
Go to 0% to 90% of the video
, .
Previous or next frame, while paused
M
Mute or unmute
C
Captions on or off
F
Full screen on or off
A D
Previous or next moment

Photo viewer

← → or A D
Previous or next photo
↑ ↓ or W S
Previous or next photo
Home End
First or last photo
I
Show or hide the photo's info
Z
Clickless on or off: a pointer over a thumbnail shows it
N
Compare with the last photo: back to the one shown before this, and N again comes back
Q
Move the thumbnails to the next edge: top, bottom, left and round
, or Ctrl + ,
Open or close the viewer's settings
V
Clickless pan: a zoomed photo follows the pointer, rather than being dragged
Shift
Browse on or off
B
Show or hide the button bar
T
Show or hide the thumbnails
1
100% zoom on or off
0
Rate the photo as no opinion; again takes the answer back
+ -
Rate the photo a step higher or lower
F
Full screen: the photo alone. F again puts everything back.
Back to top