Skip to content

Technique

Intermediate

Prompt chaining

Break a big task into smaller prompts where each step's output feeds the next, for better control and quality.

What it is

Prompt chaining splits a complex task into a sequence of simpler prompts, where the output of one step becomes the input to the next. Instead of asking for everything at once ("research, outline, write, and edit a report"), you handle each stage separately and check the result in between.

You can chain by hand in a chat window, or automate the chain in code or a no-code workflow tool.

When to use it

  • The task has distinct stages (gather → analyze → draft → edit)
  • A single prompt produces shallow or muddled results
  • You want to check or correct intermediate results before moving on
  • Different steps need different instructions, formats, or tones
  • You're building an automated workflow that should be reliable and debuggable

How it works

Why it works

A single prompt that asks for many things at once forces the model to juggle every requirement simultaneously, and some get dropped. Each link in a chain has one clear job, which makes it easier to do well and easier to check. If something goes wrong, you can see exactly which step failed and fix just that step.

Example: turning customer reviews into an action plan

Step 1 — Extract

Prompt
From the customer reviews below, list every distinct complaint as a short
phrase, with how many reviews mention it. Output a bulleted list only.

Reviews:
"""
[paste reviews]
"""

Check the list. Merge duplicates or fix anything misread.

Step 2 — Prioritize

Prompt
Here is a list of customer complaints with counts:
[paste the checked list from step 1]

Group them into themes and rank the themes by how much they likely hurt
customer satisfaction. Explain your ranking in one sentence each.

Step 3 — Plan

Prompt
Based on these ranked themes:
[paste output from step 2]

Draft a one-page action plan for a small team: for the top 3 themes,
give one quick fix (this week) and one longer-term fix (this quarter).

Each step is simple, and you get a checkpoint after extraction, where errors would otherwise spread silently.

Designing a good chain

  • One job per step. Extraction, analysis, and writing are different skills.
  • Pass only what's needed. Give each step the relevant output, not the whole history.
  • Use structured output between steps (lists, tables, JSON) so the next step gets clean input.
  • Add checks at the points where mistakes are most costly.

Tip: A classic two-step chain is "draft, then critique and revise": first ask for a draft, then in a separate prompt ask the model to review the draft against your criteria and improve it.

Note: Chains take more prompts, so they cost more time (and tokens, if you're using an API). Use them when quality and control matter more than speed.

Step by step

  1. 1

    Write down the end result you want.

  2. 2

    Break the task into 3–5 stages, each with a single clear job.

  3. 3

    Write a focused prompt for each stage, defining its input and output format.

  4. 4

    Run the first step and check its output before passing it on.

  5. 5

    Feed the checked output into the next prompt, and continue down the chain.

  6. 6

    Once it works, save the prompts as a reusable workflow (or automate it).

Weak vs strong

Weak prompt
Read these 50 customer reviews, figure out all the problems, decide which matter most, come up with solutions, write a report for my boss, and make it sound professional.
Why it falls short: Six tasks crammed into one prompt. The model will likely skim, merge steps, and produce a polished-sounding report that's hard to verify, with no checkpoint to catch extraction errors.
Strong prompt
Step 1 of 3: From the 50 reviews below, list each distinct complaint as a short phrase with the number of reviews that mention it. Don't analyze or suggest fixes yet; I'll ask for that next.

Reviews:
"""
[paste reviews]
"""
Why it works: It does one job (extraction), defines the output format, explicitly defers later steps, and creates a checkpoint you can verify before analysis begins.

Practical use cases

  • Long-form writing

    Brainstorm angles → choose one → outline → draft each section → edit for tone and length.

  • Research summaries

    Summarize each source separately, then compare the summaries, then write the conclusion.

  • Data workflows

    Extract records into a table, clean and categorize them, then generate insights and a chart description.

  • Automated pipelines

    In code or no-code tools, chain classify → route → draft reply → quality-check for support tickets.

Practice exercise

Chain a weekly meal plan. Build a three-step chain:

  1. List 7 dinner ideas that fit your constraints (diet, time, budget) as a table.
  2. Turn the table into a combined grocery list grouped by store section.
  3. Write a Sunday prep plan that takes under 90 minutes.

Check and edit each output before pasting it into the next step. Note where your check caught a problem.