AdvancedLesson 23 of 305 min read

Prompt chains: splitting big jobs into reliable steps

Design chains of small prompts where each step feeds the next, with checkpoints, state summaries and human review, and see the idea run as code.

In this lesson you will

  • Explain why chains beat one giant prompt
  • Design stages with clear outputs
  • Carry state between steps
  • Place human checkpoints

About 18 minutes

The assembly line beats the heroic one-shot

Hira wants a week of social media content for her shop. She types one giant prompt: research my audience, choose themes, write ten captions, design image ideas, check the tone, add hashtags and format it as a table. What comes back is plausible but thin; the captions are generic, the hashtags repeat and a number is wrong. The trouble is not the assistant. It is the job design. A prompt chain splits a big task into small, checkable steps, where each step’s output becomes the next step’s input. Like a factory line, each station does one thing well, and you can inspect the product between stations.

Why chains work

  • Focus. Each step has one clear goal and a short prompt.
  • Checkpoints. You can read, fix or reject the output before it flows onward. Errors stop early.
  • Variety of method. One step can be research, another creative, another strict checking, each with different settings and rules.
  • Reuse. A chain you built once can be run again with new inputs.
  • Clearer failure. When the result is bad, you know which step to fix.

A chain in four steps

Task: turn a rough product description into a week of social posts. Notice how each stage has a single job and a defined output.

Step Job Input Output
1 Extract Pull out the facts Raw notes Fact list with [MISSING] marks
2 Plan Choose angles and a schedule Fact list Table: day, angle, goal
3 Draft Write each post One row of the plan + facts Caption under 40 words
4 Check Review against rules All captions + rules Pass or fix list
STEP 1. From my notes below, list every product fact as a bullet. Mark anything unclear as [MISSING]. Do not add facts.
[paste notes]
STEP 2. Using only the fact list, propose a 7-day posting plan as a table: Day, Angle (gift, behind the scenes, tip, offer, story, question, review), Goal. Do not write captions yet.
STEP 3. Write the caption for Day 2 only, using the plan row and the fact list. Under 40 words. No invented claims.
STEP 4. Check these 7 captions against the rules: under 40 words, only facts from the list, no exclamation marks, one clear action. Reply with PASS or a list of the exact problems per caption.

Designing a chain

  1. Write the end product in one sentence: what exactly should exist at the end?
  2. List the stages a careful human would follow.
  3. Define each stage’s output format so the next stage can use it.
  4. Decide your checkpoints: where must a person look?
  5. Write each prompt with its single job and its rules.
  6. Test on three real examples and fix the weakest step.

Chain patterns you will use again

Pattern How it works Example
Extract, transform, write Facts first, then style Notes to facts to newsletter
Draft, critique, revise A second pass with different instructions Essay, strict editor, final
Generate options, rank, develop Diverge then converge 10 names, score them, build the brand around 1
Plan, execute, verify Check each result against the plan Itinerary, details, conflict check
Classify, route Label inputs and handle by type Customer messages by type

A chain run as code

When you repeat a chain many times, code can run the stages for you, passing output along. The following small example simulates it with plain functions so you can see the idea without any AI service. Each function plays one stage; the data format between them is a simple dictionary. This was run for real:

def extract(notes):
    facts = [n.strip() for n in notes.split(";") if n.strip()]
    return {"facts": facts}

def plan(data):
    angles = ["gift", "behind the scenes", "tip"]
    data["plan"] = [{"day": i + 1, "angle": a} for i, a in enumerate(angles)]
    return data

def draft(data):
    for row in data["plan"]:
        fact = data["facts"][row["day"] - 1]
        row["caption"] = f"{row['angle'].title()}: {fact}"
    return data

def check(data, max_words=8):
    problems = [r["day"] for r in data["plan"] if len(r["caption"].split()) > max_words]
    return {"ok": not problems, "too_long": problems}

result = draft(plan(extract("hand-poured soy wax; burns 40 hours; three scents available")))
for row in result["plan"]:
    print(row["day"], row["caption"])
print(check(result))
1 Gift: hand-poured soy wax
2 Behind The Scenes: burns 40 hours
3 Tip: three scents available
{'ok': True, 'too_long': []}

In a real chain, draft would send a prompt to an AI model instead of formatting text, but the structure is the same: small stages, clear data between them, and a checking stage at the end.

Keeping context between steps

  • In one chat, earlier steps stay in view, which is convenient but can drift in long chats.
  • For critical steps, start a new chat and paste only the input that step needs plus the rules. This avoids contamination from earlier chatter.
  • Carry forward a small state summary: the facts, the decisions and the open questions.
  • Store your standard prompts in a project so each step is repeatable.
Summarise the current state of this work as a short list: confirmed facts, decisions made, open questions, and the next step. I will paste this into a new chat.

Human checkpoints

Decide in advance where a person must approve: before facts are used, before anything goes public, before money or messages are sent. Fully automatic chains are fragile; chains with well-placed human review are robust.

Common mistake

Making a chain too long and never testing it end to end. Small mistakes compound across steps. Run it on three real examples and read the final result critically.

Common mistake

Letting a later step quietly change facts from an earlier step. Tell each stage: use only the facts provided, do not add or change any.

Name your steps

Give each prompt a name such as EXTRACT-FACTS or CHECK-TONE and save it. A library of named steps is a reusable toolbox, and you can recombine them for new jobs.

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

What is a prompt chain?

  1. A long single prompt
  2. A series of small steps where each output feeds the next
  3. A pasted link
  4. A paid plan

Each stage does one job.

A main advantage of chains is…

  1. They avoid all errors
  2. They need no human
  3. They are always faster
  4. You can check and fix between steps

Checkpoints catch errors early.

What should each stage output?

  1. A random essay
  2. A defined format the next stage can use
  3. Nothing
  4. A picture only

Clear formats make hand-offs reliable.

Why start a new chat for a critical step?

  1. To lose the facts
  2. To save words
  3. Because chats expire hourly
  4. To avoid contamination from earlier chatter

A clean context with only the needed input is more reliable.

What is a good practice for human review?

  1. Approve before anything goes public or money moves
  2. Never review
  3. Review only typos
  4. Review after publishing

Place checkpoints before consequences.

Summary

  • Small, focused steps beat one huge prompt.
  • Define each stage’s output format.
  • Check between steps and keep a state summary.
  • Put human approval before consequences.

Next lesson

Next: agent mode and tasks, letting the assistant act for you, and doing it safely.

Questions

How long should a chain be?

As short as it can be while keeping each step simple. Three to six steps cover most jobs.

Can I automate a chain without coding?

Often yes, with no-code automation tools or built-in features, which lesson 25 introduces. Keep a human checkpoint.

Why not do everything in one chat?

You can, but long chats drift. Fresh chats with only the needed input are more reliable for critical steps.

Progress is saved in this browser.