Course Content
Prompt Engineering Mastery
6 sections · 32 lessons
What is the difference between a system prompt and a role prompt?
What you need to know
Chat APIs split input into messages, each with a role. The system prompt is sent in its own field.
1{2 "system": "You summarise contract clauses for the in-house legal team at a Bengaluru SaaS company. Flag any obligation that has a deadline or a penalty.",3 "messages": [4 {"role": "user", "content": "Summarise this clause: ..."}5 ]6}System prompt
It is the right place for rules that must survive the whole conversation: "answer only from the provided documents", "always return JSON", "never discuss competitors' pricing". Because the user does not write it, it is harder — not impossible — for the user to override.
Role prompt
A role prompt assigns a persona: "You are a senior tax accountant." It nudges the vocabulary, level of detail and point of view. It can live in the system prompt or in a user message.
How the two relate
| System prompt | Role prompt | |
|---|---|---|
| What it is | A message slot with high priority | A technique (a persona) |
| Who writes it | The developer | Anyone |
| Lifetime | Whole conversation | Wherever it is placed |
| Typical content | Job, rules, format, safety | "You are a..." |
What matters in 2026
"You are a helpful assistant" alone adds almost nothing. A one-line role is a fine focus-setter, but what changes the output is the context behind it: who reads the answer, what they will do with it, and what the quality bar is.
A real-life example
A legal-tech team builds a clause summariser. Version one:
System: You are an expert lawyer.User: Summarise this clause. <clause text>Summaries are long, full of legal terms, and miss the payment deadline buried in sentence four. Version two keeps a short role but adds the context only the team knows:
System: You summarise contract clauses for non-lawyer account managersat a SaaS company. They need to know what we must do, by when, and whathappens if we miss it.Write 3 bullets in plain English: obligation, deadline, penalty.If a bullet does not apply, write "none stated".Never give legal advice; add "Check with Legal before acting" at the end.Now each summary is three short bullets, the 30-day payment deadline appears every time, and the disclaimer is never forgotten because it lives in the system prompt, not in each user message.
Follow-up questions to expect
- "Can a user override the system prompt?" — They can try, through prompt injection. Models are trained to prefer system instructions, but that is a strong default, not a guarantee, so critical rules also need checks in code.
- "Where do retrieved documents go?" — Usually in the user turn, wrapped in tags and marked as data, not in the system prompt — they are untrusted content, not developer instructions.
- "Does role prompting improve accuracy?" — It changes style and focus; it does not add knowledge the model lacks. Specific context improves accuracy more.