Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Every serious chat API has three roles. If you use them right, your prompt gets dramatically more reliable. If you cram everything into 'user', you fight the API.
System — durable instructions. Tone, persona, what the model is for, what it never does. Set once, persists.
User — the actual turn-by-turn input. What the human just said or pasted.
Assistant — the model's previous responses (the API sees these as context).
Example structure:
[
{ "role": "system", "content": "You are a careful code reviewer. Never approve code with unhandled errors." },
{ "role": "user", "content": "Please review:\n```js\nconst x = JSON.parse(input)\n```" }
]Putting the reviewer persona in the system message means every subsequent user turn inherits it — you don't have to re-specify.
In your playground, write a system message: "You answer only in rhyming couplets." Then in user, ask a normal business question. Notice how the persona holds across turns.
Design a system prompt for an AI that helps me proofread emails for passive-aggressive tone.
It should:
- Read the draft I paste.
- Flag phrases that could read as passive-aggressive.
- Offer neutral rewrites.
- Never add emoji.
Output only the system prompt text, ready to paste.