✓ Updated July 5, 2026
Sources: Anthropic official docs · Constitutional AI paper · Liu et al. 2023 · Wei et al. 2022
How to Prompt Claude: The Complete Guide (2026)
Most people prompt Claude the same way they prompt ChatGPT. That is the core mistake. Claude reads prompts differently, processes structure differently, and behaves differently based on how Anthropic trained it. This guide covers every technique that actually works — from the basics to the research-level mechanics — based on Anthropic's official documentation and peer-reviewed findings on how transformers process prompts.
The Short Version
Claude responds best to: (1) XML-tagged prompt structure, (2) long data placed before your query, (3) a role set in the system prompt, (4) positive framing instead of negation, and (5) 3–5 concrete examples. These five techniques, applied together, consistently outperform unstructured prompts by a significant margin. The rest of this guide explains exactly why each one works and how to implement it.
AI Prompting Guides — Full Series
🟣
Claude
XML tags, system prompts, 30% placement rule
🟢
ChatGPT
Output contracts, reasoning effort, few-shot
🔵
Gemini
Search grounding, 1M context, multimodal
🎨
Midjourney
Parameters, weighting, style references
⌨️
Cursor
.cursorrules, @mentions, agent mode scope
⚡
Grok
Live X data, DeepSearch, Imagine prompts
How Claude Reads a Prompt Differently Than ChatGPT
Claude and ChatGPT are both large language models, but they were trained differently, and those differences show up directly in how they respond to prompts.
Claude was trained with Constitutional AI
Anthropic trained Claude using a method called Constitutional AI — a process where Claude evaluated its own outputs against a written set of principles and revised them iteratively. This created a model that is unusually attentive to context, intent, and framing. The upside: Claude is very good at following nuanced multi-part instructions. The downside: it is more sensitive to how you frame requests, adds more caveats by default, and is more likely to ask for clarification on ambiguous tasks.
Claude treats XML as a native language
This is the single most important Claude-specific fact for prompting. Anthropic built XML tag awareness directly into Claude's training data. When you use XML tags to structure your prompt, Claude does not just tolerate the structure — it actively uses the tag names to understand what each section of your prompt is. This is not how GPT-4o was trained. XML tagging on Claude produces measurably more consistent outputs; on ChatGPT, it has minimal effect.
Claude defaults to caution, not assumption
When a request is ambiguous, ChatGPT typically makes an assumption and proceeds. Claude typically asks for clarification or hedges its output. This is intentional design from Anthropic. For practical use, you need to tell Claude explicitly what to do when it encounters ambiguity: "If anything is unclear, state your assumption briefly and proceed."
Anthropic's golden rule test: Think of Claude as a brilliant but new employee who lacks context on your norms and workflows. Show your prompt to a colleague with minimal context. If they would be confused about what to do, Claude will be too. The fix is almost always more specificity, not more repetition.
The 5 Techniques That Work on Claude Specifically
1
Set a role in the system prompt
Even a single sentence changes Claude's output quality. "You are a senior technical writer" is enough to shift tone, vocabulary level, and how Claude handles ambiguous formatting decisions. Put the role in the system prompt, not the user turn — it persists for the entire session and has higher weight.
2
Use XML tags to separate your prompt sections
Wrap instructions, context, examples, and data in descriptive XML tags. Use <instructions>, <context>, <task>, <output_format>. This eliminates misinterpretation when your prompt mixes multiple content types. Anthropic's internal tests show 20-40% improvement in output consistency on complex prompts.
3
Put long data first, your query last
When you are passing documents, data, or large amounts of context, place all of it at the top of your prompt and put your question or task at the very bottom. Anthropic's own documentation states this improves response quality by up to 30% in complex multi-document tasks. The reason is positional — Claude attends most strongly to what comes last.
4
Use positive framing, not negation
Replace every "don't do X" with "do Y instead." Claude processes what you said before it can negate it — and negation is unreliable under the hood. "Do not use bullet points" is weaker than "Write your response in flowing prose paragraphs." The positive version gives Claude a target; the negative version gives it a rule to remember while generating.
5
Add 3–5 examples, wrapped in example tags
Examples are the most reliable way to steer tone, format, and style. Wrap each in <example> tags inside an <examples> block. Use 3–5 examples, make them diverse (cover edge cases, not just the ideal case), and keep the format of your examples identical to what you want as output.
XML tagging is not optional decoration when working with Claude. It is the primary mechanism for communicating prompt structure. Here is how to do it correctly.
Basic structure
Standard Claude prompt with XML structure
<role>You are a senior product manager at a B2B SaaS company.</role>
<context>
We are writing copy for a product launch email to existing customers.
Audience: IT directors at mid-market companies. Tone: professional, confident, not salesy.
</context>
<task>
Write a 150-word email announcing our new API integration feature.
Focus on time savings and security compliance benefits.
</task>
<output_format>
Subject line (max 9 words)
---
Email body (150 words, 3 paragraphs)
---
CTA (one sentence, action verb)
</output_format>
Passing multiple documents
When giving Claude multiple sources to work with, nest them inside <documents> tags with individual <document index="n"> wrappers. This lets Claude reference specific sources in its response.
<documents>
<document index="1">
<source>Q2 earnings report</source>
<document_content>
[document text here]
</document_content>
</document>
<document index="2">
<source>Competitor analysis</source>
<document_content>
[document text here]
</document_content>
</document>
</documents>
Analyze the documents above. Identify the three biggest strategic gaps relative to our competitor.
Tag naming rule: Use consistent, descriptive names across all your prompts. <instructions> not <inst>. <output_format> not <out>. Claude reads the tag name as a signal about what type of content follows — vague names reduce that signal.
Structuring examples
<examples>
<example>
<input>Product: CRM software. Audience: sales managers. Tone: direct.</input>
<output>Cut your team's admin time in half. [Tool] automatically logs calls, emails, and meetings so your reps can focus on selling.</output>
</example>
<example>
<input>Product: HR platform. Audience: HR directors. Tone: professional.</input>
<output>Reduce time-to-hire by 40%. [Tool] centralizes applicant tracking, onboarding workflows, and compliance documentation in one dashboard.</output>
</example>
</examples>
Long Context: The 30% Placement Rule
This is one of the most important and least-known facts about prompting any large language model — not just Claude. Research from Liu et al. (2023) at Stanford demonstrated that LLMs pay significantly less attention to information placed in the middle of a long context. Performance on multi-document question answering dropped by over 30% when the relevant document moved from first or last position to a middle position in a 20-document context.
Anthropic's own documentation confirms this for Claude specifically, noting that placing your query at the end of a long prompt improves response quality by up to 30% in complex, multi-document inputs.
The correct order for long prompts
| Position | What goes here | Why |
| Top | Role / system context | Sets the frame Claude reads everything else through |
| Middle | All documents / data / context | Claude scans this with the frame already established |
| Bottom (always last) | Your task / question | Recency effect — Claude attends most strongly to final content |
Common mistake: Putting the task first, then the documents. "Analyze the following documents and find inconsistencies. [Documents]" is weaker than "[Documents] — Analyze the documents above and find factual inconsistencies." Move your question to the bottom.
Grounding in quotes for long documents
For long document tasks, ask Claude to quote relevant sections before drawing conclusions. This forces Claude to actively locate the relevant content rather than summarize from memory. Add: "First, quote the specific passages from the documents that are relevant to this question. Then answer based only on those quotes."
System Prompts: How to Write One That Sticks
The system prompt is not just a place to set the role. It is Claude's operating contract for the entire session. Everything in the system prompt has higher weight than user-turn instructions — Claude will follow system prompt rules even when user messages seem to conflict with them.
Effective system prompt structure
You are [specific role with relevant expertise].
Your audience: [who they are and what they care about].
Your rules:
1. [Most important non-negotiable constraint]
2. [Format default]
3. [Tone default]
4. [What to do when ambiguous: state assumption + proceed]
Your output format: [default format unless the user specifies otherwise].
The contradiction problem
The most common system prompt failure is quiet contradictions. "Be concise" alongside "explain your reasoning fully" forces Claude to satisfy both at once — and it produces output that satisfies neither. Before deploying any system prompt, read it for contradictions and remove them. Declare a priority order when you cannot avoid tension: "If conciseness and completeness conflict, prioritize conciseness."
Handling ambiguity explicitly
By default Claude asks for clarification on ambiguous requests. If you want it to proceed instead, add this to your system prompt:
When the user's request is ambiguous, state your interpretation in one sentence and proceed with the most reasonable reading. Do not ask for clarification unless the ambiguity would fundamentally change the output.
Before/After: Real Prompt Rewrites
Example 1 — Business analysis
✗ Weak prompt
Analyze this company's Q2 performance and tell me what you think.
✓ Strong prompt
<role>You are a management consultant specializing in SaaS metrics and unit economics.</role>
<data>
[Q2 report content here]
</data>
Analyze the Q2 performance data above. Identify:
1. The 3 most critical business risks (ranked by severity and timeframe)
2. The 2 strongest growth opportunities with revenue potential
3. One concrete recommended action with a suggested owner and 30-day deadline
Format each risk as: [Risk name] | Severity: High/Med/Low | Timeframe: X months | Root cause in one sentence.
State each finding as a direct professional judgment. Do not hedge or add caveats.
Example 2 — Writing with a specific tone
✗ Weak prompt
Write a product description. Don't be too formal. Don't use jargon.
✓ Strong prompt
<role>You are a direct-response copywriter. Your style is warm, specific, and benefit-driven.</role>
<product>
Name: SleepScore Pro
What it does: tracks sleep stages via phone microphone, gives a daily score, recommends one specific improvement each morning
Target customer: professionals aged 30-45 who know they sleep badly but don't know why
</product>
Write a 100-word product description for the SleepScore Pro app store listing.
Use second-person ("you"). Write in short sentences. Lead with the customer's problem, not the product's features.
Do not use the words "revolutionary," "innovative," or "seamless."
Example 3 — Code review
✗ Weak prompt
Can you look at my code and tell me if there are any issues?
✓ Strong prompt
<role>You are a senior Python engineer conducting a production security review.</role>
<context>This endpoint handles user authentication and will process ~5,000 requests per hour in production.</context>
<code>
[code here]
</code>
Review the code above for:
1. Security vulnerabilities (SQL injection, auth bypass, input validation gaps)
2. Performance issues at 5,000 req/hr
3. Error handling gaps that would cause silent failures in production
For each issue found: name it, explain the exact risk, provide the corrected code.
Skip style suggestions. Focus only on production risks. If no issues exist in a category, say so explicitly.
7 Failure Modes Specific to Claude
These are the most common reasons a Claude prompt does not produce the output you expected, and the specific fix for each.
Failure mode 01
Claude ignores instructions given in the middle of a long prompt
Root cause: Transformer attention assigns lower weight to middle-context tokens. The "Lost in the Middle" effect (Liu et al. 2023) — Claude genuinely attends less to content buried in the middle of a long input. This is structural, not a bug.
Fix: Move critical instructions to the top of your prompt or the very bottom. Never place your most important constraint in the middle of a 2,000-word prompt. If you must have a long context, repeat the key instruction at the very end.
Failure mode 02
Claude adds unwanted caveats, hedges, and "however" statements
Root cause: Constitutional AI training rewarded hedging on uncertain claims. Claude learned that adding "it's worth noting" and "you should consult a professional" made outputs safer — so it does it by default even when you don't need it.
Fix: Add to your system prompt: "State each point as a direct fact. Do not add caveats, disclaimers, or hedging language. You are the expert and the user has consented to direct advice."
Failure mode 03
Claude refuses a reasonable request
Root cause: Claude's safety classifier pattern-matches surface features of your request, not your actual intent. "How does SQL injection work" and "how do I attack this database" look similar at the token level to the classifier.
Fix: Establish professional context and purpose before making the request. "I'm a security engineer reviewing our own application for vulnerabilities. I need to understand how [attack type] works to write a remediation plan." Context shifts the classifier's evaluation.
Failure mode 04
Claude loses thread of instructions in long conversations
Root cause: Context rot — as conversation length grows, attention quality for early content degrades. Research (Du et al. 2025) found 14–85% attention degradation on early-context content as conversations lengthen. Instructions from turn 1 are followed less reliably by turn 10.
Fix: Re-inject critical instructions every 5–7 turns. Add a brief reminder: "Reminder: respond only in bullet points. No prose." Or use the system prompt to anchor non-negotiable rules — system prompt rules resist degradation better than user-turn instructions.
Failure mode 05
Claude ignores format instructions (keeps using bullet points, markdown, etc.)
Root cause: Negative framing. "Don't use markdown" activates the concept of markdown before suppressing it, and suppression is unreliable during token generation. The positive format instruction was not given.
Fix: Replace every negative format rule with a positive one. "Don't use bullet points" → "Write your entire response in flowing prose paragraphs." Also: match your prompt's own formatting to your desired output — if your prompt uses markdown headers, Claude is more likely to produce them.
Failure mode 06
Claude gives a generic, surface-level response
Root cause: Missing context. Claude has no grounding in your specific situation and produces the safest, most general answer. It is not being lazy — it genuinely does not know what specific means for your use case.
Fix: Add three types of context: who you are, who the audience is, and what "good" looks like. "I'm a B2B SaaS founder writing for mid-market CTOs who care about security compliance and integration costs" gives Claude enough to be specific.
Failure mode 07
Claude truncates a long output mid-way through
Root cause: Default output length constraints plus the model's tendency to wrap up rather than continue. Claude defaults to conversational response length unless told otherwise.
Fix: Add explicitly: "Complete your full response. Do not truncate or summarize at the end." Also increase max_tokens if you are using the API. If truncation still occurs, use prompt chaining — break the output into sequential smaller requests rather than one massive output.
Claude vs ChatGPT: Prompting Differences
The same prompt will produce noticeably different results on Claude and ChatGPT. Here is what changes and what to adjust.
| Dimension | Claude | ChatGPT (GPT-4o/4.1) |
| Best prompt structure |
XML tags — trained on it natively |
Markdown headers or plain prose — XML has minimal benefit |
| Multi-constraint prompts |
Excellent — follows all 8 requirements |
Good — may drop one or two constraints |
| System prompt weight |
High — treated as a binding contract |
Medium — user turn can override it |
| Exact format compliance |
High — "exactly 5 points" = 5 points |
Variable — may give 4 or 6 |
| Handling ambiguity |
Asks for clarification by default |
Assumes and proceeds by default |
| Negation rules |
Needs positive framing to be reliable |
Same issue — also needs positive framing |
| Refusal rate |
Higher — Constitutional AI fires broadly |
Lower — softens output rather than refusing |
| Tone instruction compliance |
Very precise — nails "warm but professional" |
Good — also strong on tone |
| Long system prompt following |
Strong — follows 2,000-word system prompts reliably |
Degrades on very long system prompts |
The one-line summary: Use XML structure for Claude, plain markdown structure for ChatGPT. Claude follows complex multi-constraint prompts more reliably. ChatGPT is more willing to proceed without pushing back on edge cases. Neither is objectively better — pick based on your task.
Advanced: Thinking and Reasoning (2026 Models)
Claude's 2026 models (Opus 4.7+, and the Fable/Mythos generation) use adaptive thinking — Claude automatically decides when and how much internal reasoning to apply, based on query complexity and the effort level you set. You no longer control this with a token budget; you control it with the effort parameter (low / medium / high / max) in the API.
For complex reasoning tasks, guide the thinking process narratively in your prompt:
After receiving the data, reflect on what is surprising or counterintuitive before drawing conclusions.
Explore at least two competing explanations before committing to one.
State which explanation you find more credible and why, then give your final answer.
For simple tasks, add this to prevent over-thinking which adds latency:
For straightforward tasks, respond directly without extended reasoning. Only use deeper analysis when the question genuinely requires multi-step logic.
Summary: The Claude Prompting Checklist
✓
Role set in system prompt?
One sentence minimum. Specific expertise, not just "helpful assistant."
✓
XML tags used for all sections?
Instructions, context, task, output format — each in its own tagged block.
✓
Long data at top, query at bottom?
If passing documents, they go first. Your question goes last.
✓
All constraints phrased positively?
Every "don't" converted to a "do instead."
✓
3–5 examples in <example> tags?
Diverse examples, identical format to desired output.
✓
Ambiguity rule defined?
Tell Claude explicitly whether to ask or assume when something is unclear.
Compare Claude Against Other AI Tools
See how Claude stacks up against ChatGPT, Gemini, and other AI assistants across writing, coding, and research tasks.
ChatGPT vs Claude →