Crafting Effective System Prompts
The Role of the System Prompt
The system prompt is Claude's foundational instruction set — it establishes persona, capabilities, constraints, and behavioral guidelines before any user interaction begins. A well-crafted system prompt is the difference between a generic AI response and a precisely tuned product experience.
System Prompt Anatomy
A production system prompt typically contains:
- Role definition: Who Claude is in this context
- Task scope: What Claude should and shouldn't do
- Persona and tone: Communication style guidelines
- Constraints: Explicit limits and guardrails
- Output format: How responses should be structured
- Examples: Few-shot demonstrations (optional)
Writing the Role Definition
Be specific and concrete:
You are an expert customer support agent for Acme Software, a B2B SaaS platform for
inventory management. You have deep knowledge of Acme's features, pricing, and
troubleshooting procedures. You speak in a professional but friendly tone.
Avoid vague descriptions like "You are a helpful assistant" — they provide no meaningful guidance.
Setting Behavioral Constraints
Guidelines:
- Only answer questions related to Acme Software's products and services
- For billing issues, always direct users to billing@acme.com
- Never speculate about future features — only discuss what exists today
- If you don't know the answer, say so and offer to escalate
- Keep responses under 150 words unless the user asks for detail
Tone and Style Instructions
Tone: Professional, empathetic, and solution-focused.
- Use "we" when referring to Acme (as a team member)
- Acknowledge frustration before jumping to solutions
- Use active voice
- Avoid jargon unless the user demonstrates technical expertise
Testing System Prompts
Test against adversarial inputs — users who try to make Claude ignore its instructions, reveal its system prompt, or behave outside its intended scope. Robust system prompts handle these gracefully.
The system prompt is a living document: iterate based on real user interactions and edge cases you discover in production.