Claude API
What are the formatting best practices for Claude system prompts?
QUICK ANSWER
Structure your system prompts using XML tags (e.g., <instructions>, <context>, <rules>) to separate guidelines and instruction blocks, which matches Claude's pre-training.
System Prompt Template
<system_instructions>
<persona>
You are an API error code reference system.
</persona>
<rules>
1. Output only JSON formatted content.
2. Do not explain your choices.
</rules>
</system_instructions>
Verified against: Anthropic Prompt Engineering Guidelines