One giant prompt that does everything — draft, translate, format, check — usually does everything averagely. Prompt chaining cuts the task into a fixed sequence of small calls, each one taking the previous output as its input.

The analogy

An assembly line. Nobody asks one worker to build the whole car. Station 1 welds, station 2 paints, station 3 inspects — and a part can be rejected between stations before it wastes everyone’s time downstream.

The principle

flowchart LR
    IN([input]) --> S1["LLM: step 1"] --> G{gate}
    G -->|pass| S2["LLM: step 2"] --> S3["LLM: step 3"] --> OUT([output])
    G -->|reject| STOP([reject early])
  • Each step does one thing, with a short, focused prompt.
  • Between steps you can add a gate: a cheap programmatic check (is it valid JSON? under 200 words? in French?) that rejects early instead of propagating garbage.
  • The sequence is fixed by you — the model doesn’t decide the route. That’s what makes it a workflow, not an agent.

A concrete example

Producing a bilingual product announcement:

1. LLM: "Write the announcement from these specs"   → draft
   gate: length < 300 words? mentions the price?
2. LLM: "Tighten and apply our tone guide"          → polished EN
3. LLM: "Translate to French, keep tech terms"      → FR version

Three small prompts, each easy to test and swap — instead of one mega-prompt you’re afraid to touch.

When to use it

  • The task naturally decomposes into fixed, ordered steps.
  • You want quality over latency: each focused call is more accurate than one blended call, at the cost of more round-trips.
  • Steps have different needs: you can even use a cheaper model for easy steps and a strong one for the hard step.

When to avoid it

  • The steps depend on the input in unpredictable ways → look at routing or an agent loop.
  • Latency is critical: every extra link adds a full model call.

The classic trap

Chains that silently degrade: step 3 happily “fixes” the nonsense step 1 produced, and you only see the polished result. Put your gates early, and log every intermediate output — the assembly line needs quality control between stations, not just at the exit.