Chain Your Prompts
Last reviewed
AdvancedWhat you'll learn
~14 min- Recognize when a single prompt is overloaded and should be split
- Feed the output of one focused prompt into the next as a deliberate pipeline
- Tell the difference between prompt chaining and task decomposition
When a prompt tries to do everything at once — read a document, analyze it, and write a polished deliverable in one shot — quality drops on all three. The model splits its attention, and each job gets a fraction of it. The fix is to stop asking for everything at once.
Prompt chaining means breaking a complex task into a sequence of focused prompts, where the output of each step becomes the input to the next. Each prompt does one job well, and you can inspect the result between steps.
An overloaded prompt vs. a chain
Overloaded (one prompt, three jobs):
Read these 12 customer interviews, identify the top themes, and writea product strategy memo recommending what to build next quarter.You’ll get a memo — but the themes will be shallow (the model rushed past the interviews to get to the memo), and you can’t tell whether the recommendation rests on a real reading of the data or a plausible guess.
Chained (three prompts, one job each):
Step 1 — Extract:"For each interview in <interviews>, pull out every distinct painpoint as a bullet. Quote the line that supports it. Output only the list."
Step 2 — Analyze (input: Step 1's output):"Here is a list of pain points with supporting quotes. Group them intothemes. For each theme, give a name, the count, and the 2 strongestquotes. Rank themes by frequency."
Step 3 — Write (input: Step 2's output):"Using these ranked themes, write a one-page strategy memo recommendingthe top 2 things to build next quarter, each justified by its theme."Now extraction is grounded (it quotes), analysis works on clean structured input, and the memo rests on a visible chain of evidence. If the recommendation looks off, you can see which step went wrong and fix only that one.
Why chaining beats one big prompt
- Each step gets full attention. A prompt doing one job outperforms the same job buried inside a three-part request.
- You can inspect between steps. A bad extraction is obvious before it poisons the analysis. With one mega-prompt, errors compound silently.
- You can fix one link without redoing the chain. If the memo’s tone is wrong, re-run Step 3 — Steps 1 and 2 still stand.
- Each step can use different techniques. Step 1 uses grounding (quote first). Step 2 uses examples (theme format). Step 3 uses a role (strategy lead). Chaining lets each link pull the right technique.
Chaining vs. decomposition — related but not the same
Module 10 taught you to break a project into chunks — build the login page, then the dashboard, then the settings. That’s decomposition: independent pieces you build in sequence, each a separate deliverable.
Chaining is decomposition where the output of one step is the input to the next. The steps aren’t independent — they form a pipeline, and data flows down it. Decomposition splits a project; chaining splits a single transformation that’s too complex to do in one pass.
You don’t need special tooling to chain. In a CLI session, each prompt naturally feeds the next — Step 2 can refer to what Step 1 just produced. For repeatable chains, save the step prompts as a sequence (or a script), so you can run the same pipeline on new input. The agentic patterns in Module 13 — subagents, headless runs — are what you reach for when you want to automate a chain rather than drive it by hand.
Keep the handoff clean
A chain is only as good as what passes between steps. If Step 1’s output is messy prose, Step 2 has to re-parse it. Make each step emit the exact shape the next step wants to consume — this is where the structure and format lesson pays off:
Step 1 ends with: "Output only a JSON array of {painPoint, quote} objects."Step 2 begins with: "Here is a JSON array of pain points: …"Clean, structured handoffs are what turn a loose sequence of prompts into a reliable pipeline.
📊In Your Field: MIS / Businessclick to expand
Report generation is a natural chain. Step 1: parse the raw CSV into clean metrics. Step 2: compute period-over-period changes and flag variances. Step 3: write the executive narrative from the flagged variances. Each step is simple and checkable; the one-shot version (“turn this CSV into an exec report”) is neither.
🎧In Your Field: Music Producerclick to expand
Campaign content chains well. Step 1: extract the key facts about the release (title, mood, date, standout track). Step 2: turn those into a 7-day posting plan. Step 3: write each caption from the plan. Driving it as a chain keeps every caption consistent with the same source facts.
🎮In Your Field: Game Dev / Investingclick to expand
A go/no-go is a chain, not a guess. Step 1: pull the rights and licensing status for the IP. Step 2: gather market comps for similar remakes. Step 3: project runway against a budget scenario. Step 4: feed all three into a single go/no-go recommendation. Each step is checkable on its own; the one-shot “should I remake this game?” hides the exact reasoning you most need to see.
A single prompt is supposed to read 20 reviews, find themes, and write a summary — but the themes feel shallow and you can't tell if the summary is grounded. What's the better structure?
Key takeaways
- One job per prompt. A prompt doing a single thing beats the same job buried in a three-part request.
- Chain by feeding output into input. Each step consumes the last step’s result, forming a pipeline you can inspect and repair link by link.
- Chaining ≠ decomposition. Decomposition splits a project into independent pieces; chaining splits one complex transformation into dependent steps with data flowing between them.
- Each link can use a different technique — grounding, examples, roles — pulling the right tool for that step.
- Clean, structured handoffs are what make a chain reliable; have each step emit exactly what the next one needs.
Next: Test and Keep What Works