Phase 1 · FoundationsModule 4~34 min read

The Anatomy of a Prompt

Every strong prompt is built from the same handful of parts: role, instruction, context, input data, examples, and an output specification. Learn each one and how they fit together.

What you'll learn

Strong prompts don't look random — they're assembled from the same handful of parts, over and over. Once you can spot the six building blocks, writing a good prompt becomes less like guessing and more like filling in a form: role, instruction, context, input data, examples, and output format.

By the end of this module you'll be able to:

  • Name the six building blocks of a prompt and what each contributes
  • Tell apart the system, user, and assistant roles
  • Read a real, complete prompt and identify every part inside it
  • Assemble your own prompts from a reusable template

The six building blocks

Not every prompt needs all six — a quick question might be one line — but the more a task matters, the more of these you'll want to include. Think of them as dials: add the ones that remove uncertainty for your task.

What every strong prompt is made of
1

Role

Who the model should be — its expertise and point of view.

e.g. You are a senior copy editor.

2

Instruction

The task itself: the single most important line.

e.g. Fix grammar and tighten the wording.

3

Context

Background and rules the model needs to do it well.

e.g. Audience is busy executives. Keep the meaning.

4

Input data

The specific content to act on, clearly separated.

e.g. The paragraph to edit (in quotes).

5

Examples

One or more demonstrations of the task done right.

e.g. before → after pair (optional).

6

Output format

Exactly how the answer should be shaped.

e.g. Return only the edited paragraph.

Role and instruction are the backbone; context, data, examples, and format are what turn a decent answer into the right one.

Key idea

If a prompt is underperforming, walk the six blocks and ask which one is missing. Nine times out of ten the fix is a clearer instruction or a specified output format.

System, user & assistant

Modern chat models don't receive one blob of text — they receive a list of messages, each tagged with a role. Understanding the three roles explains where each building block belongs.

RoleWho it isWhat goes here
systemThe developer / you, setting the stagePersistent role, rules, and context that apply to the whole conversation
userThe person talking to the modelThe actual request or question, plus the input data for this turn
assistantThe model's own repliesPrevious answers — kept so the model remembers the conversation
The system message is your highest-leverage tool for behavior that should persist across every turn (Module 6).

Note

In a simple chat box you only type the user message, and the app supplies a hidden system message. Through the API (Phase 6) you control all of them yourself.

Assembling a complete prompt

Let's put every block together in one realistic prompt. Read it top to bottom and notice how each labeled section maps to a building block — and how delimiters (the headings and the triple quotes) keep the model's instructions cleanly separated from the data. Press See response to reveal a typical result.

support-triage.txt
# ROLE
You are a senior customer-support specialist for TaskFlow, a project-management app.

# INSTRUCTION
Classify the customer message by urgency, then draft a one-sentence reply.

# CONTEXT
- Support hours are 9am-5pm ET, Monday to Friday.
- Billing and refunds are handled at billing@taskflow.app.
- Never promise a specific refund amount.

# EXAMPLE
Message: "I was charged twice this month!"
Output: {"urgency": "high", "reply": "So sorry about the double charge - I've flagged it to our billing team at billing@taskflow.app, who will make it right."}

# CUSTOMER MESSAGE
"""
Hi, I can't log in since the update this morning and I have a client demo in an hour. Help!
"""

# OUTPUT FORMAT
Return only JSON: {"urgency": "low" | "medium" | "high", "reply": string}
All six blocks in one prompt: role, instruction, context, an example, the input data, and a strict output format.

Because the prompt fixed the role, rules, example, and output shape, the reply is immediately usable by software — valid JSON, correct urgency, and an on-brand message. Compare that with the shortcut version most people actually type:

✗Weak prompt

Prompt

help with this support message: can't log in and I have a demo in an hour

Response

I'm sorry to hear you're having trouble logging in! There can be several reasons this happens. First, could you tell me which device and browser you're using? In the meantime, here are eight general troubleshooting steps you can try…
✓Strong prompt

Prompt

[the full role + instruction + context + example + data + output-format prompt above]

Response

{ "urgency": "high", "reply": "I hear you — with a demo in an hour, let's get you back in fast: please try a password reset, and I'm escalating your login issue right now." }
Same request, same model. The assembled prompt returns structured, on-brand output a program can use; the one-liner returns a generic wall of text.

Tip

Keep a personal template with the six headings and delete the blocks you don't need. Starting from a checklist beats starting from a blank box — you'll forget the output format far less often.

Recap & quick check

Key takeaways

  • Strong prompts are built from six blocks: role, instruction, context, input data, examples, and output format.
  • You don't always need all six — add the blocks that remove uncertainty for your task.
  • Chat models read a list of messages tagged system, user, or assistant.
  • The system message sets persistent role, rules, and context; the user message carries this turn's request and data.
  • Delimiters (headings, quotes, tags) separate instructions from data and keep the prompt unambiguous.

Quick check

1. Which pair is the 'backbone' every prompt should almost always include?

2. In the messages format, what belongs in the SYSTEM message?

3. Why did the assembled support prompt return clean JSON while the one-liner returned a wall of text?

4. What is the main job of delimiters like headings or triple quotes in a prompt?

That completes the foundations: you know what prompting is, how the model works, how tokens and the window constrain it, and the anatomy of a prompt. Now the real craft begins. Next up: Phase 2, Module 5 — Writing Clear Instructions.