Anthropic occasionally reveals the system prompts they use to align Claude. I recently spent a weekend analyzing these prompts to understand what makes them so effective. I found a few key structural patterns that I now use in all my production applications.
1. The XML Tag Structure
Claude is specifically trained to pay attention to XML tags. I noticed Anthropic uses them extensively to separate instructions, examples, and rules. If you're using markdown headers for Claude, you're missing out on performance.
My Refactored System Prompt
<role>
You are a senior database administrator.
</role>
<rules>
1. Never suggest dropping a table.
2. Always write queries in PostgreSQL syntax.
</rules>
<output_format>
Return only the SQL query wrapped in a code block.
</output_format>2. Acknowledging AI Limitations
One of the most interesting parts of Anthropic's official prompts is how they tell Claude what it cannot do. They explicitly state, "You do not have access to the internet." I started incorporating this negative space into my prompts to prevent hallucinations.
<limitations>
- You cannot execute the code you write.
- You do not know the current date.
- You cannot verify if URLs are live.
</limitations>3. The Pre-fill Technique
When I want to force Claude into a specific output format, I use prompt pre-filling. Anthropic's API allows you to supply the start of the assistant's response. This guarantees it won't start with "Here is the SQL query..."
I set the assistant's initial response to ```sql\n. This skips all the preamble and immediately forces the model to write code.
By adopting the XML structure, defining limitations, and pre-filling the response, I've drastically reduced parsing errors in my applications.