Overview

A system prompt (also called a system message) is the operator-level instruction sent separately from the conversation that sets the model’s role, rules, tone, output format, and tool policy for a session. Claude takes it in the top-level system parameter; OpenAI’s API takes an instructions parameter or a developer message, which ranks above user messages.

Put rules that must hold for the whole session in it and keep per-request data in user turns. Models weight it above user text but not absolutely, so do not rely on it to stop prompt-injection, and do not put secrets in it, since a determined user can extract it. Treat it as code: version it, review changes, and test against real transcripts.

Start with a one-sentence role (“role priming”). Anthropic’s guidance is that even one sentence in the system prompt focuses tone and behavior. A role shifts style and emphasis; it does not add knowledge, so pair it with explicit rules and the output format.

Editing the system prompt mid-conversation invalidates the prompt-cache. On models that support it (including Opus 5.5, Sonnet 5.5, and Fable 5.1, but not Sonnet 5), append a {"role": "system"} message to messages instead.

Example

You are a SQL analyst for a sales dashboard.
- Answer only questions about the sales schema.
- Return queries in ```sql blocks.
- For other schemas, reply: "Out of scope."