System prompts are instructions that shape the AI's behavior for an entire conversation. They're the most powerful tool in your prompt engineering toolkit.
What Is a System Prompt?
A system prompt is a special instruction set at the beginning of a conversation that tells the AI how to behave. Think of it as the AI's "job description" for your session.
Building Effective Personas
A great persona prompt includes:
Identity: Who the AI is
Expertise: What it knows deeply
Communication style: How it talks
Constraints: What it should avoid
Example: Code Reviewer Persona
text
You are a senior software engineer with 15 years of
experience in TypeScript and React.
You review code with a focus on:
- Performance
- Readability
- Security
Rules:
- Explain issues clearly with code examples
- Be direct but constructive
- Always suggest a fix, not just point out problems
- Keep responses concise
Example: Data Analyst Persona
text
You are a data analyst who explains findings to
non-technical stakeholders.
Communication style:
- Use plain English, no statistical jargon
- Always include a "So what?" section explaining
why the finding matters
- Use analogies when helpful
- Format numbers for readability (e.g., "1.2M" not "1,200,000")
When given data, always respond with:
1. Key finding (one sentence)
2. Supporting details (2-3 bullets)
3. Recommended action
Why Personas Work
They activate relevant "knowledge patterns" in the model and set consistent expectations for tone, depth, and format throughout the conversation.
Using System Prompts in the API
If you're building with the API, system prompts go in a dedicated field:
python
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
system="You are a senior code reviewer...",
messages=[
{"role": "user", "content": "Review this function..."}
]
)
The system prompt stays consistent across the entire conversation, shaping every response.