In one line: The system prompt is the instruction that sits at the start of the conversation and stays in effect the whole time — it tells the model "who you are, what to do, how to sound, what format to emit." It is the single strongest lever on model behaviour.
What it is#
OpenAI / Anthropic / Chinese chat APIs all use three message roles:
[
{ "role": "system", "content": "You are a strict SQL reviewer..." },
{ "role": "user", "content": "Please review this SQL: ..." },
{ "role": "assistant", "content": "This query has 3 issues..." }
]The system message appears once (at the front), but its influence runs through the entire conversation. Whatever follows is filtered through the role the system prompt set.
Analogy#
The system prompt is the character sheet handed to an actor: "you play a haughty 1920s British detective." Every line afterwards is bounded by that page. User messages are the audience's questions; assistant messages are the actor's reactions — change the character sheet and the whole show changes flavour.
Key concepts#
What a good system prompt looks like#
[Role] You are a …
[Goal] Your task is to …
[Constraints]
- Must …
- Never …
[Output format]
- Use markdown, with this structure:
- Summary (≤ 50 words)
- Detailed analysis (bulleted)
- Recommendations (≤ 3 items)
[Fallback] If information is insufficient, reply "need more information" and list required fields.Practical notes#
- Specific beats vague. "Please use a professional tone" is worlds weaker than "use third person, avoid subjective adjectives, cite papers with DOI."
- Don't stack instructions. Three to five core constraints work best. A dozen will fight each other and the model "obeys whichever it likes."
- Format > prose. When you need JSON, paste an example schema — it's far more precise than describing it in words.
- Add fallback branches. "If the user asks X, answer Y" is the most stable pattern, but don't overdo it or you'll induce hallucinations.
- Sandbox the user input. Wrap user content in
<input>...</input>style tags to defend against "ignore the previous instructions" prompt injection.
Easy confusions#
Set once, governs the whole session.
A fresh query every time.
Further reading#
- Few-Shot — should examples go in the system or user message?
- Temperature & Top-P — pair the system prompt with low temperature for stability
- CoT — "let's think step by step" is the cheapest system-prompt boost there is