Learn the five-part prompt anatomy and the write → eval → refine loop that replaces guesswork with craft.
🎯 PM🤖 AI-relevant✍️ Prompting⚡ Intermediate📖 ~18 min
Lesson 05 of AI Product Manager Track
The prompt IS the spec
Your engineers won't let you ship a feature without a PRD. Your designers won't let you ship a screen without a Figma file. But somehow, on AI features, the thing that most shapes user experience — the prompt — often gets written in a half-hour, committed to main, and never touched again.
This is a mistake. On a modern LLM feature, the prompt is the product spec. It encodes the tone, the refusals, the format, the examples, the guardrails. A change to one sentence in the prompt can cause a 15% drop in task success. A change to the model, with the same prompt, can be invisible. This lesson gives you a way to write and ship prompts like a PM — not like someone fiddling in a playground.
The one-sentence takeaway:
A prompt is a contract, in English, between your product and a model. Treat it with the same rigor as a PRD. Version it. Evaluate it. Review it.
The five-part prompt anatomy
Strong prompts are not magic incantations. They have a shape. Every production system prompt you will read in a serious AI company has the same five parts, in some order. Here is what the TaxSetu AI tax assistant's system prompt looks like, color-coded by part.
ROLEYou are TaxSetu Assistant, a tax helper for Indian salaried individuals filing ITR-1 and ITR-2.
CONTEXTThe user has shared their Form 16 and is preparing FY 2024–25 returns. You have access to: the official income-tax.gov.in FAQ, TaxSetu's section-wise explainers, and the user's uploaded Form 16 fields (redacted PAN).
TASKAnswer the user's tax question in plain English. Every numeric claim — slab rate, deduction cap, due date — must come from the provided documents. Quote the source with a short [TaxSetu §80C] tag inline.
FORMATRespond in ≤120 words. Use short paragraphs, not bullet walls. Start with the direct answer in one sentence, then one sentence of reasoning, then the citation. No markdown headers. No emoji.
REFUSALSIf the question involves GST, corporate tax, foreign income, or crypto capital gains — respond exactly: "That one is outside what I can safely help with. A TaxSetu CA can — tap here to book." Never guess deadlines. Never produce a filed ITR-V or sign anything.
Notice what the prompt does not do:
it does not try to teach the model tax law. The law lives in Layer 2 (retrieved documents). The prompt tells the model how to behave around those documents. Prompts shape behavior, not knowledge.
Each part, what it does for the PM
Think of the five parts as the sections of a PRD. Drop one and the feature wobbles in a predictable way. Add examples — a sixth, optional section — and you buy yourself format reliability for almost nothing.
🎭
Role
Who the model is pretending to be. Sets vocabulary and empathy baseline. Cutting this causes "assistant speak" to leak in — "Certainly! I'd be happy to help…"
🗂️
Context
What the model knows and is allowed to use this turn. User state, retrieved docs, the current page. Without it the model invents context.
🎯
Task
The one job to be done. Verb-first, one sentence. "Answer the tax question using only the documents provided." Vague tasks produce vague answers.
📐
Format
Length, tone, structure, citation rule. The most-often-skipped section and the reason your bot writes 400-word essays to a "what's my slab?" question.
🛑
Refusals
The explicit list of things the model will not do, and the exact phrase to use when it refuses. Regulatory safety lives here. So does brand.
📎
Examples (few-shot)
Two or three input/output pairs pinned into the prompt. The single fastest way to lock format. Skip this and complex formats drift by turn five.
PM rule of thumb: If a failure mode shows up in 3+ of your eval cases, it belongs in the prompt — either as a new refusal line, a tighter format rule, or a few-shot example. Keep the prompt in the repo, reviewed on PRs, diffed like code.
Scenario — TaxSetu, Bangalore
🧾
Real-world scenario
Rohan's tax bot works — and is unusable
Rohan is a senior PM at TaxSetu in Bangalore. Filing season hits in three weeks. His team picked Claude Sonnet (the "right" model per the evals in Lesson 10) and wired it to an indexed pack of TaxSetu FAQ + the official IT department circulars. Retrieval works. The model works. And yet the bot is unusable.
Sample complaint from internal QA: "I asked 'what's my 80C limit?' and got 340 words about section 80C history, three caveats about old vs new regime, zero citations, and a confident-sounding deadline that is wrong." The data is right. The model is right. The prompt is doing all the damage — and Rohan cannot afford a fine-tune run before April 15.
Rohan's constraint: three weeks, no model change, no fine-tune. Push the eval pass rate from 58% to above the 85% launch gate — by editing the prompt.
How prompt engineering actually works — the write → eval → refine loop
Engineers get a REPL. PMs get a prompt loop. It's the same idea: write the smallest thing that could possibly work, run it against a known set of cases, read the failures, and refine. No vibes, no Slack screenshots of a single bad output.
Rohan's before and after
When Rohan ran the loop for two weeks, every iteration showed up as a diff to a single file — prompts/TaxSetu-v*.md — reviewed in a PR like any other spec change. Here is what the two prompts look like side by side. The left was "a prompt"; the right is a spec.
Dimension
v1 — the "just write something" prompt
v3 — the spec-shaped prompt
Length
Avg response 340 words. Essays on history.
Avg 90 words. Direct answer, 1-line reasoning, citation.
Citations
None. Model invents plausible section numbers.
Every numeric claim tagged [TaxSetu §80C]. Missing citation = auto-fail in eval.
Tone
"Certainly! I'd be delighted to help you with…"
Plain, calm, first-person-singular "I". No filler openers.
Refusals
Soft apology, then attempts the answer anyway.
Exact refusal string for 4 banned categories. Routes to human CA.
Confidence
Always sounds certain, even on wrong deadlines.
Deadlines only quoted from the IT circular. Otherwise "I'm not sure — let me route you."
Eval pass rate across three prompt versions
Same model. Same retrieval. Same 30-question golden set. Only the prompt changed.
What Rohan does with this: ships v3 to a 10% canary. The +29 point jump came from prompt edits that cost him three PR reviews — not from a fine-tune run, not from a model swap. That's the craft.
The AI connection
What real AI teams do
At Anthropic, OpenAI, and every serious AI product team, prompts live in git, get code-reviewed, and are tagged by version (e.g. TaxSetu-v3.2.1). Every production request logs which prompt version served it — so when quality drops, you can bisect the prompt history the way engineers bisect code. The write → eval → refine loop is so core that "prompt engineer" and "applied AI engineer" job titles blur. For PMs, the concepts to name are below — and in Lesson 06 we turn these into hard guardrails.
system-promptfew-shotzero-shotprompt-versioningprompt-bisectfine-tune-escalation
Mini challenge — shape a prompt in 20 minutes
Pick one AI feature you've used this week
1. Reverse-engineer the five parts
Use ChatGPT, Gemini, or a support bot. Guess the Role, Context, Task, Format, Refusals from its behavior. Where can you feel a part missing? (Hint: bots that ramble are missing Format. Bots that say weird things are missing Refusals.)
2. Draft a 5-part prompt for a real product
Write the system prompt for a SouthBank or NaijaCart support bot on a sticky-note-sized doc. Cap each part at three lines. If a part needs more, tighten it.
3. Build a 10-case eval sheet
Open a spreadsheet. Column A: question. Column B: what a good answer looks like. Column C: pass / fail. Run your prompt five times against it. You just built a golden set — the whole premise of Arc C.
Interview questions
EasyName the five parts of a production prompt.
+
Role, Context, Task, Format, Refusals. Optionally a sixth section — examples (few-shot) — that locks format for complex outputs. The mnemonic: R-C-T-F-R. If an answer feels off, 9 times out of 10 one of these sections is missing or weak.
EasyWhat's the difference between few-shot and zero-shot prompting?
+
Zero-shot means you describe the task and ask the model to do it, with no worked examples. Few-shot means you paste 2–5 input/output examples into the prompt before the real input. Few-shot is the single fastest way to lock format, tone, or a specific reasoning style. Use zero-shot for simple tasks; use few-shot whenever the output has a rigid shape (JSON schema, citation format, refusal wording).
MediumHow do you version a prompt?
+
The prompt lives in the repo as a plain file — prompts/TaxSetu.md — with semantic version tags (v3.2.1). Every production request logs the version string that served it. PRs that change the prompt require a diff of eval pass rate on the golden set, the same way a code PR requires tests. When a regression lands, you bisect prompt history just like you'd bisect code. Never ship an unversioned prompt — when quality drops six weeks later, you'll have no idea which change caused it.
MediumYour bot's pass rate is stuck at 72%. Format issues are gone, refusals work. What do you try next?
+
Cluster the remaining failures. If they are format-shape drift (the bot gets the answer right but formats it differently across cases) — add 2–3 few-shot examples that mirror the desired output exactly. If the failures are reasoning errors (wrong answers that look plausible), the prompt can't fix it — re-examine retrieval (Layer 2) or escalate to a larger model. If the failures are edge cases outside scope, tighten refusals rather than broadening the task. Never "add more instructions and hope" — each prompt edit should target one symptom cluster.
HardWhen do you escalate from prompting to fine-tuning?
+
Three conditions together, not any one alone. (1) You've plateaued. Pass rate hasn't moved across 3+ prompt versions, and failures are reasoning, not format. (2) You have training data. At least 500–1000 high-quality input/output pairs from production or curated labeling — not synthetic. (3) The cost math works. Fine-tuning a small model can drop per-call cost 5–10× vs using a flagship with a huge prompt; at scale that pays for the tuning run within weeks. If you're fine-tuning to save a prompt you haven't pushed through the write→eval→refine loop, you're about to burn money and end up with a model that's worse than GPT-4o plus a good prompt. Rule of thumb: prompts solve 80% of problems for 1% of the cost; fine-tuning is for the last mile at scale, never the first.
Test your knowledge
Question 1 of 5
Which of these is NOT one of the five core parts of a production prompt?
Question 2 of 5
Rohan's bot answers with 340-word essays. Which part of the prompt is most likely weakest?
Question 3 of 5
You want the bot to always produce the same JSON schema on output. Fastest fix?
Question 4 of 5
A prompt is under-specified when…
Question 5 of 5
When is it legitimate to escalate from prompt engineering to fine-tuning?
0
/5
You write prompts like specs. Ship it.
Common mistakes
Dumping the policy doc into the system prompt
Pasting the full 12-page tax policy inflates every call, crowds out examples, and the model still ignores half of it. The doc belongs in Layer 2 (retrieval). The prompt tells the model how to use it.
No examples — zero-shotting complex formats
Asking for "a structured citation in brackets" without showing a single example is how you get seven different formats across one eval run. Two or three few-shot examples fix format drift faster than any model upgrade.
Vague refusal wording
"Don't answer legal questions" is a suggestion, not a refusal. Production refusals specify the exact phrase to return and the handoff path. "Respond exactly: 'That's outside what I can safely help with — tap here to book a CA.'"
Never versioning the prompt
The prompt sits in a Google Doc. Someone edits it. Quality tanks three weeks later. No one can bisect. If the prompt isn't in git, reviewed on PRs, with an eval diff — it's not a production prompt.
Key takeaways
A prompt is a product spec in natural language — role, context, task, format, refusals, optional examples.
Prompts shape behavior, not knowledge. Put facts in retrieval, not the system prompt.
The loop is write → eval → refine. Each edit targets one failure cluster, not a vibe.
Version prompts in git. Every production call logs the prompt version. PRs diff eval pass rate.
Few-shot examples are the highest-leverage fix for format drift — faster than any model change.
Fine-tune only after prompts plateau, you have 500+ labeled examples, and the cost math works.