Claude System Prompts Explained — How to Set Claude's Behavior for Every Conversation
Learn what system prompts are, how they control Claude's behavior, and how to write effective system prompts with practical examples and templates.
Get notified when we discover new Claude codes
We test new prompt commands every week. Join 4+ developers getting them in their inbox.
Claude System Prompts Explained — How to Set Claude's Behavior for Every Conversation
Every time you talk to Claude, there is a hidden layer of instructions shaping how it responds. These are called system prompts, and understanding them is key to getting consistent, high-quality results from any Claude model. This guide breaks down what system prompts are, how they work, and how to write your own.
What Is a System Prompt?
A system prompt is a set of instructions given to Claude before your conversation starts. It defines Claude's role, behavior, constraints, and goals for the entire interaction. Claude reads the system prompt first, then reads your messages and responds according to those instructions.
Think of it like this: if your conversation messages are the questions on a test, the system prompt is the instructions at the top of the page — "Answer in complete sentences," "Show your work," "Use only information from the provided context."
The user's messages say what to do. The system prompt says how to do it.
Where Do System Prompts Appear?
System prompts show up in several places depending on how you use Claude:
Claude API
If you are building an application with the Claude API, you set the system prompt directly in your API call. This is the most common use case for developers:
{
"model": "claude-sonnet-4-6-20260410",
"system": "You are a customer support agent for Acme Corp...",
"messages": [
{"role": "user", "content": "How do I reset my password?"}
]
}
Claude.ai Projects
In Claude Projects, you can set project-level instructions that function as a system prompt. Every conversation within that project inherits these instructions.
Claude Code
In Claude Code, the CLAUDE.md file serves a similar purpose — it provides persistent instructions that shape Claude's behavior for your project.
What Can System Prompts Control?
Role and Persona
You can define who Claude is in the conversation:
You are a senior Python developer who specializes in data engineering.
You have 10 years of experience with Apache Spark, Airflow, and dbt.
You prefer simple solutions over clever ones.
This changes how Claude approaches problems, what tools it recommends, and what level of detail it provides.
Output Format
You can specify exactly how Claude should structure its responses:
Always respond with:
1. A one-sentence summary
2. The detailed explanation
3. A code example if applicable
4. Potential pitfalls to watch for
Use markdown formatting. Keep responses under 500 words unless the user asks for more detail.
Constraints and Boundaries
You can restrict what Claude does:
Only answer questions about our product. If the user asks about
competitor products, politely redirect them to our comparison page.
Do not make up features that do not exist. If you are unsure about
a feature, say so rather than guessing.
Knowledge and Context
You can provide specific information Claude should use:
Our current pricing tiers are:
- Starter: $9/month, up to 1,000 records
- Pro: $29/month, up to 50,000 records
- Enterprise: Custom pricing
Use this information when answering pricing questions.
Do not reference any other pricing.
Tone and Style
You can set how Claude communicates:
Write in a casual, friendly tone. Use short sentences. Avoid jargon.
When explaining technical concepts, use analogies from everyday life.
Never use the word "utilize" — say "use" instead.
How to Write an Effective System Prompt
Here are the principles that make system prompts work well:
Be Explicit, Not Implied
Claude follows instructions literally. "Be helpful" is too vague to change behavior. "When the user asks a question, first check if it is covered in the documentation section below, then provide the relevant answer with a link to the doc page" is specific and actionable.
Put the Most Important Instructions First
Claude pays attention to the entire system prompt, but front-loading your most critical instructions ensures they are prioritized. If there is one behavior you absolutely need, put it in the first paragraph.
Use Examples
Showing Claude an example of a good response is more effective than describing it abstractly:
When a user reports a bug, respond in this format:
User: The export button is not working on the dashboard.
Assistant: I understand the export button on the dashboard is not
working. Let me help you troubleshoot:
1. Which browser are you using?
2. When you click the button, does anything happen (error message,
loading spinner, nothing at all)?
3. Are you trying to export a specific report or the full dashboard?
This will help me narrow down the issue quickly.
Define Edge Cases
Think about the unusual situations and tell Claude how to handle them:
If the user asks about a feature that does not exist yet, respond with:
"That feature is not currently available, but I have noted your interest.
Here is what we do offer that might help: [suggest closest alternative]."
If the user is frustrated or angry, acknowledge their frustration before
proceeding to solve the problem. Never be defensive.
Test and Iterate
Your first system prompt will not be perfect. Test it with various inputs, including edge cases and adversarial questions. Refine based on where Claude's behavior does not match your expectations.
System Prompt Examples for Common Use Cases
Customer Support Bot
You are a support agent for [Product Name]. Your goals are:
1. Resolve the user's issue as quickly as possible
2. Be friendly but concise
3. If you cannot resolve the issue, collect relevant details and
escalate by telling the user a support ticket will be created
Knowledge base: [insert relevant product documentation]
Never share internal processes. Never give refunds directly —
direct refund requests to billing@company.com.
Code Review Assistant
You are a code reviewer. When shown code:
1. Check for bugs and logical errors first
2. Then check for security issues
3. Then suggest improvements for readability and performance
4. Be direct — say what is wrong and why, do not soften feedback
5. Provide corrected code for each issue you identify
Prioritize issues: Critical > Security > Performance > Style
Writing Assistant
You are an editor who helps improve written content.
Maintain the author's voice — do not rewrite in your own style.
Focus on: clarity, conciseness, logical flow, and grammar.
When suggesting changes, explain why each change improves the text.
If the writing is already good, say so rather than making changes
for the sake of making changes.
System Prompts and Claude's Models
All current Claude models — Opus 4.6, Sonnet 4.6, and Haiku 4.5 — support system prompts. However, they respond to them differently:
- Opus 4.6 follows nuanced, complex system prompts with high fidelity. It is best when your system prompt has subtle rules and edge cases.
- Sonnet 4.6 handles most system prompts well and is the best balance of instruction-following and speed for most applications.
- Haiku 4.5 works best with shorter, simpler system prompts. Very complex instructions may be followed less consistently.
Common Mistakes
Making the system prompt too long. A 5,000-word system prompt with every possible edge case will dilute the important instructions. Keep it focused on what matters most.
Contradicting yourself. If one paragraph says "be concise" and another says "provide comprehensive detail," Claude will be confused. Review your system prompt for conflicting instructions.
Not testing with real inputs. A system prompt that looks good in theory might fail with actual user messages. Test with realistic examples.
Forgetting to update. If your product, pricing, or policies change, update the system prompt. Stale information in the system prompt leads to wrong answers.
Getting Started
If you want to experiment with system prompts:
- Start with a clear role definition — who is Claude in this context?
- Add two or three output format rules
- Add your most important constraints
- Test with five to ten realistic user messages
- Refine based on the results
For ready-to-use system prompts and other prompt patterns, explore our prompt library. Our cheat sheet includes quick-reference system prompt templates for common use cases. And for a broader understanding of working with Claude, check our complete guide.