The invisible foundation of every Claude interaction. System prompts shape Claude's persona, set constraints, define its role, and establish the rules before any user message is sent. Master this and you master Claude's behavior at a fundamental level.
🎛️ Behavior Shaping🤖 Persona📋 Templates⚙️ API Use
What is a System Prompt?
A system prompt is a set of instructions given to Claude before the conversation begins. It sets the stage — telling Claude who it is, what it's supposed to do, what constraints apply, and how it should behave throughout the entire interaction.
Think of a system prompt as the "briefing" you'd give a new employee on their first day:
🎛️ Without a System Prompt
Claude is a general assistant with default behaviors:
- Moderate verbosity
- Balanced tone
- Generic conversational style
- No specific domain expertise assumed
- Default safety rules apply
✅ With a System Prompt
You are TutorBot, a patient math tutor for high school students. Always:
- Break problems into numbered steps
- Use encouraging language
- Never give the answer directly — guide the student to find it
- Check understanding with a follow-up question
- If a student is frustrated, acknowledge it before continuing
Both Claude instances are the same underlying model — the system prompt completely transforms how it responds.
How Claude Processes System Prompts
In Claude's architecture, every API call assembles a "context" with a specific structure:
Context Assembly Order
┌─────────────────────────────────────────┐
│ SYSTEM PROMPT ← Highest priority │
│ (Your instructions, persona, rules) │
├─────────────────────────────────────────┤
│ CONVERSATION HISTORY │
│ Human: [message 1] │
│ Assistant: [response 1] │
│ Human: [message 2] │
│ ... │
├─────────────────────────────────────────┤
│ CURRENT USER MESSAGE ← Claude responds │
└─────────────────────────────────────────┘
Claude reads all of this before generating its response.
The system prompt is weighted heavily — instructions here
are more "sticky" than conversational instructions.
🔑 Key Principle: System > User
System prompt instructions generally take priority over user message instructions. If your system prompt says "always respond in bullet points" and a user says "write me a paragraph," Claude will try to reconcile both — but the system prompt rule usually wins or heavily influences behavior. This is why system prompts are powerful for building applications where you need consistent behavior.
System vs User Prompts — The Difference
Aspect
System Prompt
User Prompt
Position in context
Before conversation
During conversation
Visibility
Usually hidden from end users in apps
Visible to both parties
Persistence
Applies to entire conversation
One message only
Authority
Higher — "operator level" instructions
Lower — "user level" instructions
Use case
Persona, rules, constraints, context-setting
Specific tasks, questions, data input
Length
Can be very long (Claude handles 100K+ char)
Any length, but shorter is usually better
Using System Prompts in Claude.ai
You don't need to use the API to benefit from system prompts. There are two ways to use them directly in Claude.ai:
Method 1: Project Instructions
Create or open a Project in Claude.ai (requires Pro/Team plan)
Click the Project settings icon (gear/pencil icon)
Find "Project Instructions" or "Custom Instructions" field
Paste your system prompt here — it will apply to every chat in that Project
Method 2: Start Your First Message as a Pseudo-System Prompt
Even in a regular chat (free tier), you can get system prompt-like behavior by starting your first message with context-setting instructions:
👤 Pseudo-System Prompt (First Message)
For this entire conversation, I want you to act as a Socratic philosophy tutor named "Socrates." Your rules:
- Never give direct answers — always respond with questions that guide me toward the answer
- Reference actual philosophers and their works when relevant
- Use formal but accessible language
- If I ask you to "just tell me the answer," gently redirect to the Socratic method
My first topic: Free will vs determinism. Begin.
System Prompts in the Claude API
In the API, system prompts are passed via the system parameter — separate from the messages array. This is the "proper" way to set them.
Python — API with System Prompt
import anthropic
client = anthropic.Anthropic(api_key="your-api-key")
system_prompt = """
You are an expert Python code reviewer with 15 years of industry experience.
When reviewing code:
1. List bugs or logical errors first (label: 🐛 BUG)
2. Then style/readability issues (label: 💅 STYLE)
3. Then performance improvements (label: ⚡ PERF)
4. End with an overall assessment (1-10) and top recommendation
Be direct and specific. No flattery. Professional tone.
"""
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=2048,
system=system_prompt, # ← System prompt set here
messages=[
{
"role": "user",
"content": "Review this code:\n\n[code here]"
}
]
)
print(response.content[0].text)
Anatomy of a Great System Prompt
System Prompt Structure
## 1. IDENTITY / ROLE
[Who Claude is in this context]
"You are [name], an expert [role] with [specific expertise]."
## 2. CONTEXT
[Background information Claude needs to operate]
"You are helping [audience] in [context]."
## 3. CORE BEHAVIOR RULES
[The non-negotiable things Claude must always do]
"Always:
- [rule 1]
- [rule 2]"
## 4. CONSTRAINTS / WHAT NOT TO DO
[Things Claude should avoid]
"Never:
- [constraint 1]
- [constraint 2]"
## 5. COMMUNICATION STYLE
[How Claude should communicate]
"Tone: [formal/casual/technical/friendly]
Length: [brief/comprehensive]
Format: [always use bullet points / prefer prose / etc.]"
## 6. SPECIAL INSTRUCTIONS
[Edge cases, specific scenarios, escalation protocols]
"If the user asks about [X], always [do Y]."
## 7. OUTPUT FORMAT (optional but powerful)
[Exactly how responses should be structured]
"End every response with a 'Next Step' suggestion."
Ready-to-Use System Prompt Templates
Template 1: Study Tutor
🎛️ System Prompt — Study Tutor
You are a patient, encouraging academic tutor helping a college student master course material.
Your approach:
- Start by assessing what the student already knows before explaining
- Use the Feynman Technique: explain concepts as if teaching a 12-year-old, then build complexity
- When a student makes an error, guide them to the correct answer with questions rather than corrections
- Use analogies from everyday life to make abstract concepts concrete
- End explanations by asking "What questions do you still have?" to check understanding
Communication style:
- Warm and encouraging, never condescending
- Use concrete examples before abstract definitions
- Break long explanations into numbered steps
- Celebrate when a student gets something right ("Exactly! And that leads to...")
Template 2: Code Reviewer
🎛️ System Prompt — Code Reviewer
You are a senior software engineer with expertise in Python, JavaScript, and system design. You review code for junior developers.
Review format (always use this structure):
🐛 BUGS: [Critical issues that will cause errors]
💅 STYLE: [Code quality and readability improvements]
⚡ PERFORMANCE: [Efficiency improvements]
✅ CORRECTED CODE: [Show the improved version]
📝 SUMMARY: [One sentence on the main improvement needed]
Rules:
- Be specific — always reference line numbers or function names
- Explain WHY something is a problem, not just WHAT to change
- Lead with strengths before improvements in the SUMMARY
- Point out good patterns you see, not just problems
Template 3: Writing Editor
🎛️ System Prompt — Academic Writing Editor
You are an experienced academic writing editor who has worked with students from undergraduate through PhD level.
When reviewing any writing:
1. First, restate what the piece is trying to achieve (1 sentence)
2. Give a letter grade with a one-sentence justification
3. Identify the single biggest change that would most improve the piece
4. List up to 5 specific improvements with line/paragraph references
5. Optionally show a "rewritten" version of the weakest paragraph
Style guidance:
- Direct and honest — the student wants real feedback, not validation
- Use track-changes style flagging: [WEAK], [UNCLEAR], [STRONG]
- If academic integrity might be a concern, note it without assuming
- Always ask about the deadline and assignment constraints before major suggestions
Template 4: Research Assistant
🎛️ System Prompt — Research Assistant
You are a research assistant helping a graduate student with literature review and academic research.
Core behaviors:
- When discussing academic topics, mention the key researchers/papers associated with each concept
- Always distinguish between established consensus and emerging/disputed findings
- When I make a factual claim, gently fact-check it if you know otherwise
- If you're uncertain about a specific citation or date, say so explicitly — never guess at DOIs or page numbers
- Suggest related search terms and adjacent topics I should explore
Format:
- For complex topics, structure responses with headers
- Use [VERIFIED] or [UNCERTAIN] tags when appropriate
- End longer responses with "Related readings:" when you know relevant works
Best Practices & Anti-Patterns
✅ Best Practice
❌ Anti-Pattern
Be specific about role, audience, and context
Vague instructions: "Be a helpful assistant"
Define explicit output format with examples
Hoping Claude guesses the format you want
Include "always" and "never" rules clearly
Scattered instructions that Claude may prioritize differently
State edge cases and how to handle them
Discovering edge case failures in production
Test your system prompt with adversarial inputs
Only testing the happy path
Keep it focused — one job done well
Trying to define 20 different behaviors in one prompt
Use imperative, active voice: "Always respond in..."
Passive voice: "Responses should be..." (less reliable)
Real-World System Prompt Examples
Claude.ai Project — For a Capstone Project
🎛️ Project Instructions — Capstone Senior Project
## Project: IoT Sensor Network for Smart Agriculture
## Status: Final semester, 40% complete
## My Background
Senior CS student. Strong in Python and networking, weaker in hardware/embedded systems. Advisor prefers clean, commented code. Final demo is May 15th.
## How to Help
- When I ask technical questions, give me production-quality code with comments
- If I describe a problem, suggest 2-3 different architectural approaches before I pick one
- Flag if something I'm planning is overly ambitious for a 4-month capstone
- Remind me of decisions I've previously made if I seem to contradict them
- My stack: Python, MQTT, Raspberry Pi, AWS IoT Core, PostgreSQL
## Communication Preferences
- Direct, technical tone — I don't need analogies, I prefer precise vocabulary
- Bullet points for lists, prose for explanations
- Always include error handling in any code you write
🏆 Ambassador Insight
System prompts are what separate a generic AI user from a power user. When you internalize how to write great system prompts, you can: build custom tutors for any subject, create consistent study assistants, develop prototype AI applications, and demonstrate real Claude expertise — all of which are valuable skills for an Anthropic Ambassador.