Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Write a prompt in four parts

Use when: you're writing a prompt for a task you want to work reliably, not just once by luck

Goal: a prompt that states what to do, gives the model everything it needs, and leaves as little as possible to guesswork

Taught in Instructions, context, examples, and constraints

  1. 1

    Write one clear sentence naming the task itself -- the verb the model should perform.

    Example

    "Summarize the following support ticket in one sentence."

    Why: everything else in the prompt exists to help the model carry out this one instruction; without it, there is no task to do.

  2. 2

    Add the actual information the model needs but does not already have. This is the real text, data, or background -- kept clearly separated from the instruction.

    Example

    "Ticket: 'My order #4471 never arrived, and it's been two weeks.'"

    Why: an instruction with nothing to act on forces the model to invent the missing information. That is a failure mode of its own -- Chapter 22 names it hallucination.

  3. 3

    If more than one reasonable format, length, or style could satisfy the instruction, show one or two worked input-output pairs.

    Example

    "Ticket -> 'Refund requested for a late order.' " as a model example of the exact style wanted.

    Why: an instruction alone describes the task. An example additionally pins down its shape -- something words often can't fully specify (Section 2 covers this technique in depth).

  4. 4

    Name every boundary the output must respect, as specifically and checkably as possible.

    Example

    "Output exactly one sentence, no more than 20 words. Do not include the customer's name."

    Why: an unstated boundary isn't enforced. It's simply left to whatever the model happens to do -- which varies run to run.

Common mistakes

  • Folding a constraint into the instruction sentence itself ("Summarize this briefly and professionally") instead of stating it separately and specifically. "Briefly" is not checkable; "under 20 words" is.
  • Supplying context without ever telling the model what to do with it. Pasting a document with no instruction leaves the task itself undefined.
  • Treating an example as optional decoration, rather than the fastest way to remove ambiguity a sentence of instructions can't fully resolve.
  • Writing constraints as a wish list at the end, instead of boundaries the output must actually satisfy. If it isn't checkable, it usually isn't being enforced.