Skip to content

Prompt Chaining Explained: Break Big AI Tasks Into Steps

Prompt chaining means splitting one big request into a sequence of smaller prompts. Here's how it works, with examples you can run today.

By Orgwyse Published Last updated 7 min read

On this page
  1. Why one giant prompt fails
  2. A research chain
  3. A writing chain
  4. A code review chain
  5. Run a chain by hand
  6. FAQ

Prompt chaining means you split one large job into a sequence of smaller prompts, and you pass the useful part of each answer into the next prompt. You do this when a single message would have to research, decide, draft, and critique all at once. Each step has one job, and you can reject a step without throwing away the others.

The shape of a single step is the framework in How to write a good prompt. Chaining is what you do when one step is not the whole task.

Why one giant prompt fails

A prompt that says “research this, outline it, write 1,500 words, add citations, and make a checklist” asks for five different kinds of work. The model will spend its effort on the most visible part, usually the prose, and fake the parts that were supposed to come first. You cannot tell which sentence rests on a source and which sentence was padding, because they arrived together.

A chain makes the intermediate result something you can read:

  1. You can stop when a step is wrong, instead of editing a finished essay that was wrong from the outline.
  2. You can reuse a step. The “list the risks” prompt is the same next time. The essay is not.
  3. You can show a later step only what it needs. A drafting prompt that also contains three rejected outlines will try to resurrect them.

The cost is a few extra messages. That is cheaper than untangling one blob.

A research chain

Use this when the output is a short report and you do not already know the answer. Four steps. Do not skip to the draft.

Step 1. Lock the question.

Prompt
Turn this into one question a source could answer: [vague ask].
Name what would count as an answer, and what would be a different question I should not chase.
Do not answer it.

Edit the question until you would be willing to stop if a source resolved it. If you cannot, the task is still two tasks.

Step 2. Build a source list you can actually open.

Prompt
For this question, list 8 source types or specific works I should read, in order.
Question: [the question from step 1].
For each: what it can settle, and what it cannot. Do not summarize sources you do not have.
I already have:
[paste what you really have]

Throw out anything you will not open. A chain that pretends to have read a paper it was not given will invent the paper.

Step 3. Extract, one source at a time. Paste a single source per message.

Prompt
Extract claims from this source that bear on [question].
Quote, then paraphrase. If it does not address the question, say so.
Source:
[paste one source]

Keep those extracts. They are the only material the draft is allowed to use.

Step 4. Draft from the extracts only.

Prompt
Write a [length] report that answers [question] for [reader].
Use only the extracts below. After any sentence that states a result, put the source name in parentheses.
If the extracts do not support a point you want to make, omit the point and list it under "Not in the sources."
Extracts:
[paste the kept extracts]

If you need a tighter pass, that is another step: “Cut every sentence that is not answering the question. Do not add sources.” It is still one job.

A writing chain

Use this for a post, a talk, or a memo. Three steps is usually enough.

Step 1. Reader and promise.

Prompt
I want to write [piece] for [reader].
They can already [knowledge]. After reading, they should be able to [action].
Write the promise in one sentence, then list what the piece must not try to do.

If the promise has an “and,” split the piece.

Step 2. Outline you can reject.

Prompt
Outline [piece] that fulfills this promise: [sentence from step 1].
5 sections maximum. For each: the heading, the point, and the example or evidence it needs.
Do not write prose. Mark any section I cannot write until I supply [missing material].

Delete sections before you draft. An outline you did not edit will be obeyed too faithfully.

Step 3. Draft one section. Repeat per section. Do not ask for the whole piece if the sections have different evidence.

Prompt
Write section [heading] only.
Point it must make: [point]. Evidence you may use: [paste].
[Length]. No introduction to the whole piece. Stop at the end of the section.

A fourth step, if you need it, is an edit pass with a single constraint: “Join these sections. Remove repeated openings. Do not add claims.”

Single-shot templates for the individual steps live in 50 reusable prompt templates. Chaining is those templates in an order, with you checking between them.

A code review chain

Use this on a diff you are responsible for. The order matters: understand, then risk, then change.

Step 1. Restate the behavior.

Prompt
Read the diff. Describe the behavior change a caller would notice, in 5 sentences.
Do not suggest edits. If the diff does two unrelated things, say so and stop.
Diff:
[paste]

If the restatement is wrong, fix your understanding before anyone rewrites code. Quoting a wrong restatement back (“No. The caller sees X, not Y”) is the correction.

Step 2. Risks only.

Prompt
Using the behavior you just described, list bugs, security issues, and missing tests.
Quote the line. One sentence on the failure. Skip style.
If you need a test to know, describe the test input instead of guessing.

Step 3. One patch for the risk you accept. Pick a single item from step 2. Ignore the rest until that patch exists.

Prompt
Change the code so that [the one risk] cannot happen.
Keep the rest of the behavior from step 1. Show the changed region and a test that fails before the change and passes after.
Do not fix unrelated issues in this diff.

Asking for “review and rewrite everything you don’t like” in one message produces a large diff you will not read. The chain forces a small one.

Run a chain by hand

You do not need a special mode.

  1. Write the steps down before the first message. A chain you invent as you go turns into the giant prompt again.
  2. Start a chat for the chain if the work is one effort. Keep unrelated questions out of it so the next step does not drag them in.
  3. Paste the previous output only after you have deleted the parts that were wrong. The model treats what you paste as material to use, including mistakes.
  4. Start the next prompt with the job, then the material. “Using the outline below, write section 2. Ignore any section I deleted.”
  5. Stop when a step is bad. Repair that step. Don’t “continue” and hope the draft repairs the outline.

If the product has a limited context and the extracts are long, paste a shorter bundle: the question, the outline, and the extracts for this section. Say what you left out so it does not invent the missing pages.

Save the step prompts, with the brackets, next to each other. Next time you only refill the material. A chain that worked is a checklist. A chain you have to remember is a one-off.

FAQ

Is prompt chaining the same as a long prompt with headings?

No. Headings inside one message still produce one answer, and you see the outline only after the draft exists. A chain stops after the outline so you can throw it away.

How many steps should a chain have?

As many as there are distinct checks. Research is often four: question, sources, extracts, draft. A short email is often one step and should not be chained. If you cannot say what would make you reject a step, it is not a step. Fold it into the next one.

Should each step be a new chat?

Use a new chat when the earlier thread is full of rejected attempts you do not want reused. Stay in the same chat when the model needs the running extracts and you have been careful about what you pasted. When you stay, quote the piece to use. “Use the outline in your last message” fails once there have been two outlines.

What do I do with a wrong step?

Reply with the correction and ask it to redo only that step. “Section 3 claims the study measured X. It measured Y. Rewrite section 3 only.” Don’t ask it to regenerate the whole report. That reintroduces the mistakes you already removed.

Can a chain stop the model from inventing sources?

It can make invention easier to see. The extract step quotes the source. The draft step is told to use only those quotes. You still have to check that the quotes are real and that the draft did not walk past them. A chain is a way of working, not a guarantee.

Last updated 17 October 2026 · Spotted something out of date? [email protected]