Spec-Driven Dev
Prompt Engineering·Module 0 · Start Here·L0·35 minInstruct

What a Prompt Is (and Is Not)

How a language model produces text, the three kinds of material in a request, what belongs in the system prompt versus the user turn, and why a prompt is code.

What you'll learn
  • Explain in one sentence how a language model produces a reply, and why that makes prompts matter.
  • Name the three kinds of material in a request: instructions, context, and data, and say where each goes.
  • Tell the system prompt from the user turn, and say what belongs in each.
  • Explain why "be helpful" and "be accurate" do nothing.
  • State the course's one-liner: a prompt is code; treat it like code.

Why this matters

Omar ships the first version of Draft, the Shelf feature that writes a reply to a customer email for a store manager to approve. Its system prompt is one line: "You are a helpful assistant for Bramble Books. Reply to the customer's email." Tessa, who manages the Elm Street store and reads every draft before it goes out, reviews the first ten. Three promise refunds Bramble does not give. Two apologize for delays that did not happen. One addresses the customer by the wrong name, because the email was signed by a spouse. Tessa sends them back with one note: "Which of these did you want?" Omar has no answer. Nothing in the prompt said what a good reply was.

1. The model predicts

A language model is a program that writes text by predicting the next piece of text, given everything that came before it. It reads the request, picks the most likely next fragment, appends it, and repeats until it decides to stop. That is the whole mechanism. There is no lookup into Bramble's database, no memory of the email it answered yesterday, and no goal beyond continuing the text well.

A prompt is the text you put in front of the model to steer that continuation. It is not a command the model obeys. It is the start of a document the model finishes.

2. Three kinds of material

Every request is made of three kinds of material. An instruction tells the model what to do. Context is a fact the model needs and would not otherwise have. Data is the thing the model is working on. Each has a different job, and each goes in a different place.

Why separate them? Because the model cannot tell them apart on its own. A data block is a labeled region of the request that holds data. Wrapping the email in <email> and </email> tags makes a data block, and the model treats the inside as something to work on rather than something to obey.

3. System prompt and user turn

A request has two parts you control. The system prompt is a block of standing instructions that applies to every call: who the model is writing as, what it may and may not do, what the output looks like. The user turn is the message for this call: the context and data for this one email, and the question you want answered.

The system prompt changes when Bramble's policy changes, which is rare. The user turn changes on every call. One file, prompts/draft.system.md, holds the rules, and the code in src/llm/draft.ts fills the user turn from the database.

In code, the two parts are two fields of the same call:

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic(); // reads ANTHROPIC_API_KEY

const response = await client.messages.create({
  model: "claude-opus-5",
  max_tokens: 1024,
  system: [
    { type: "text", text: DRAFT_SYSTEM_PROMPT, cache_control: { type: "ephemeral" } },
  ],
  messages: [
    { role: "user", content: `<order>\n${orderJson}\n</order>\n<email>\n${emailText}\n</email>\n\nDraft the reply.` },
  ],
});

const reply = response.content
  .filter((b) => b.type === "text")
  .map((b) => b.text)
  .join("");

The system field carries the standing instructions. The messages array carries this call's user turn. Other providers and gateways have equivalents; the split is the same everywhere.

4. Why "be helpful" does nothing

Omar's first prompt said "helpful." Every reply was, in the model's terms, helpful. Promising a refund is helpful. The word did not fail; it carried no information. The model was already producing the most helpful-looking continuation it could.

An instruction carries information when it would change the output. That is the test. Read each line of a prompt and ask: if I deleted this line, would some reply come out differently? If the answer is no, the line is decoration.

The pattern holds for "be professional," "be concise," and every other wish. L1 is about turning wishes into instructions, and this test is the tool.

5. Tokens and the window

The model does not read words. It reads tokens, short fragments of text, often a word or part of one. "Bramble" might be one token or two; "#4471" is probably three. Every token in the request costs money and time, and every token the model writes costs more.

The context window is the maximum number of tokens the model can hold at once, request and reply together. Everything in the request competes for that space and for the model's attention inside it. More text is not more guidance. It is more to attend to, and the line that matters gets a smaller share.

The fix is selection, not size. Put in the facts this task needs and leave out the rest. L2 covers how to choose.

6. Temperature and variation

Run the same prompt twice and you may get two different replies. Temperature is a setting that controls how much randomness the model uses when choosing the next token. Low temperature takes the most likely fragment nearly every time; higher temperature samples among the likely ones. Even at low temperature, small differences appear from run to run. A prompt does not have one output. It has a distribution of outputs, and the question is whether every output in it is acceptable.

So you cannot check a prompt by comparing its output to one expected string. You check whether each output meets criteria: names the exchange policy, quotes no refund amount, uses the first name. L5 builds that test. For now: one good run proves little, and one bad run proves a lot.

7. A prompt is code

The course's one-liner: a prompt is code; treat it like code. The Draft system prompt determines what Bramble says to its customers. A change to it is a change to product behavior, so it belongs where product behavior lives: in the repository, in a named file, in a pull request someone reads, with a test that runs before it merges. The course maps that onto three verbs.

VerbThe questionLessons
InstructWhat should the model do, for whom, with what facts, and what should it do when it cannot?L0, L1, L2
StructureHow do you shape the input so data stays data, and the output so code can trust it?L3, L4
IterateHow do you know a change made things better, and when is the prompt the wrong tool?L5, B1

Summary

  • A language model writes the most likely next token given everything before it; a prompt steers that continuation, it is not a command the model obeys.
  • Every request holds instructions (what to do), context (facts it needs), and data (the thing to work on), and each must be labeled so the model can tell them apart.
  • The system prompt holds standing instructions for every call; the user turn holds this call's context and data, with the question last.
  • An instruction earns its place only if deleting it would change some reply; "be helpful" and "be accurate" change nothing.
  • Tokens cost money and compete for a finite window, temperature means one prompt yields many outputs, and both are reasons to treat a prompt as code: versioned, reviewed, and tested.

Key terms in this lesson

Check your understanding

Pick an answer to see why it is right or wrong. These are graded in code, instantly.

1.How does a language model produce a reply to a customer email?
2.In case DR-1, a customer writes about a torn cover on order #4471. Which part of the request is context?
3.Which of these belongs in Draft's system prompt rather than in the user turn?
4.Why does the instruction "be accurate" add nothing to Draft's prompt?
5.Nadia wants to paste the forty-page policy handbook into the Draft system prompt. Why is longer not better?
6.Omar runs the same DR-1 prompt three times and gets three differently worded replies. What should he conclude?

Apply it

Write your answer in your own words. Eve grades it against a rubric and gives you feedback, the same way an LLM judge works in Lesson 5.

Short answerGraded by Eve · 4 criteriaup to ~150 words

Take one instruction from a prompt you have seen (or from Omar's first Draft prompt) and say whether deleting it would change the output. If it would not, rewrite it so it would.

0 words
Free responseGraded by Eve · 6 criteria

Rewrite Omar's first Draft system prompt ("You are a helpful assistant for Bramble Books. Reply to the customer's email.") into five instructions that would each change a reply to DR-1, and say what each one prevents.

0 words
Instructor notes(for whoever is teaching this lesson)

Talking points

  • Tessa's ten drafts are the thread. Ask the room which line in the one-line prompt caused each failure. No line did, and that is the lesson.
  • The model predicts the next token. Say it once and return to it in every section: instructions steer prediction, wishes do not, tokens compete, temperature samples.
  • Three kinds of material: instruction, context, data. Students will call the order record "data." Push back: data is the thing worked on (the email); context is the fact needed to work on it (the record).
  • System prompt versus user turn is a maintenance decision. Standing rules in a file Tessa can read; per-call facts built by code.
  • The deletion test is the tool to take away: if removing a line changes no reply, it is decoration. Run it live on "be helpful."
  • Close on the one-liner: a prompt is code; treat it like code. The three verbs are the course map.

Live demo idea

Open a scratch script using the client.messages.create shape from section 3. Send the DR-1 email with Omar's one-line system prompt and read the reply aloud; it will probably promise something. Swap in the five-line system prompt and send again. Then send it three times in a row and put the replies side by side. Ask: which criteria do all three meet? That question is the seed of L5. If time allows, paste a long irrelevant policy block into the system prompt and show the reply getting worse and slower.

Common misconceptions

  • "The model looks things up." It does not. Order #4471 is unknown to it until the record is in the request. L2 builds on this.
  • "More instructions means safer output." Every line competes for attention. A long rule list is followed less reliably than a short one.
  • "The system prompt is for important text and the user turn is for chat." Both are read equally. The split is about what changes per call.
  • "If the output varies, the prompt is broken." Variation is normal. The test is whether every output meets the criteria.
  • "Setting temperature to zero makes it deterministic." It reduces variation but does not remove it across versions or days.

Timing

Thirty-five minutes: story and section 1, six; three kinds of material, five; system prompt and user turn with the code, seven; why "be helpful" does nothing, five; tokens and the window, four; temperature, four; a prompt is code and the verb table, four.

If you only have 20 minutes

Run the live demo with the one-line and five-line prompts (eight minutes), teach the deletion test on "be accurate" with the delivery-date rewrite on screen (six minutes), and close with the three-verb table and the one-liner (six minutes). Assign sections 5 and 6 as reading.