Claude System Prompt: API, Claude Code and Published Prompts
October 29, 2026

A Claude system prompt is the set of instructions Claude reads before the conversation starts. It sets the role, the rules and the tone for everything that follows. Where you write it depends on how you use Claude:
- Claude API: the top-level
systemparameter on a Messages request. - Claude Code: four flags (
--system-prompt,--system-prompt-file,--append-system-prompt,--append-system-prompt-file), plus output styles. - Claude Agent SDK: the
systemPromptoption in TypeScript orsystem_promptin Python. - Claude apps: you can't edit the system prompt. You add instructions on top of it, account-wide or per project.
There's also the system prompt Anthropic writes for the Claude apps. Anthropic publishes it in its release notes, and it does not apply when you call the API.
Below: each of those, what Anthropic's own prompt covers, and an example system prompt you can copy and adapt.
What a System Prompt Does
Think of the system prompt as the job description, and the user messages as the tasks. The job description stays the same for the whole conversation. The tasks change.
Anthropic's prompting best practices put it simply: setting a role in the system prompt "focuses Claude's behavior and tone for your use case. Even a single sentence makes a difference."
A good system prompt usually answers four questions:
| Question | Example |
|---|---|
| Who is Claude here? | "You are a support assistant for a project-management app." |
| Who is it talking to? | "Users are small-business owners, mostly non-technical." |
| What are the rules? | "Only answer questions about our product. Never promise refunds." |
| What should answers look like? | "Short paragraphs. Numbered steps for how-to questions." |
Everything specific to one request, like the document to summarize or the bug to fix, goes in the user message instead.
The System Prompt in the Claude API
In the Messages API, the system prompt is not a message. It's its own top-level field called system. The Messages API reference describes it as "a way of providing context and instructions to Claude, such as specifying a particular goal or role," and accepts either a plain string or an array of text blocks.
Here's the shape, in Python, based on Anthropic's own example:
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
system="You are a helpful coding assistant specializing in Python.",
messages=[
{"role": "user", "content": "How do I sort a list of dictionaries by key?"}
],
)
print(message.content)
The array form matters once your system prompt gets long. Each text block can carry its own cache_control setting, so a large, stable set of instructions can be cached instead of re-processed on every call.
What the API system prompt doesn't include
When you call the API, Claude gets your system prompt and nothing else. None of the instructions from the Claude apps come along. That's why the same question can get a differently formatted answer in the app and in the API. If you want app-like behavior, you write it yourself.
System prompt tips from Anthropic's docs
The best-practices page has a few techniques that pay off most in a system prompt:
- Explain why, not just what. Anthropic's example: instead of "NEVER use ellipses," say the response will be read aloud by text-to-speech, which can't pronounce them. Claude generalizes from the reason.
- Use XML tags for structure. Wrapping sections in tags like
<instructions>or<context>helps Claude tell your rules apart from your reference material. - Show examples. A few examples in
<example>tags steer format and tone more reliably than a description. - Don't shout. The page notes that Claude Opus 4.5 and Opus 4.6 respond more strongly to the system prompt than earlier models, so "CRITICAL: You MUST..." can cause overreaction. "Use this tool when..." works better.
Anthropic's Published Claude System Prompts
Anthropic publishes the system prompts it uses in the Claude apps. They're in the system prompt release notes, with a page per model.
The release notes explain what the prompt is for: it gives Claude "up-to-date information, such as the current date," at the start of every conversation, and encourages certain behaviors, like putting code snippets in Markdown. It's updated from time to time. And the key line: "These system prompt updates do not apply to the Claude API."
The pages cover claude.ai and the iOS and Android apps. Some models have several dated entries, so you can see how the prompt changed over time. The Claude Opus 5.5 page, for example, has an entry dated September 22, 2026.
What's inside Anthropic's prompt
Reading the Opus 5.5 entry, the prompt is organized into tagged sections. Paraphrasing the main ones:
| Section | What it covers |
|---|---|
| Product information | Which model is selected, other Claude products, where to send account and API questions |
| Refusal handling | Topics Claude won't help with, and how to decline |
| Tone and formatting | A warm tone, and avoiding heavy bullets and headers in normal conversation |
| User wellbeing | How to respond to sensitive personal topics |
| Evenhandedness | How to handle political and contested topics |
| Knowledge cutoff | The model's reliable cutoff, with a placeholder ({{currentDateTime}}) for today's date |
Two practical takeaways. First, the app's default formatting habits come from this prompt, not from the model itself. Second, if you're writing your own system prompt for the API, these pages are a useful reference for how Anthropic structures one.
The Claude Code System Prompt
Claude Code ships with its own long system prompt, written for software engineering. You can add to it or replace it from the command line. The CLI reference lists the flags:
| Flag | What it does |
|---|---|
--system-prompt | Replaces the entire default prompt with your text |
--system-prompt-file | Replaces it with the contents of a file |
--append-system-prompt | Adds your text to the end of the default prompt |
--append-system-prompt-file | Adds a file's contents to the end of the default prompt |
--system-prompt-snapshot | off rebuilds the prompt on every request instead of reusing the one recorded at the start |
All of them work in both interactive and non-interactive (-p) mode. You can combine them: replace the prompt and still append extra text on top.
claude --append-system-prompt "Always use TypeScript"
claude -p --system-prompt-file ./prompts/review.txt "Review the diff in this branch"
Append or replace?
The docs give a clear rule. Append when Claude should stay a coding assistant that also follows your rules. Appending keeps the default tool guidance, safety instructions and coding conventions. Replace only when the job is genuinely different, like a non-coding agent in a pipeline nobody watches. Replacing drops all of the default prompt, so you're responsible for whatever the task still needs.
For most people, append is the right default. We go through the rest of the flags in our Claude Code CLI reference.
One more detail: by default, Claude Code records the system prompt on a conversation's first request. If you resume a session with different flag text, the change only takes effect after the conversation is compacted or in a new conversation. Use --system-prompt-snapshot off while you're iterating on wording.
Output styles: a reusable system prompt
Flags apply to one launch. For a persona you want to switch to again and again, Claude Code has output styles. An output style is "a set of instructions that sets Claude's role, tone, and response format for every response in a session."
Claude Code includes four built-in styles besides Default: Proactive, Concise, Explanatory and Learning. Switch with /output-style concise, or pick one in /config.
You can also write your own as a Markdown file in ~/.claude/output-styles/ (every project) or .claude/output-styles/ (one repo). By default a custom style leaves out Claude Code's built-in software engineering instructions. Add keep-coding-instructions: true to the frontmatter to keep them.
Where CLAUDE.md fits
CLAUDE.md is often mistaken for part of the system prompt. It isn't. Claude Code delivers CLAUDE.md content in the conversation as project context, so it works alongside whichever system prompt you choose. Put project facts and conventions there, and use the system prompt for role and behavior. More in our guide to the CLAUDE.md file.
The System Prompt in the Claude Agent SDK
The Agent SDK runs the same engine as Claude Code, but its default is different. Per the SDK's system prompt guide, you have three starting points:
| Starting point | How to set it | What you get |
|---|---|---|
| Minimal default | Leave systemPrompt / system_prompt unset | Tool-calling support only, without Claude Code's security and safety instructions |
claude_code preset | type: "preset", preset: "claude_code" | The full Claude Code prompt, optionally with append |
| Custom string | Pass your own text | Only what you write |
The gotcha: the minimal default "differs from claude -p, which uses the Claude Code system prompt by default." If you move a CLI script into the SDK and behavior changes, this is usually why. Set the preset to match.
The lowest-risk customization is the preset plus append. In Python:
from claude_agent_sdk import ClaudeAgentOptions
options = ClaudeAgentOptions(
system_prompt={
"type": "preset",
"preset": "claude_code",
"append": "Always include docstrings and type hints in Python code.",
}
)
If you write a fully custom prompt, the docs recommend adding a sentence explaining that the application adds system reminders, since your string replaces the preset that normally says so. Our Claude Agent SDK guide covers the rest of the setup.
Project Instructions and Preferences in the Claude Apps
In claude.ai, the desktop app and the mobile apps, you can't see or replace the system prompt. You can stack your own instructions on top. Anthropic's personalization guide describes the main layers:
- Instructions for Claude (account-wide). Set under Settings, then Your Claude. They apply to all your conversations.
- Project instructions. Set inside a project. Per the guide, "These instructions only apply to chats within that project."
- Styles. Anthropic's own published prompt notes that writing style is customized through the style feature.
Project instructions are the closest thing the apps have to a custom system prompt. Projects come up often in the "custom GPT" debate too, which we covered in Claude Projects vs Custom GPTs.
An Example Claude System Prompt
Here's a system prompt for a hypothetical support assistant. It uses the patterns above: a clear role, an audience, rules with reasons, XML structure and a format.
You are the support assistant for Acme Tasks, a project-management
app for small teams.
<audience>
Users are small-business owners and office managers. Most are not
technical, so avoid jargon and explain any setting by where it is
in the app.
</audience>
<rules>
- Only answer questions about Acme Tasks. For anything else, say
it's outside what you can help with.
- Never promise refunds or discounts. Billing decisions are made
by the billing team, so point users to the billing contact form.
- If you don't know an answer, say so. A wrong answer costs the
user more time than "I'm not sure."
</rules>
<format>
Start with the direct answer in one or two sentences. For how-to
questions, follow with numbered steps. Keep replies under 150
words unless the user asks for more detail.
</format>
Paste it into the API's system field, save it as a file for --system-prompt-file, or adapt it as project instructions in the app.
FAQ
What is the Claude system prompt?
It's the instructions Claude reads before a conversation starts. In the apps, Anthropic writes it. In the API, Claude Code and the Agent SDK, you can write or extend your own.
Can I see Claude's system prompt?
Yes, for the apps. Anthropic publishes the claude.ai and mobile app system prompts in its release notes, with a page per model and dated entries.
Does Anthropic's published system prompt apply to the API?
No. The release notes say the updates "do not apply to the Claude API." The API uses only the system text you send.
How do I set a system prompt in Claude Code?
Use --append-system-prompt to add rules to the default prompt, or --system-prompt to replace it. Both have -file versions that read from a file. For a reusable persona, create an output style.
What is the Claude Code system prompt?
It's Claude Code's built-in prompt, focused on software engineering, tool use and safety. The Agent SDK exposes it as the claude_code preset.
Is CLAUDE.md part of the system prompt?
No. Claude Code delivers CLAUDE.md as project context in the conversation, separate from the system prompt.
Can I change the system prompt in claude.ai?
Not directly. You can add account-wide instructions, project instructions and a writing style, which Claude follows on top of Anthropic's prompt.
The Short Version
- API: use the top-level
systemfield. A one-sentence role already helps. - Anthropic's app prompt is public in the release notes, and it doesn't apply to the API.
- Claude Code: append with
--append-system-prompt, replace only for non-coding jobs, and use output styles for reusable personas. - Agent SDK: the default is minimal. Use the
claude_codepreset to match the CLI. - Apps: project instructions are the closest thing to a custom system prompt.
A good system prompt is a small piece of work worth keeping, and most of them end up lost in a terminal history or an old chat. Taku is an AI-native desktop workspace where you can save a setup that works and run it again next week instead of rebuilding it from memory. Taku is in Beta, and the Mac app is available now.