Promptea.

Prompt chaining: how to break complex tasks into sequential AI steps

Prompt chaining feeds the output of one prompt as input to the next, handling tasks too complex for a single round-trip. Learn the core patterns and where they fail.

What prompt chaining is and when to use it
  • A prompt chain is a sequence of prompts where each output becomes part of the next prompt's input.
  • Use it when a task has distinct phases that benefit from separate focus: research → outline → draft → edit.
  • Use it when a single prompt would exceed the model's useful context or require too many competing instructions.
  • Use it when you need to validate or transform data between steps before passing it downstream.
  • Avoid it for simple tasks — chaining adds complexity and latency that isn't justified unless the task genuinely requires sequential reasoning.
Three chaining patterns
  • Sequential: Step A → Step B → Step C. Each step consumes only the prior step's output. Good for linear workflows like extract → validate → format.
  • Branching: one input generates multiple outputs in parallel, then a final step synthesizes them. Good for competitive drafts or multi-perspective research.
  • Looping: a step runs repeatedly until a quality condition is met (e.g., a reviewer prompt judges the output and requests a rewrite until passing). Use with a hard iteration cap.
  • Mix patterns when needed — a sequential chain can have a branching step inside it.
Common prompt chaining mistakes
  • Passing unvalidated output: if Step A can produce malformed JSON or incomplete data, Step B inherits that problem. Validate or clean outputs between steps.
  • Accumulating too much context: pasting entire prior outputs into every step bloats the context. Pass only what the next step actually needs.
  • No stopping condition on loops: always define what 'done' looks like and cap iterations. Without it, a looping chain can run indefinitely.
  • Skipping intermediate verification: for high-stakes chains, add a quick review step between heavy transforms instead of discovering errors at the final step.
Templates
Data extraction pipeline: extract → validate → format
STEP 1 — EXTRACT
From the raw text below, extract all invoice line items.
Return ONLY JSON: {"items": [{"description": "string", "quantity": number, "unit_price": number}]}
If a field is missing, use null. Do not invent values.

Raw text:
"""[paste invoice text here]"""

---
STEP 2 — VALIDATE (send Step 1 output here)
Review the JSON below for correctness.
- Flag any items where quantity or unit_price is null.
- Flag any descriptions that look like headers or totals, not line items.
- Return: {"valid_items": [...], "flagged": [...], "issues": ["string"]}

JSON from Step 1:
"""[paste Step 1 output here]"""

---
STEP 3 — FORMAT (send Step 2 valid_items here)
Convert the validated items below into a Markdown table with columns: Description | Quantity | Unit Price | Line Total.
Calculate Line Total = quantity × unit_price. If either is null, show "—".
Sort by Line Total descending.

valid_items:
"""[paste valid_items from Step 2 here]"""
Opens on home with the prompt prefilled.
Open in Promptea
Research-to-report chain: gather → outline → draft
STEP 1 — GATHER KEY POINTS
Topic: [your topic]
Audience: [who will read this]

List the 5–7 most important things someone in this audience needs to understand about this topic.
For each point, note: (a) why it matters to this audience, (b) a concrete example or evidence.
Format: numbered list. Be direct — no filler sentences.

---
STEP 2 — OUTLINE (send Step 1 output here)
Using the key points below, create a structured outline for a [blog post / report / briefing] of approximately [word count] words.
Each section must map to one or more key points.
Format: ## Section title → bullet list of what each paragraph will cover.

Key points from Step 1:
"""[paste Step 1 output here]"""

---
STEP 3 — DRAFT (send Step 2 outline here)
Write the full [blog post / report / briefing] following the outline below.
Tone: [professional / conversational / technical]
Constraints:
- Stay within [word count] words (±10%).
- Do not add sections not in the outline.
- Do not use filler phrases like "In today's world" or "It's important to note".
- End with a clear takeaway or next step.

Outline:
"""[paste Step 2 outline here]"""
Opens on home with the prompt prefilled.
Open in Promptea
FAQ
How many steps is too many in a prompt chain?
There is no fixed maximum, but each step adds latency, cost, and a new failure point. In practice, most tasks resolve well with 2–4 steps. If your chain exceeds 6 steps, reconsider whether some steps can be merged or whether the task should be split into independent sub-tasks with separate chains.
Do I need to send all previous outputs to every subsequent step?
No — and you usually should not. Send only what the next step needs to do its job. Passing the full history of every prior step inflates the context, increases cost, and can confuse the model by giving it irrelevant prior reasoning to 'consider'. Extract and pass the relevant subset.