MemberPress AI Academy memberpress.ai
← Prompt Engineering 101

Lesson 17 of 19

Appendix · Beyond Standard Prompting

Chaining prompts

Video7 min

A single prompt can do a surprising amount of work. A chain of prompts can do work that no single prompt can — because each step can be inspected, corrected, and verified before feeding into the next.

Prompt chaining is the technique of breaking a complex task into a sequence of simpler steps, where each step's output becomes the next step's input.

Why chain instead of doing it in one prompt

A single prompt that tries to extract claims, classify them, and draft a response simultaneously will sometimes get all three right and sometimes get one wrong in a way that corrupts the others. When it fails, you cannot tell which step failed. When you chain the steps, you see the output of each step. If step two is wrong, you fix step two without touching steps one and three.

The second reason is accuracy. Each step in a chain is a simpler task. Simpler tasks produce more accurate outputs. The chain of three accurate steps usually outperforms the single prompt trying to do all three at once.

The pattern

Step 1 prompt: extraction "Extract all claims from the following user review. Return them as a numbered list, one claim per line. A claim is any statement of fact or opinion about the product."

Step 2 prompt (receives the numbered list from Step 1): "Classify each of the following claims as 'factual' (can be verified), 'opinion' (subjective evaluation), or 'inflammatory' (language designed to provoke rather than inform). Return a JSON array where each item has 'claim' and 'type' fields."

Step 3 prompt (receives the JSON from Step 2): "Draft a response to the user review. Address only the factual claims. Acknowledge the opinions without agreeing or disagreeing. Do not respond to the inflammatory claims. Keep the response under 100 words."

What to inspect at each step

After Step 1: Are all claims present? Are there false positives (things classified as claims that are not claims)?

After Step 2: Are the classifications correct? This is where most chains fail — classification is harder than it looks, and the categories may overlap. If the classifications are wrong here, everything downstream is wrong.

After Step 3: Does the response address the right claims? Is the tone appropriate?

If you get stuck

If the chain produces the right output on most inputs but fails on some, identify which step fails on the difficult inputs. Fix that step in isolation before re-running the full chain.

If passing the output of one step into the next is creating format problems (the JSON from Step 2 is malformed when it becomes part of Step 3's prompt), add a format normalization step between them.

Cross-reference

L13 (Building complex prompts from scratch) covers single-prompt complexity. Chaining is the alternative when a single prompt becomes too complex to debug reliably.

Deliverable

Take a task from your work that involves at least two sequential operations — extract then classify, summarize then prioritize, analyze then recommend. Break it into a two-step chain. Run each step separately. Verify the output of step one before running step two. Note whether the chained version produces better output than a single prompt trying to do both.

Try these prompts

  • Step 1: Extract all claims from this user review. Step 2: Classify each as factual, opinion, or inflammatory.
  • Chain 3 prompts to turn a raw support ticket into a priority label, a suggested fix, and a customer reply.