How to Chain Prompts to Tackle Complex Tasks
When a single prompt is not enough — how to break complex tasks into a chain of smaller, reliable steps. Three patterns and two complete worked examples.
Why Single Prompts Fail on Complex Work
A single prompt works well for self-contained tasks: summarise this, translate that, fix this bug. It starts to fail when the task has multiple distinct sub-tasks that each require a different mindset.
Here is a real example of a task that looks doable in a single prompt but usually produces poor results:
PROMPT: "Research the competitive landscape for project management software, identify our three biggest differentiators, write a 500-word executive summary for investors, and then create a 10-slide presentation outline." RESULT: The AI does all four things — but none well. The research is surface-level, the differentiators are generic, the executive summary is padded, and the presentation outline doesn't connect to the earlier analysis. The model is trying to do four cognitively distinct jobs in sequence, with no time to think carefully about any one of them.
What Prompt Chaining Is
Prompt chaining means breaking a complex task into a sequence of smaller prompts, where the output of each step becomes the input to the next. The AI does one job at a time, does it well, and hands the result forward.
Think of it like a production line. A factory does not ask one worker to design, manufacture, assemble, and quality-check a product. Each station does one thing well. The output of station one feeds station two. Prompt chains work the same way.
The 3 Patterns
1. Sequential Chain
Each step feeds into the next in a straight line. The most common pattern.
[Prompt 1] → [Output 1]
↓
[Prompt 2 + Output 1] → [Output 2]
↓
[Prompt 3 + Output 2] → [Final Output]Best for: writing workflows, report generation, multi-stage code generation, translation + editing pipelines.
2. Branching Chain
One input generates multiple parallel outputs that are then merged or compared. Use this when you want the AI to consider several approaches before committing to one.
[Prompt 1: Generate options]
↓
┌────────────────┼────────────────┐
↓ ↓ ↓
[Option A] [Option B] [Option C]
└────────────────┼────────────────┘
↓
[Prompt 2: Evaluate & select best]
↓
[Prompt 3: Develop selected option]Best for: ideation (generate 5 taglines, pick the best), architecture decisions (generate 3 approaches, compare tradeoffs), A/B content generation.
3. Feedback Loop
The output is evaluated and fed back into the same step until quality criteria are met. This is how you get self-improving outputs.
[Prompt 1: Generate draft]
↓
[Draft output]
↓
[Prompt 2: Critique the draft] ←──────────────────┐
↓ │
[Critique] │
↓ │
[Prompt 3: Revise based on critique] │
↓ │
[Revised draft] │
↓ │
[Check: Does it meet criteria?] ──── NO ───────────┘
↓ YES
[Final output]Best for: writing refinement, code review + fix cycles, iterative design, any task where quality can be objectively evaluated.
Worked Example 1: Writing a Business Proposal
A 4-step sequential chain that produces a polished business proposal. Each step is focused on one job.
PROMPT: "You are going to help me write a business proposal. Before writing anything, interview me to gather the key information. Ask me these questions one at a time: 1. What problem does your product/service solve? 2. Who is the target customer? 3. What makes you different from competitors? 4. What is the ask (budget, timeline, desired outcome)? 5. Any context about the reader (who will receive this proposal)? Ask question 1 first and wait for my answer before continuing." --- [User answers all 5 questions in the conversation] --- OUTPUT (saved as context): - Problem: construction firms lose 15% revenue to invoice disputes - Customer: GCs with 20–200 employees - Differentiators: automated dispute detection, integrates with existing accounting tools - Ask: $50k pilot contract, 6-month engagement, outcome = 50% reduction in disputes - Reader: CFO at a mid-size construction firm, sceptical of new software
PROMPT: "Using the context below, create a logical argument structure for a business proposal. Do not write the proposal yet — just the skeleton. Output format: - Executive summary (key message in one sentence) - Problem statement (3 bullet points) - Solution overview (3 bullet points) - Differentiation (3 bullet points vs status quo) - Proposed engagement (scope, timeline, investment) - Risk mitigation (top 2 objections + responses) Context: [paste Step 1 output]" --- OUTPUT: A bullet-point structure ready for Step 3
PROMPT: "Write a 600-word business proposal based on this structure. The reader is a CFO at a mid-size construction firm who is sceptical of new software — lead with ROI and proof, not features. Use professional but direct language. No jargon. No passive voice. Structure to follow: [paste Step 2 output]" --- OUTPUT: The full proposal draft
PROMPT: "Review this proposal as the CFO who will receive it. You are sceptical — you have seen many software sales pitches that overpromised. Identify: 1. Any claim that feels unsubstantiated — flag it and suggest how to back it up 2. Any section that is too long or padded — cut it 3. The single weakest part of the argument — how would you strengthen it? Then give me the revised version with all issues addressed. Proposal to review: [paste Step 3 output]" --- OUTPUT: Final polished proposal
Worked Example 2: Code Review Pipeline
A 3-step chain that does a thorough code review — much better than a single "review this code" prompt.
PROMPT: "Read this code carefully. Do not review or critique it yet. 1. In 3 sentences, describe what this code does 2. List every dependency or external call it makes 3. List every assumption it makes about its inputs Code: [paste code]" --- OUTPUT (feeds into Step 2): - Summary: "This is an authentication middleware that validates JWT tokens..." - Dependencies: jsonwebtoken, express, User model from database - Assumptions: req.headers.authorization is always a string, tokens never expire in testing
PROMPT: "Now review the code below for issues in each of these categories. Be specific — give line numbers and exact problems, not vague observations. Categories: 1. Security vulnerabilities (especially around auth since this is auth middleware) 2. Edge cases not handled 3. Error handling — are errors specific enough? What would a developer see in production? 4. Performance — anything that could be slow at scale? 5. Maintainability — anything that will confuse the next developer? Code: [paste original code] Context from Step 1: [paste Step 1 output]" --- OUTPUT: Categorised issue list
PROMPT: "For each Critical and Major issue below, give the exact fix as a code snippet. Format each fix as: - Issue: [restate the problem] - Why it matters: [one sentence] - Fix: [code block] Do not include Minor issues in this step — I will handle those separately. Issues from Step 2: [paste Step 2 output — Critical and Major only]" --- OUTPUT: Actionable fixes ready to apply
When NOT to Chain
- Simple factual questions — no chaining needed
- Single-mode tasks like translation, summarisation, or basic classification
- Tasks where the full context fits comfortably in one prompt
- Prototypes — get the single-prompt version working first, then chain if quality is consistently insufficient
Tips for Passing Context Between Steps
- Explicitly label what you are passing: "Here is the output from the previous step:" — do not make the AI guess
- Summarise rather than passing everything when the chain grows long — verbatim output from step 1 through step 5 inflates the context and costs tokens
- Keep each step's output structured — bullet points and JSON are easier to inject into the next prompt than dense paragraphs
- Store intermediate outputs in variables or a simple dictionary — log them during development so you can debug which step produced the bad output
- At the start of each step, include a one-line reminder of the final goal: "Remember: the end goal is a 600-word business proposal for a CFO."
Ready to go further?
Take the interactive course — daily lessons, real exercises, XP and streaks. Turn reading into lasting skills.
