All posts

How to write better Claude prompts (they aren’t ChatGPT prompts)

August 4, 2026 · 6 min read · By Khalid

TL;DR

  • Modern Claude (4.x and Sonnet 5) takes you literally — it does what you ask, not what you meant.
  • For any prompt longer than a few sentences, wrap the parts in XML tags so Claude knows what’s what.
  • Put role and context before the task; Claude uses them to pick the right approach.
  • Tell Claude why you want something — it responds better to reasoning than to barked orders.

Better Claude prompts come from structure and context, not clever phrasing. Modern Claude models take instructions literally and do exactly what you ask — so the fix is being explicit, organizing the parts of your prompt clearly, and telling Claude the reasoning behind the request. If you’re copying your ChatGPT habits over, a few of them are working against you.

Anthropic has been open about how their newer models behave. Since Claude Sonnet 4.5 through Sonnet 5, the models are instruction-first and literal: they don’t pad, they don’t guess at extra intent, they do the thing. That makes clear structure pay off more than it used to.

1. Use XML tags once the prompt gets long

For any prompt longer than about three sentences, wrapping each part in an XML tag is the highest-leverage move. When your prompt mixes instructions, background, examples, and the actual input, tags remove the ambiguity of where one ends and the next begins.

It looks like this: put your background inside <context>…</context>, the job inside <task>…</task>, and the thing to act on inside <input>…</input>. Claude parses tagged prompts far more consistently than a wall of plain text. You don’t need to tag a one-line question — this is for the meaty prompts where things get muddled.

2. Put role and context before the task

Order matters. Lead with who Claude should be and the background it needs, then give the task, then the output format. Context first lets Claude pick the right framework before it reads what you want — the same way you’d brief a person before handing them the job, not after.

A workable skeleton: role and context first, then the task, then specific instructions, then the output format. You don’t need every slot every time, but that sequence beats dropping the task in cold.

3. Explain why, not just what

Claude leans careful, and it responds well when you explain your reasoning instead of just issuing commands. "Rewrite this to be shorter" is fine. "Rewrite this to be shorter because it’s going in a mobile push notification with a 120-character limit" is better — now Claude optimizes for the real constraint, not a generic idea of "short".

4. Show an example when format matters

A few-shot example — one or two samples of the output you want — is one of the techniques that still clearly helps modern Claude. When you need a specific structure or voice, showing beats describing. Paste a good example and tell Claude to match it.

If you’re used to…For Claude, do this
Barking a blunt one-linerAdd the why — Claude uses the reasoning
A long unstructured paragraphWrap the parts in <context>, <task>, <input> tags
Dropping the request in firstContext and role first, then the task
Assuming it’ll infer your intentBe literal — it does exactly what you write
ChatGPT habit vs. what Claude prefers

The one-line summary

Claude wants to be told clearly, in order, with the reasoning attached. That’s most of the gap between an okay Claude answer and a great one. And whether you’re on Claude, ChatGPT, or Gemini, the underlying discipline is the same — say the outcome, the context, and the format before you send. BeforePrompt flags the missing one right in the Claude prompt box, so you catch it before the reply, not after.

Frequently asked

Do I still need XML tags with newer Claude models?

For short prompts, no — start with plain, explicit instructions. For anything longer than a few sentences that mixes instructions, context, examples, and input, XML tags remain one of the most reliable ways to get consistent output from Claude, because they remove ambiguity about which part is which.

Why does Claude give a different answer than ChatGPT for the same prompt?

They’re tuned differently. Claude is trained for careful, literal, instruction-first behavior and rewards context and reasoning; ChatGPT is more comfortable with blunt, direct commands and few-shot examples. A prompt optimized for one isn’t automatically optimal for the other.

What order should the parts of a Claude prompt go in?

Role and context first, then the task, then specific instructions, then the output format. Putting context before the task lets Claude choose the right approach before it reads the request.

Catch the gap before you send

BeforePrompt flags the missing piece while the prompt is still yours to change.