🤖 Claude · Prompt Engineering · Anthropic
Claude System Prompt Examples That Actually Work
A weak system prompt reads like a mission statement ("You are a helpful, friendly assistant") and produces generic answers. A strong one reads like a job description: what the role is, what to use, what to avoid, and what the output looks like. The examples below follow the second pattern.
Where this lands
System prompts work well when they set one clear role, a few firm rules and a fixed output format. They work poorly when they're long, vague, or packed with conflicting rules. If you want ready-made starting points, the Claude master prompt template is a good base.
What a system prompt needs from you
Four things: a role, the context Claude should rely on, the rules, and the output format. Everything else is decoration. XML-style tags such as <docs> help separate your material from your instructions, and one sample answer often fixes tone faster than a paragraph describing it.
Example prompts
Code reviewer
You are a senior code reviewer for a Python web team. Review the code the user pastes. - List bugs first, then style issues. - For each issue give the line, the problem and a fix. - If the code is fine, say so in one sentence. - Do not rewrite the whole file unless asked.
Support assistant
You are a support assistant for Acme Billing. Answer only from the text inside <docs> tags. If the answer isn't there, say you don't know and offer a human. Keep answers under 120 words.
Patient tutor
You are an algebra tutor for high school students. Never give the final answer first. Ask one guiding question, wait for the reply, then give a hint if they're stuck.
JSON extractor
Extract name, email, company and phone from the user's text. Return only valid JSON. Use null for missing fields.
Sending it through the API
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=500,
system="You are a patient tutor. Ask one guiding question at a time.",
messages=[{"role": "user", "content": "Help me solve 2x + 6 = 14"}],
)
print(message.content[0].text)
The system text goes in its own system field, not in the messages list. New to the API? Follow the Claude API tutorial.
The "it ignores my rules" problem
When Claude drifts, the cause is usually a vague rule or two rules that conflict. How to avoid it: say what to do, not only what to avoid, keep the rule list short, and test with a few awkward inputs. For student-style uses, see Claude prompts for students, and for general technique read write better AI prompts.
💡 Practical rule: If Claude ignores a rule, the rule is probably vague or conflicts with another rule. Rewrite it to say exactly what to do, test it with edge cases, and keep your rule list under 5 items.
Comparing your options
| Approach | Best For | Effort | Consistency |
|---|---|---|---|
| Hand-written system prompt | Specific products and workflows | Medium | High |
| Template starter | Fast start | Low | Medium |
| Anthropic prompt generator | First draft from a goal | Low | Medium, needs editing |
| Chat-only instructions | One-off tasks | Low | Low |
Keep going
Browse best Claude prompts for everyday chat prompts. In the Claude app you paste instructions or use a Project's custom instructions, and the dedicated system field is an API feature.
✅ Bottom line: Strong system prompts read like job descriptions, not mission statements. Set one clear role, a few firm rules, and a fixed output format. Test with edge cases, keep it short, and let Claude do the work.
Frequently asked questions
Further reading
- Claude prompt engineering overview – official guidance.
- Claude API docs – current model names and parameters.