System Prompts Explained
The system prompt sets who the model is and how it behaves across a whole conversation. Designed well, it does the work you would otherwise repeat in every message.
A system prompt is the instruction that sits above the conversation. The user turn is what you ask right now; the system prompt is the standing brief that applies to every turn. Used well, it carries the role, the rules and the defaults so you never have to repeat them in individual messages.
What belongs in a system prompt
Put the things that should be true for the whole conversation: the model's role, its tone, hard constraints it must never break, and any output defaults. Keep the per-task details out; those go in the user turn.
| System prompt | User turn |
|---|---|
| Role and persona | The specific request |
| Tone and style rules | The data to act on |
| Always-on constraints | One-off instructions |
| Default output format | Overrides for this task |
You are a SQL assistant for a Postgres database.
- Only output SQL, never prose explanations unless asked.
- Never write a query that modifies data unless the user says so.
- Money columns are integer cents; never divide by 100 in SQL.
- If a request is ambiguous, ask one clarifying question first.Write rules the model can obey
Vague aspirations do nothing. "Be helpful" is not a constraint. "Never modify data without explicit permission" is something the model can actually check itself against. Phrase each rule as a clear, verifiable behavior.
It differs by tool
Every tool exposes the system prompt a little differently, but the idea is the same. In the API you pass a system field. In a coding agent the standing instructions live in a memory file like CLAUDE.md or AGENTS.md that is loaded on every turn. In a chat UI it is the custom instructions box. Same job, different doorway.
- API: the system parameter on the request.
- Coding agents: a project memory file that loads automatically.
- Chat apps: the custom instructions or persona settings.
Keep it lean
A system prompt is read on every turn, so every line costs tokens and attention forever. Cut anything that does not change behavior. A tight system prompt that prevents real mistakes beats a long one full of advice the model already follows.
How to design one
- Name the role and the audience in one or two lines.
- List the hard constraints as verifiable behaviors.
- Set the default output format.
- Move per-task detail out into the user turn.
- Delete any line that does not change the output.
Treat the system prompt like code you maintain. When the model makes the same mistake twice, add a precise rule. When a rule stops mattering, remove it. A well-kept system prompt is the cheapest, most durable upgrade you can make to a model's behavior.
Claude prompt engineering overviewBackground on system prompts, roles and how standing instructions shape behavior.platform.claude.com0 Comments
Loading discussion...