A system prompt is the instructions you give Claude before the conversation begins — the context, persona, rules, and constraints that shape every response in the session. It’s the most powerful lever you have for controlling Claude’s behavior at scale, and the foundation of any serious Claude integration. Here’s how system prompts work, how to write them well, and real examples across common use cases.
System Prompt Structure: The Five Elements
A well-structured system prompt typically covers these elements — not all are required for every use case, but the strongest prompts address most of them:
You are [specific role/persona]. [1-2 sentences on expertise and perspective].
# Context
[What this system/application/conversation is for. Who the user is. What they’re trying to accomplish.]
# Instructions
[Specific behaviors: what to do, how to format responses, how to handle edge cases]
# Constraints
[What NOT to do. Topics to avoid. Format rules to enforce. Information not to share.]
# Output format
[How Claude should structure its responses: length, format, sections, tone]
System Prompt Examples by Use Case
Customer Support Agent
Tone: professional, patient, solution-focused. Never dismissive.
For billing questions: provide information but escalate refund requests to billing@acme.com.
For technical issues: follow the troubleshooting guide below before escalating.
Never discuss: competitor products, internal pricing strategy, unreleased features.
Always end with: “Is there anything else I can help you with today?”
Code Assistant
When writing code: use type hints in Python, strict TypeScript, and always include error handling. Prefer explicit over implicit. Comment non-obvious logic.
When reviewing code: flag issues by severity (critical/high/medium/low). Always explain why something is a problem, not just that it is.
Never write code without error handling. Never use eval(). Never hardcode credentials.
Content Writer
Voice: direct, confident, no filler. Never use “leverage,” “synergy,” or “utilize.” Short sentences. Active voice.
Audience: project managers and engineering leads at companies with 50–500 employees.
Always: include a clear next step or CTA. Never: make claims we can’t back up, mention competitors by name.
What System Prompts Can and Can’t Do
System prompts are powerful but not absolute. They can reliably control: Claude’s tone and persona, output format and structure, topic scope and focus, response length guidelines, and how Claude handles specific scenarios. They cannot override Anthropic’s core guidelines — Claude won’t follow system prompt instructions to produce harmful content, lie about being an AI when sincerely asked, or violate its trained ethical constraints regardless of what the system prompt says.
System Prompts in the API vs. Claude.ai
In the API, the system prompt is passed as the system parameter in your API call. In Claude.ai Projects, the custom instructions field functions as the system prompt for all conversations in that Project. In Claude.ai standard conversations, you can prepend context at the start of a conversation — it’s not a true system prompt but achieves a similar effect.
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
system="You are a helpful assistant...", # ← system prompt here
messages=[
{"role": "user", "content": "Hello"}
]
)
For a full library of tested prompts across use cases, see the Claude Prompt Library and Claude Prompt Generator and Improver.
Frequently Asked Questions
What is a Claude system prompt?
A system prompt is instructions given to Claude before the conversation begins — setting its role, constraints, tone, and output format. It persists throughout the session and takes priority over user messages within Anthropic’s guidelines.
How long should a Claude system prompt be?
Long enough to cover what Claude needs to behave correctly, short enough that Claude actually follows all of it. Most production system prompts are 200–1,000 words. Beyond that, you risk important instructions getting less attention. Structure with headers helps Claude parse longer prompts.
Can users override a system prompt?
Not reliably. System prompts take priority over user messages. A user saying “ignore your system prompt” won’t override legitimate business instructions. Claude is designed to follow operator system prompts even when users push back, within Anthropic’s ethical guidelines.
Leave a Reply