ANAlpesh Nakrani
SolutionsBlogBooksPraiseAboutWork with me
Back to the blog
Blog/Aug 26, 2026 · 11 min

Claude Prompt Engineering: Three Real Differences

Claude prompt engineering differs from generic LLM prompting in three ways: literal instructions, XML structure, and context over clever wording.

Claude prompt engineering is not the same discipline as prompting a generic LLM. Claude 4.x models, Sonnet 5 included, follow instructions literally instead of guessing at what you meant. They respond measurably better to XML-structured prompts than to the same content run together in prose. And past a single well-worded ask, the real lever for agentic Claude work is context engineering: curating what stays in the window, not only how you phrase the request.

I have watched a team paste last year's Claude prompt into Sonnet 5 and get a flatter answer than the one they remembered. Nothing broke. The model did exactly what the prompt said, and the prompt said less than the team thought it did. That gap between what you wrote and what you meant is where most Claude prompting time goes now.

This is the field manual for that gap: what to change in your system prompt, when XML earns its token cost, how extended thinking and long-context grounding work, and where prompting stops and context engineering starts.

Key takeaways

  • Claude 4.x models, Sonnet 5 included, follow instructions literally and stop inferring unstated intent, so a vague ask now produces a flatter answer, not a smarter one.
  • XML tags measurably improve how Claude parses multi-part prompts, at the cost of extra tokens, so use them for real structure, not a one-line question.
  • For documents over roughly 20K tokens, Anthropic's own guidance is to place the document above the question and have Claude quote its evidence before it answers.
  • Prompt caching cuts cost up to 90% and latency up to 85% on long, repeated prompts, by billing the reused prefix at a fraction of full price.
  • Past one well-structured prompt, the lever is context engineering: curating the system prompt, tools, history, and retrieved data across many turns, not wording one instruction well.

What makes Claude prompt engineering different from generic LLM prompting

Three things separate prompting Claude from prompting an LLM in general. First, instruction literalism: Claude 4.x models were trained to do what you actually asked rather than infer the more polished version of the ask, a shift I cover in detail below. Second, structure: Claude responds measurably better to prompts that separate instructions, context, and examples with XML tags than to the same content run together as prose. Third, scope: single-turn prompt wording is a small part of what determines quality once Claude is running as an agent across many turns. At that point you are managing a token budget, not polishing a line. I cover that boundary on its own in context engineering vs. prompt engineering.

None of the technique-level advice here is unique to Claude. Few-shot examples, decomposition, and self-consistency work across providers, and I keep that model-agnostic list separate in prompt engineering techniques. What is Claude-specific is how the model responds to each one, and that response is what this piece covers.

Write the system prompt like an onboarding doc, not a persona

Most system prompts still read like a persona sheet: "You are a friendly, expert assistant who always thinks carefully." Claude does not need to be told it is friendly. It needs to know what the job is, what the constraints are, and what good output looks like, the way you would write an onboarding doc for a new hire who has one day to learn the role and no one to ask follow-up questions.

Picture two system prompts for the same support bot, offered here as an illustration of the pattern, not a specific client's text. The persona version says: "You are a helpful, empathetic support agent for the company." The onboarding version says: "You handle billing and account-access tickets only. Escalate anything about refunds over $500 or legal threats. Never promise a refund amount before checking <account_status>. Close every reply with the next concrete step the customer should take." The first tells Claude who to be. The second tells Claude what to do, what to avoid, and how to know the reply is done. On Claude 4.x, the second version is the one that changes behavior.

Claude does not need a persona. It needs a job description it can execute without asking a follow-up question.

Use XML tags to structure instructions, context, and output

Claude was trained on a large volume of XML-tagged text, and Anthropic's own documentation recommends XML tags specifically to separate instructions, context, and examples so the model does not blend them (Anthropic, "Use XML tags to structure your prompts"). Tags do not need a fixed vocabulary. <context>, <instructions>, and <output_format> work because they say what they mean, not because Claude was trained on those three exact names.

# minimal XML-structured prompt skeleton
<context>
{retrieved_docs}
</context>
<instructions>
Answer using only the context above.
Quote the source line before each claim.
</instructions>
<output_format>
Markdown, under 150 words, no preamble.
</output_format>

Structure has a cost. Every tag is tokens you pay for on every call, and a two-line request wrapped in five tag pairs is waste, not rigor. Save XML for prompts with real parts to separate: multiple documents, a mix of instructions and examples, or an output format a downstream system has to parse. If you are wiring prompts like this into a production Claude workflow rather than a notebook, that structuring and instrumentation work is exactly what ViitorCloud's technology consulting team builds for clients moving from a working demo to a system that holds under real traffic.

Give Claude room to reason: extended thinking and chain-of-thought

Extended thinking gives Claude a separate space to reason before it answers, and on harder tasks, ambiguous specs, multi-step logic, judgment calls, it measurably improves output quality. The trade-off is latency and tokens: thinking tokens are billed, and a simple lookup does not need a reasoning pass. Turn it on for the tasks where being right matters more than being fast, and leave it off for the ones that do not need it.

Even without the dedicated extended thinking mode, asking Claude to work through a problem in a <thinking> tag before it answers in a separate <answer> tag improves multi-step tasks, because it gives the model room to catch its own error before it commits to output. Grade the <answer> block, not the reasoning, if the reasoning is meant to stay internal to your pipeline.

Long-context prompting: document placement and quote-first grounding

For documents over roughly 20,000 tokens, Anthropic's guidance is specific: put the document above the question, not below it, and have Claude extract the relevant quotes into a <quotes> tag before it writes the answer (Anthropic, "Long context prompting tips"). Quote-first grounding forces the model to point at its evidence before it reasons over it, which is a cheap check against the answer drifting away from the source.

In practice that looks like this: paste the contract, then ask Claude to quote the clauses relevant to the liability question into <quotes>, then answer using only those quotes. The extra step costs output tokens. It also catches the case where the model would otherwise answer from a plausible-sounding memory of similar contracts instead of the one you actually gave it.

Context engineering: when Claude prompt engineering isn't enough for agents

A single well-structured prompt is enough for a single-turn task. It is not enough for an agent running many turns with tools, retrieved documents, and a growing history, because the thing that determines quality on turn twelve is not how turn one was worded. It is what is still in the context window: which tool definitions, which retrieved chunks, which of the last eleven turns survived. Anthropic frames this directly: context engineering is "the natural progression of prompt engineering" (Anthropic, "Effective context engineering for AI agents"), the shift from crafting one instruction to continuously curating the full token budget an agent works from.

I lay out the full framework, what to keep, what to compact, what to drop, in my guide to context engineering. The short version for this piece: once you are debugging why an agent got worse on turn eight, the fix is rarely a better sentence in the system prompt. It is usually a context window carrying stale tool output, redundant retrieved chunks, or history it no longer needs.

The prompt that mattered on turn one is not what breaks on turn twelve. What breaks is what you left in the window.

Prompt caching: structuring prompts to cut cost and latency

Prompt caching reuses the already-computed prefix of a prompt, so a long, stable system prompt or document set gets billed at a fraction of full price on every repeat call. Anthropic reports up to 90% cost reduction and up to 85% latency reduction on long, repeated prompts (Anthropic, "Prompt caching with Claude"). The mechanism it depends on is the one this whole piece has been building toward: put the stable content, system instructions, XML-tagged context, documents, first, and put the part that changes every call last.

Take an agent with a 6,000-token system prompt and tool schema running 50,000 calls a month, illustrative numbers, not a specific client's bill. Without caching, that prefix alone is 300 million input tokens a month at full price. With caching, only the first call in each cache window pays full price; the rest read the same prefix at roughly a tenth of the cost. The saving does not come from a cheaper model. It comes from not paying to re-read the same 6,000 tokens fifty thousand times. I go deeper on cache TTLs, hit rates, and vendor-by-vendor pricing in my full breakdown of prompt caching.

The Claude prompt engineering failure mode: over-prompting a model that does exactly what you say

Here is the honest trade-off in Claude prompt engineering right now. Prompts written for older Claude generations leaned on the model reading between the lines: adding polish, going a little beyond the literal ask. Claude 4.x models, Sonnet 5 included, were trained out of that habit. Anthropic says it plainly: teams that want the "above and beyond" behavior of earlier models now have to ask for it explicitly (Claude, "Prompt engineering best practices for 2026"). Ask Claude to "review this PR" the way you asked Claude 3, and on Sonnet 5 you get exactly a review. Not the drive-by refactor, the added test, the extra polish you got used to. Nothing is broken. The model did what you wrote, and what you wrote said less than you meant.

The fix is not a cleverer prompt. It is a more complete one: name the behavior you actually want, "be thorough," "add edge cases I did not mention," "go beyond the obvious fix," instead of assuming Claude will infer it the way an old prompt used to earn for free. The same honesty applies to the XML structure and quote-first grounding covered above. Both measurably improve accuracy. Both add real token overhead. Wrapping a two-sentence question in five XML tags is not rigor, it is waste, and the same discipline that tells you when to add structure should tell you when to leave a simple prompt alone.

The model did exactly what you asked. The gap was between what you wrote and what you meant.

Frequently asked questions

Do I need to use XML tags when prompting Claude?

No. XML tags help most on prompts with real parts to separate: multiple documents, instructions plus examples, or a strict output format a downstream system parses. A short, single-part request does not need tags; wrapping it in five tag pairs adds token cost without adding clarity.

What's the difference between Claude prompt engineering and context engineering?

Prompt engineering is how you word a single instruction. Context engineering is what you keep in the window across many turns, the system prompt, tool definitions, message history, and retrieved data, so an agent stays accurate on turn twelve, not only turn one. Anthropic frames context engineering as the natural progression of prompt engineering, not a replacement for it.

Does prompt caching work with any Claude prompt, or only long ones?

It works on any prompt with a stable, repeated prefix, but it only pays off when that prefix is long enough and reused often enough to earn back the write cost. A short prompt that never repeats gains nothing from caching; a long system prompt or document set reused across thousands of calls is where the savings show up.

How long should a system prompt for Claude actually be?

As long as the job requires and no longer. The right length is set by what a competent new hire would need to do the task without a follow-up question: the scope, the constraints, the escalation rules, the definition of done. Padding it with tone instructions Claude does not need adds tokens you pay for on every call, with no offsetting benefit.

If you want the fuller arc, from a single well-worded prompt to a production pipeline with retrieval, evaluation, and caching built in, that is the subject of my book From Prompt to Pipeline. Prompting Claude well is still worth learning. Do not mistake it for the whole job.

Share
Next

Keep reading

View all blogs

Ask AI about Claude Prompt Engineering: Three Real Differences