Chapter 5 · Part 2

The anatomy of a great prompt

For a quick question, a quick prompt is fine. But when the output matters — a prompt you'll reuse, a task you'll delegate daily, the instructions inside a product — professionals stop writing messages and start writing specs. And well-built prompts converge on the same six blocks.

Scroll to assemble one.

Role: who the model should be. It sets vocabulary, priorities and taste in one line.

scroll

The six blocks

  • Role — "You are a senior support engineer." Frames every choice the model makes, from vocabulary to what it treats as important.
  • Context — the background facts. The block most prompts starve.
  • Task — one clear instruction. If you have two tasks, consider two prompts.
  • Examples — a worked input → output pair, as in Chapter 3.
  • Format — the shape of the output: sections, length, JSON keys, code style.
  • Guardrails — behavior at the edges: "If you're not sure, say so — don't invent details." One line like that is your best defense against hallucinations.

One more habit separates clean prompts from confusing ones: delimiters. When your prompt mixes instructions with data — a ticket to answer, an article to summarize — fence the data off with markers like ### or XML-style tags so the model never mistakes content for commands.

the assembled spec
You are a senior support engineer for a B2B invoicing API.

Context: the customer is on the Pro plan. Yesterday's
outage lasted 2 hours and is fully resolved.

Task: draft a reply to the ticket between the ### marks.

Example of our tone: "Hi Sam — you're right, we dropped
the ball here. Here's exactly what happened…"

Format: under 150 words. Greeting → cause → fix → next step.

If you're not sure of a technical detail, say so rather
than inventing one.

###
Subject: API down AGAIN?!
Your API returned 503s all morning. We bill our own
customers through you. What is going on?
###

You've been reading system prompts all along

Here's the fun part: every serious AI product is built exactly this way. ChatGPT, Claude, your IDE's copilot — each one wraps your message in a hidden system prompt with precisely these blocks: a role, context, rules, format, guardrails. The people who write those are doing prompt engineering as a job, and the document they produce looks like a longer version of the spec above.

Which raises the question: how do they know their prompt works? They test it — and that loop is the final chapter.