System Prompts

Write the standing instructions behind every reply in a chat app: audience, job, facts, rules with reasons, and what to do when a question is out of scope.

14 minLesson 6 of 8
On this page
  1. Where the system prompt lives
  2. A thin system prompt, and what it costs
  3. What goes in, and what does not
  4. Try it yourself
  5. Common mistakes
  6. Check yourself
  7. What to practise next

A café hires a new barista. Before the first shift, the manager spends ten minutes on a briefing: who the regulars are, that the oat milk ran out, never to promise a table for later, and to call the manager if anyone complains about an allergy. Nobody repeats that briefing before each order. It just shapes everything the barista does all day.

A system prompt is that briefing for a model. It is the set of instructions that sits behind a whole conversation, written once by whoever builds the app, and applied to every message a user sends.

Where the system prompt lives

Most chat tools and model APIs split a conversation into roles. The system message holds standing instructions. The user messages are what the person types. The assistant messages are the model's replies.

One detail explains a lot: a model does not remember earlier requests. Every time the user sends a message, the app (or the service behind it) feeds the model the whole conversation again, with the system prompt at the top. So the system prompt is not a setting the model learned once. It is text the model reads fresh on every single turn.

Request 1 Request 2 Request 3 system user 1 system user 1 reply 1 user 2 system user 1 reply 1 user 2 reply 2 user 3 The conversation grows; the system prompt stays at the top of every request.
Each request resends the system prompt and the conversation so far. The system prompt is the one part that is always there.

Many models are also trained to give the system message more weight than the user's messages. That makes it the right home for anything that should apply to every reply.

A thin system prompt, and what it costs

Here is a garden centre's chat assistant with the kind of system prompt many first versions have.

Thin system promptIllustrative example. Real replies vary.
System prompt
You are a helpful assistant for Fernbrook Garden Centre. Be friendly.
You
Is it too early to plant tomatoes outside? Also, do you deliver to Ashford?
Model
Great question! It's usually best to wait until after the last frost, typically late spring, before planting tomatoes outside. And yes, we deliver to Ashford! Delivery is usually free on orders over £50, and you can choose a delivery slot at checkout.

The gardening advice is fine. The delivery answer is invented. The model was told to be a helpful assistant for a shop, so it produced what a helpful shop assistant typically says. Nothing in the prompt told it the real delivery area, or what to do when it did not know.

Briefed system promptIllustrative example. Real replies vary.
System prompt
You answer questions in the chat window on the Fernbrook Garden Centre website. Most people asking are home gardeners, often beginners, on their phone. Your job: help with plant care questions and questions about the centre. Keep answers under 100 words unless the person asks for more detail. Facts about the centre: - Open 9:00 to 17:00 every day except Monday. - We deliver only within 10 miles of the centre (postcodes FB1 to FB4). Delivery costs £8, free over £60. - We do not sell or deliver live animals or pond fish. Rules: - Only state facts about the centre that are listed above. If asked about the centre in any other way (stock, prices, other areas), say you are not sure and give the phone number, 0100 555 0199. A wrong answer about delivery leads to angry customers, so it is better to say you don't know. - For pesticide or plant-poisoning questions involving children or pets, give general advice and recommend contacting a doctor or vet, because we cannot judge a medical situation over chat.
You
Is it too early to plant tomatoes outside? Also, do you deliver to Ashford?
Model
Tomatoes hate cold, so wait until there's no risk of frost and nights stay above about 10°C. In many places that's late spring. If you plant earlier, keep a fleece handy for cold nights. For delivery, we cover postcodes FB1 to FB4, within 10 miles of the centre. I'm not sure whether that includes Ashford. Our team can check for you on 0100 555 0199.

The second version reads like the café briefing: users, job, facts, and rules with reasons. The most useful line says what to do when the answer is not in the briefing.

What goes in, and what does not

Good things to put in a system prompt:

  • Who the users are and what they usually need.
  • The job and its edges. What the assistant is for, and what it should hand off.
  • Reference facts it should use instead of guessing: hours, policies, product names.
  • Defaults for format and tone: length, language, whether to use lists.
  • The fallback: what to say when it does not know or should not answer.

Things that do not belong there:

  • Secrets. Users can often get a model to repeat or paraphrase its system prompt. Never put passwords, keys or private data in it.
  • Your only line of defence. "Never give discounts" is a strong hint, not a lock. If a rule must hold, enforce it in code as well, for example by having your own system check discount codes. Prompt Injection explains why.
  • Everything you have. A 40-page manual pasted in "just in case" buries the rules that matter. Include what most conversations need.

Try it yourself

Try it: Brief the homework helper

This system prompt is for an app that helps 9 to 11 year olds with maths homework. In testing, the assistant just gives children the answers, uses words they don't know, and writes long paragraphs. Rewrite the system prompt.

Show a sample answer
Rewritten system promptIllustrative example. Real replies vary.
System prompt
You help children aged 9 to 11 with maths homework in a learning app. They type on a tablet, often with a parent nearby. Your goal is for the child to understand, not to finish the sheet. So: - Do not give the final answer to a homework question. Give one hint or one small step at a time, then ask the child to try. - If the child's answer is right, say so and briefly say why it works. If it is wrong, point to the step where it went wrong without fixing it for them. - Use short sentences and words a 9 year old knows. Use objects like sweets, coins or pizza slices for examples. - Keep each message under 50 words. If the child asks about something that is not maths, say kindly that you can only help with maths. If a child says something that suggests they are hurt, scared or unsafe, tell them to talk to a parent, teacher or another adult they trust.
You
whats 3/4 of 20
Model
Let's work it out together. 3/4 means split into 4 equal parts and take 3 of them. Imagine 20 sweets shared between 4 friends. How many sweets does each friend get?

Why it works: it names the audience, which sets vocabulary and length. It states the goal (understanding) and gives the rule that follows from it (hints, not answers), so the model can handle cases you did not list, such as a child asking "just tell me". It covers the two situations outside the job: off-topic questions and a child who may need help.

Common mistakes

Check yourself

Quick check

Why does the system prompt affect the tenth reply in a conversation as much as the first?

The thin system prompt led the model to invent a delivery policy. What was the most important missing piece?

Which of these should stay out of a system prompt?

What to practise next

Your system prompt will still misbehave on some inputs. Debugging Prompts shows how to find out why and fix it without breaking what already works.