Prompt Chaining: the workflow pattern to reach for first
The simplest AI workflow pattern — decompose a task into a fixed sequence of LLM calls, each handling one job, with gates to catch failures before they compound.
Most teams try to make one giant prompt do everything — extract, reason, format, and validate in a single call. It works in the demo and falls apart in production. Prompt chaining is the fix, and it's the first pattern I reach for: break the task into a fixed sequence of steps, where each LLM call handles one narrow job and feeds the next.
How it works
You trade one hard call for several easy ones. Each step has a single responsibility and a much smaller surface area to get wrong. Between steps you can add a programmatic gate — a schema check, a length test, a classifier — that stops the chain early instead of letting a bad draft sail through to the customer.
- Each step is simpler, so accuracy per step goes up.
- Gates catch failures at the cheapest possible moment.
- You can evaluate and debug one link at a time, not a black box.
const outline = await llm(outlinePrompt, input);
if (!passesGate(outline)) return fallback(); // fail fast
const draft = await llm(draftPrompt, outline);
const final = await llm(polishPrompt, draft);
return final;When to use it
Reach for prompt chaining whenever a task decomposes cleanly into fixed, ordered subtasks — generate then translate, outline then write, extract then summarise. The steps are known in advance; you're trading a little latency for a large gain in reliability.
One prompt doing five jobs is a demo. Five prompts doing one job each is a product.