Prompting Claude Specifically
Most of prompting is universal. But a few techniques are especially effective with Claude — and several habits from older models are now counterproductive or outright rejected by the API. This lesson separates the signal from the noise: what's actually Claude-specific, as of today.
- Recognize the Claude-specific techniques worth leaning into — XML tags, clarity, roles, thinking, and examples
- Unlearn the old-model habits (ALL-CAPS, threats, over-engineered scaffolding) that now backfire
- Know that prefilling the final assistant turn is retired on Claude 4.6+ — and what replaced it
- Understand what to re-check when you switch models
Lean into these with Claude
These are the moves that pay off the most with Claude. The first one is the single highest-value habit you can build.
- XML tags. Claude is well-tuned to structured prompts with named tags for inputs, instructions, and examples. Current models read clean headings and whitespace well too, so tags are no longer mandatory — but they remain the most reliable way to keep a long prompt's sections from bleeding into each other.
- Be clear and direct. State the goal, constraints, and what "done" looks like. Claude follows explicit instructions closely.
- Give it a role in the system prompt — one sentence is enough to shift tone and focus.
- Let it think on hard problems — ask for step-by-step reasoning, or use extended thinking/effort on reasoning models (where you often don't need to ask for CoT explicitly).
- Use examples (few-shot) for format and edge cases. Claude reads examples closely, so one good example beats five sloppy ones.
- Give it permission to be unsure. An explicit "say so instead of guessing" line is one of the cheapest reliability wins available.
Lock the output format without prefilling
Prefilling — seeding the start of Claude's reply so it continues in your format — was for years the Claude-specific format lever. It is retired: on Claude 4.6 and later models, a request whose final message is a prefilled assistant turn returns a 400 error. Anthropic's stated reason is that instruction-following advanced far enough that most prefill use cases no longer need it. Earlier models still accept prefills, and assistant messages elsewhere in the conversation — few-shot examples, prior turns — are unaffected.
Here is the migration, one old use at a time:
- Use structured outputs (/docs/api/structured-output), which constrain the response to a schema, or just describe the shape — current models match complex schemas reliably when told to. For classification, a tool with an enum field is the sturdiest option.
- Put a direct instruction in the system prompt: respond directly, no preamble, don't open with "Here is" or "Based on". Alternatively have the model write inside a named tag and read only that.
- Clear prompting in the user turn is now enough; refusal calibration improved substantially. If it still refuses, the ask itself probably needs rewording (/docs/api/refusals-and-safety).
- Move the continuation into a user turn that quotes the tail of the interrupted text and asks Claude to carry on from there — or simply retry the request if no one is watching the latency.
- Quick test for whether you still depend on prefill: search your codebase for a `messages` array whose last element has role `assistant`. On Claude 4.6+ every one of those is a 400 waiting to happen.
Drop these old habits
Newer, literal-following Claude models change the rules. Tricks that helped on older models now get in the way.
- Ease off ALL-CAPS and threat-style prompts ("YOU MUST… OR ELSE"). Current models are more responsive to the system prompt than the ones that style was invented for, so hardened language now causes over-eager tool calls rather than compliance.
- Don't over-engineer with elaborate "jailbreak-style" scaffolding — clear, honest instructions outperform tricks.
- Don't stack every technique at once. Role plus XML plus few-shot plus chain-of-thought plus a schema, all added blind, is the most common form of prompt over-engineering. Add one, measure, keep what helped.
- Less is often more — a tight prompt beats a sprawling one that buries the ask.
Claude vs other models
The principles transfer (see Cross-AI Prompt Translation), but a few things are worth remembering as Claude-specific.
- Wrap inputs, instructions, and examples in named tags. Claude's tag affinity makes this the most reliable structuring habit in long prompts.
- Anthropic's `system` is a top-level request parameter, not an entry in `messages` — see /docs/prompting/system-prompts. It is also the best-cached part of the request.
- When you move off Claude, re-check tone intensity and formatting cues; what's literal here may not transfer cleanly.
- XML tags remain the highest-value Claude structuring habit, though current models no longer require them for short prompts.
- Prefilling the final assistant turn is retired — a 400 on Claude 4.6+. Migrate to structured outputs, an output contract, or tools.
- Current Claude models follow instructions literally and weight the system prompt heavily — be clear and direct, not loud.
- Less is more: a tight, honest prompt beats elaborate scaffolding, and beats stacking every technique at once.
- Principles transfer across models, but re-check tone intensity and formatting cues when you switch.
Check yourself
0/3Next
- System Prompts
- Structuring Prompts with XML Tags
- Cross-AI Prompt Translation
- Named Techniques, Judged — a verdict on every famous prompting technique