Skip to main content

Prompting Claude Specifically

Intermediate

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.

What you'll learn
  • 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:

Guided walkthrough1 of 4
  1. 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.
Pro tip
  • 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.

Watch out
  • 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.

Guided walkthrough1 of 3
  1. Wrap inputs, instructions, and examples in named tags. Claude's tag affinity makes this the most reliable structuring habit in long prompts.
Claude-specific quick reference
Press Enter or Space to flip the card. Use the left and right arrow keys to move between cards.Term shown.
1 / 6
Key takeaways
  • 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/3
  1. Which technique is described as the highest-value Claude structuring habit?
  2. You send a request whose last message is an assistant turn containing an opening brace, to force JSON. What happens on Claude 4.6 or later?
  3. What should you do with ALL-CAPS and "YOU MUST… OR ELSE" prompts on current Claude models?

Next​