Last updated: June 2026
The Claude System Prompt GuideSet the rules once, get them every turn
A Claude system prompt is a separate instruction block that sets Claude's role, rules, tone, and limits before the conversation starts. In the Anthropic API you pass it as the system field, and it applies to every turn. Define behaviour once instead of repeating it in every message. This guide covers what it is, how to write one that actually changes output, four templates you can copy, and the mistakes that make Claude ignore you.
What is a Claude system prompt?
A system prompt is the standing context you give Claude before any specific request. It tells Claude who it is, what it knows, how to respond, and what it must not do. In the Anthropic Messages API it is a dedicated parameter called system, passed separately from the messages array that holds the actual conversation.
The point is persistence. Anything in the system prompt applies to every turn of the conversation, so you set behaviour once rather than re-stating it in each message. Anthropic's own prompt-engineering guidance is blunt about its value: "Setting a role in the system prompt focuses Claude's behavior and tone for your use case. Even a single sentence makes a difference."
If you are writing one-off prompts in a chat, you may never touch a system prompt directly. If you are building anything that reuses Claude — a support bot, an internal tool, a content pipeline, a Claude.ai Project — the system prompt is where the real control lives.
System prompt vs user prompt
The two are different jobs. Mixing them up is the single most common reason a system prompt fails to stick.
System prompt
- Standing rules that apply to every turn
- Role, tone, format, hard limits, domain context
- Set once, in the
systemfield - The end user usually never sees it
User prompt
- The specific request for this one turn
- The question, the task, the input data
- Sent in the
messagesarray - Changes with every interaction
Rule of thumb: the system prompt is the job description, the user prompt is the individual ticket. If a rule should hold no matter what the user asks next, it goes in the system prompt.
Where you set the system prompt
Where it lives depends on how you use Claude. Three common cases:
The Anthropic API
Pass your text in the system field on the messages.create call. This is the canonical way and the one every other surface is built on top of.
Claude.ai Projects
In Claude.ai, a Project's custom instructions act as a persistent system prompt for every chat inside that Project. Use them to set a standing role and rules without re-typing them in each conversation.
Apps and agents built on the API
In a product — a chatbot, an internal tool, an agent — the developer sets the system prompt in code. The end user types only user prompts and never sees the rules governing the assistant.
# The system prompt is a dedicated parameter (Python SDK)
message = client.messages.create(
model="claude-opus-4-...",
max_tokens=1024,
system="You are a helpful coding assistant specializing in Python.",
messages=[
{"role": "user", "content": "How do I sort a list of dicts by key?"}
],
)Source: Anthropic prompt-engineering documentation. Use the current model string for whichever Claude model you are calling.
How to write an effective Claude system prompt
Five moves do almost all the work. Start with a role, add only the rules you actually need to change a behaviour you have seen.
1. Give Claude a specific role
One sentence sets tone and focus. "You are a customer support assistant for an accounting-software company" outperforms "You are a helpful assistant". Specificity beats length — name the job, the company type, and who the reader is.
2. State rules as positives
Tell Claude what to do, not what to avoid. Replace "don't be verbose" with "answer in 1-3 sentences, then stop". Anthropic's guidance is explicit on this: positive instructions are more reliable than prohibitions.
3. Specify the output format
If you want a particular shape, say so: "a direct answer first, then a numbered list of steps". Format drift is the most common complaint about Claude output, and it is almost always because the format was never stated.
4. Structure with XML tags
Claude is trained to read XML tags. Wrap distinct content types in their own tags — <instructions>, <context>, <examples> — so Claude can tell your rules apart from your reference data.
5. Add an escape hatch
Tell Claude what to do when it does not know: "If the answer is not in the provided documents, say so and stop." Without this line Claude tries to be helpful and may guess. One sentence removes most hallucinated answers.
Adding context helps too. Anthropic notes that explaining why a rule matters improves compliance — "answer in plain language because our readers are non-technical" works better than the bare instruction, because Claude generalises from the reason.
Four Claude system prompt templates
Fill in the bracketed slots and paste into the system field or your Project instructions. Copy the shape — the value is in the structure, not the exact words.
Customer support assistant
A role, a tone, hard limits, and an escape hatch. The escalation rule is what stops the bot from inventing policy.
You are a customer support assistant for [COMPANY], a [WHAT YOU SELL] company. Role and tone: - Friendly, concise, and practical. No corporate filler. - Answer in plain language. Assume the customer is busy. Rules: - Only answer using the information in <knowledge_base>. If the answer is not there, say so. - Never invent prices, policies, refund terms, or delivery dates. - For billing disputes, account deletion, or anything legal, do not resolve it yourself. Reply: "I'll pass this to a human agent" and stop. Output format: - A direct answer first, in 1-3 sentences. - Then any steps as a short numbered list, only if steps are needed.
Brand-voice content writer
The before/after value here is voice consistency. Without the voice rules Claude drifts to generic marketing copy by the third paragraph.
You are a content writer for [BRAND], writing for [TARGET READER].
Voice:
- Direct and concrete. Short sentences. No hype words ("revolutionary", "game-changing", "unlock").
- Write at roughly an 8th-grade reading level.
- Use the second person ("you") and active voice.
Rules:
- Lead with the reader's problem, not the product.
- Every claim needs a concrete example, number, or step behind it.
- Do not use em dashes or exclamation marks.
Output format:
- A one-sentence hook, then the body in short paragraphs of 2-3 sentences.
- End with a single, specific call to action.Document analyst (grounded answers)
This pattern forces Claude to quote before it concludes, which is the most reliable way to cut hallucinated claims on long documents.
You are a research analyst. You answer questions strictly from the documents provided. Rules: - Before answering, find and quote the passages that support your answer. - If the documents do not contain the answer, reply: "Not stated in the source documents." - Never use outside knowledge to fill gaps. Never guess. Output format: <evidence> - Quote the relevant lines, with the source name for each. </evidence> <answer> - Your conclusion, in plain language, grounded only in the evidence above. </answer>
Coding assistant (single role line)
Proof that one sentence works. This is Anthropic’s own minimal example. Add rules only when you see a behaviour you want to change.
You are a helpful coding assistant specializing in Python. - Prefer the standard library before reaching for dependencies. - Show the working code first, then a one-line explanation of the tricky part. - If a request is ambiguous, ask one clarifying question before writing code.
Need ready-made prompts rather than system-prompt scaffolding? See our Claude prompts library for task-level prompts, or build one interactively with the Claude prompt generator.
Common mistakes (and why Claude ignores you)
When a system prompt does not stick, it is almost always one of these six.
Putting standing rules in the user message
If a rule should apply to every turn — role, tone, format, hard limits — it belongs in the system prompt, not pasted at the top of each user message. Rules in the user turn read as a one-off and get diluted as the conversation grows. The system prompt is the only place that reliably persists across the whole session.
Telling Claude what not to do
Negative instructions are weak. "Do not use markdown" is less reliable than "Write your response as flowing prose paragraphs." Anthropic’s guidance is explicit: tell Claude what to do instead of what not to do. Whenever you catch yourself writing "don’t", rewrite it as the positive behaviour you actually want.
Contradicting yourself
A prompt that says "be thorough and detailed" in one line and "keep it short" in another forces Claude to pick a winner, and it may not pick yours. Read your system prompt as a single instruction set and resolve every conflict. If two rules genuinely apply in different situations, say which situation triggers which.
Stuffing reference data into the role
A 2,000-word system prompt that pastes your entire price list and FAQ buries the actual rules. Keep the system prompt to role, rules, and format. Pass bulky reference material as structured context — wrapped in XML tags like <knowledge_base> — so Claude can tell instructions apart from data, and so you can swap the data without rewriting the role.
No escape hatch
Without an explicit "if you do not know, say so" rule, Claude will try to be helpful and may fill the gap with a plausible guess. Every grounded use case — support, analysis, anything customer-facing — needs a stated fallback: what Claude should say or do when the answer is not available. This single line removes most hallucinated answers.
Letting it go stale
Model behaviour, your product, and your policies all change. A system prompt that names a deprecated feature or an old refund policy will confidently steer Claude wrong. Review system prompts when you ship a product change, and re-test them when you move to a new Claude model — newer models often need less aggressive prompting than older ones.
A note on cost and model choice
The system prompt is sent on every request, so it is billed as input tokens each turn. On a high-traffic app a long system prompt is a recurring cost, not a one-off. Two things help: keep the prompt tight, and look at prompt caching so a stable system block is not reprocessed at full price on every call.
Model choice matters too. Newer Claude models follow instructions more literally and often need less aggressive prompting than older ones — phrases like "CRITICAL: you MUST" that were needed before can cause over-triggering now. Re-test your system prompt when you change models. To estimate per-call cost across models, use our Claude prompt cost calculator.
Frequently Asked Questions
The questions people ask when they first start writing system prompts for Claude.
What is a Claude system prompt?+
A Claude system prompt is a separate instruction block that sets Claude's role, rules, tone, and constraints before the conversation starts. In the Anthropic Messages API it is passed as a dedicated `system` parameter, not as a user message. It applies to every turn of the conversation, so you define behaviour once instead of repeating it in each request. Anthropic's own guidance puts it plainly: 'Setting a role in the system prompt focuses Claude's behavior and tone for your use case.'
What is the difference between a system prompt and a user prompt?+
The user prompt is the specific request for this turn — the question or task. The system prompt is the standing context that frames how Claude should answer every request in the session: who it is, what it knows, what format to use, and what to avoid. A useful frame: the system prompt is the job description, the user prompt is the individual ticket. Put durable rules in the system prompt and the one-off ask in the user prompt.
How do I set a system prompt for Claude?+
In the Anthropic API you pass it as the `system` field on the messages.create call, alongside the `messages` array. In Claude.ai you set standing behaviour through a Project's custom instructions, which act as a persistent system prompt for every chat in that Project. In tools built on the API (chatbots, agents, internal apps) the developer sets the system prompt in code and the end user never sees it.
How long should a Claude system prompt be?+
As long as it needs to be and no longer. A single role sentence already changes output. Most production system prompts run from a paragraph to a page: role, a few hard rules, output format, and any domain context Claude cannot infer. Every line competes with the user's actual request for attention, so cut anything that is not earning its place. If a rule has never changed an output, delete it.
Can I use XML tags in a Claude system prompt?+
Yes, and Claude is specifically trained to parse them. Anthropic recommends wrapping different content types in their own tags — for example `<instructions>`, `<context>`, and `<examples>` — so Claude can tell rules apart from data. This matters most when the prompt mixes instructions, reference material, and examples. Use consistent, descriptive tag names across your prompts.
Why is Claude ignoring my system prompt?+
Usually one of three things. First, you put the instruction in a user message instead of the `system` field, so it reads as a one-off rather than a standing rule. Second, the prompt is contradictory — it tells Claude to be brief and thorough at once — and Claude picks one. Third, you used negative phrasing ('do not use markdown') which is weaker than positive phrasing ('write in flowing prose paragraphs'). Fix the channel, remove the contradiction, and state what to do rather than what to avoid.
Does the system prompt count toward token usage?+
Yes. The system prompt is sent with every request, so it is billed as input tokens on each turn of the conversation. A long system prompt that repeats on a high-traffic app adds up. This is another reason to keep it tight — and, for stable system prompts, to look at prompt caching so the repeated block is not reprocessed at full cost every call.
Want prompts that work without the trial and error?
System prompts are one layer. PromptWritingStudio teaches the full system — roles, structure, examples, and the patterns that get consistent output from Claude, ChatGPT, and Gemini — with templates you can reuse across every project.