1. Use XML Tags to Separate Prompt Sections
Claude is trained with XML-style tags as structural delimiters and responds to them reliably. When you wrap distinct sections — instructions, context, examples, the user's query — in named tags, Claude treats each section according to its label rather than guessing where one idea ends and another begins. This is the single cheapest improvement most prompts can make.
Without XML tags, a prompt that mixes instructions with context frequently causes Claude to apply instructions selectively or conflate the user's query with the reference material. With tags, each element is unambiguous. Anthropic's guide on using XML tags covers the mechanics in detail — the short version is: tag names can be anything meaningful, and nesting is supported.
Tags are especially critical when your prompt contains all three of: long background context, multi-step instructions, and a variable user input. Without delimiters, Claude's attention is spread unevenly. With them, it processes each region in context. See our dedicated post on how to use XML tags in prompts for extended patterns.
Copy-paste example — without XML tags (weak): ``` You are a legal assistant. Here are the contract terms: Payment is due in 30 days. Late fees are 1.5% per month. Jurisdiction is California. The user asks: Can we extend the payment terms to 45 days? Answer professionally. ``` With XML tags (strong): ```xml <system> You are a senior contract attorney specializing in commercial agreements. </system> <contract_excerpt> Payment is due in 30 days. Late fees are 1.5% per month. Jurisdiction is California. </contract_excerpt> <user_question> Can we extend the payment terms to 45 days without triggering the late fee clause? </user_question> Review the contract excerpt and answer the user's question directly. Cite the relevant clause. ``` The tagged version consistently produces a clause-specific answer; the untagged version frequently returns a generic explanation of payment terms.