Lesson 1 - The Anatomy of a Strong Prompt
Welcome to The Anatomy of a Strong Prompt
The fastest way to get better results from a language model is not a bigger model or a clever trick — it’s a better prompt. Most disappointing answers come from underspecified requests: the model fills the gaps you left with generic guesses. A strong prompt closes those gaps on purpose.
In this lesson you’ll see, on real output, the difference a structured prompt makes, and you’ll learn the small set of elements that go into one.
By the end of this lesson, you will be able to:
- Name the elements that make up an effective prompt
- Turn a vague request into a precise instruction
- Apply the bad → better → best habit of sharpening a prompt
- Explain why specificity beats length
You’ll reuse the simple ask() helper from Module 1. Let’s begin.
A Vague Prompt Gets a Vague Answer
Here is a one-line request — the kind everyone writes at first. We’ll send it with the cheap claude-haiku-4-5 model using a small helper:
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from your environment
def ask(prompt, system=None, max_tokens=300):
kwargs = dict(model="claude-haiku-4-5", max_tokens=max_tokens,
messages=[{"role": "user", "content": prompt}])
if system:
kwargs["system"] = system
return client.messages.create(**kwargs).content[0].text
print(ask("Write about our new running shoe."))# Introducing Our New Running Shoe
## Performance Meets Comfort
We're thrilled to unveil our latest innovation in running footwear—a shoe designed with
today's runners in mind. Whether you're training for a marathon or enjoying a casual
morning jog, this shoe delivers the support and responsiveness you need.
## Key Features
**Advanced Cushioning**
Our proprietary midsole technology absorbs impact while maintaining ground feel...
**Lightweight Design**
At just [X] ounces, the shoe won't weigh you down...It’s fluent, but it’s useless. The model invented headings you didn’t ask for, wrote in a hypey voice you may not want, and — most tellingly — left a literal [X] ounces placeholder because you never told it the weight. The model didn’t fail. It guessed, because you left it nothing to work with.
The Six Elements of a Strong Prompt
A strong prompt supplies what the model would otherwise have to guess. Six elements cover almost everything:
- Role — who the model should act as (
You are a copywriter for a running-gear brand). Sets vocabulary and judgment. - Task — the one specific thing to do, stated plainly (
Write a product blurb). One task per prompt. - Context — the facts it needs (
230g, grippy outsole, for muddy off-road runs). This is what kills the[X]placeholder. - Audience — who the output is for (
weekend trail runners who care about grip and weight). Shapes tone and what to emphasize. - Format — the exact shape of the answer (
a 2-sentence blurb, then 3 bullet points). The single biggest lever over usability. - Constraints / Examples — limits and samples (
under 70 words, no exclamation marks, concrete not hypey). Rules out what you don’t want.
You won’t always need all six, but every one you supply is a gap the model no longer has to fill with a generic guess.
The Same Request, Engineered
Now we’ll rebuild the request with those elements in place — same model, same helper, just a better prompt:
prompt = """You are a copywriter for a running-gear brand.
Write a product blurb for our new shoe, the Trailblaze X.
Context: lightweight trail runner, 230g, grippy outsole, for muddy off-road runs.
Audience: weekend trail runners who care about grip and weight.
Format: a punchy 2-sentence blurb, then exactly 3 bullet feature points.
Constraints: under 70 words total, no exclamation marks, concrete not hypey."""
print(ask(prompt))# Trailblaze X
Cut through mud without the weight. At just 230g, the Trailblaze X grips loose terrain
so you can push harder on weekend adventures.
• 230g featherweight design keeps fatigue out of your legs on longer runs
• Aggressive tread pattern holds firm on wet, muddy surfaces
• Minimal stack for direct ground feel and responsive trail feedbackSame model, transformed result. It used the real specs (230g, mud, grip), matched the audience, obeyed the format (blurb + exactly three bullets), and respected the constraints (concise, no exclamation marks, concrete). Nothing here required a smarter model — only a clearer instruction.
Specificity beats length
A strong prompt is not necessarily a long one. It’s a specific one. Padding a prompt with vague adjectives (“make it really engaging and amazing”) adds tokens without adding information. Every line should remove a guess the model would otherwise make.
Bad → Better → Best
You rarely write the perfect prompt on the first try, and you don’t need to. The professional habit is to iterate deliberately: start simple, run it, see what’s wrong, and add the one element that fixes it.
- Bad:
Summarize this.— no length, no focus, no format. - Better:
Summarize this support ticket in 2 sentences.— adds task precision and length. - Best:
You are a support lead. Summarize this ticket in 2 sentences for an engineer who will fix it: state the user's problem and what they already tried. Plain text, no greeting.— adds role, audience, focus, and format.
Each step removes a specific ambiguity. When an answer disappoints, don’t just rerun it and hope — ask which element was missing and add exactly that.
Practice Exercises
Exercise 1: Diagnose a vague prompt
Take the prompt "Give me some ideas for my newsletter." and list which of the six elements are missing. Then rewrite it as a “best” prompt for a specific newsletter you imagine.
Hint
At minimum it’s missing role, context (what the newsletter is about), audience, format (how many ideas, how detailed), and constraints. Add one line for each.
Exercise 2: Format is a lever
Send the same task — “explain what an API is” — twice: once asking for “one sentence for a non-technical manager,” once for “a 3-item bulleted list with a code-style example.” Compare how much the format alone changes the usefulness.
Hint
Keep the task identical; change only the Format line. Use the ask() helper and read both outputs. The point is that format is often the highest-impact element.
Exercise 3: Kill the placeholder
Write a prompt that asks for a one-paragraph bio of a fictional person, but deliberately omit their job and city. Run it and watch the model invent or leave gaps. Then add that context and rerun.
Hint
This reproduces the [X] failure from the start of the lesson on purpose — missing context forces the model to guess. Supplying it fixes the output every time.
Summary
A strong prompt is built from a small set of elements — role, task, context, audience, format, and constraints — each one closing a gap the model would otherwise fill with a generic guess. Specificity, not length, is what makes a prompt work, and the reliable way to get there is to iterate bad → better → best, adding the one element that fixes each weakness.
Key Concepts
- Role — the persona the model adopts, setting tone and judgment.
- Task — the single, specific thing to do.
- Context — the facts the model needs (prevents invented placeholders).
- Format — the exact shape of the output; often the highest-impact element.
- Constraints — limits and rules that exclude what you don’t want.
- Bad → better → best — the habit of sharpening a prompt one missing element at a time.
Why This Matters
Prompting is the interface to every LLM application you will build. The same model can produce a useless placeholder or a publish-ready blurb depending entirely on the prompt — so the skill that pays off most is learning to specify exactly what you want.
Next Steps
Continue to Lesson 2 - Sharpening Techniques
Turn a decent prompt into a precise one with specificity, constraints, and format control.
Back to Module Overview
Return to the Prompt Engineering module overview
Continue Building Your Skills
You now know what goes into a strong prompt and why each element earns its place. Next you’ll learn the sharpening techniques that take a prompt from “works” to “works every time” — the specificity and constraints that make output predictable.