Lesson 2 / 12 · 11 min
Prompting: turning intent into reliable instructions
Prompting is specification, not magic words. The anatomy of a strong prompt, examples, structured reasoning, and how to debug a bad one.
Prompting is the cheapest, highest-leverage skill in this whole field. Most of the time someone says "the AI is dumb", the real problem is a vague prompt. A prompt is not a spell, it is a specification: the clearer you are about what you want, the more reliably you get it.
The anatomy of a prompt
A strong prompt usually has six parts: the role the model should take, the task it must do, the context and facts it may use, the constraints it must respect, the output format you expect, and optionally a few examples. You will not need all six every time, but naming them turns prompting from guesswork into a checklist.
ROLE: You are a careful order-taker for a bakery.
TASK: Read the customer message and produce the order as JSON.
CONTEXT: Menu and prices are in the FACTS block below.
RULES: Never invent items or prices. If something is unavailable,
set "needs_human": true. Quantities must be integers.
FORMAT: { "items":[{"name","qty","price"}], "needs_human":bool }
FACTS: Croissant 18k, Sourdough 55k, Brownie 22kShow, do not just tell
Giving the model two or three examples of the input and the exact output you want (called few-shot prompting) often beats a paragraph of instructions. Models are pattern imitators, so a clear example of the pattern is worth a hundred adjectives. Use this whenever the format or the judgement is hard to describe but easy to demonstrate.
Make it reason before it answers
For anything with steps, logic, or arithmetic, asking the model to work through its reasoning before giving the final answer measurably improves accuracy. Newer reasoning models do part of this thinking internally, but decomposition still pays: for harder tasks, split the work into separate calls (extract, then decide, then write) so each step is simple and checkable. Complexity is the enemy of reliability, decomposition is the cure.
Debugging a prompt
- Change one thing at a time, then test, so you know what helped.
- Test against your eval set, not a single happy example.
- When it fails a case, add that case as a new example in the prompt.
- Tighten the exact constraint it violated; do not rewrite the whole thing.
- If it still fails, the task likely needs decomposition or a tool, not a bigger prompt.
What you take away
- A prompt is a specification: role, task, context, constraints, format, examples
- Few-shot examples beat long instructions when the pattern is easy to show
- Ask for reasoning, or decompose into steps, for anything with logic
- Debug by changing one thing, testing on evals, and adding failing cases as examples
Curated sources
Hand-picked references for going deeper, reviewed by our team.