Back to cookbook

AI Prompt to Chain Multiple Prompts Into a Multi-Step Workflow

9 views Published

Make this prompt yours

Share

This prompt chaining template helps you break a complex task into a sequence of smaller prompts, where the output of one step becomes the input to the next. It's for anyone building a multi-step AI workflow — research-then-write pipelines, extract-then-summarize tasks, draft-then-critique loops — who keeps getting weaker results from a single giant prompt than from a series of focused ones.

A single long prompt asking a model to "research this topic, then outline it, then write it, then edit it" tends to blur each stage together, so the model rushes the research to get to the writing. Prompt chaining fixes this by defining each step as its own self-contained prompt with a clear input and a clear output, so you (or an orchestration script) can inspect, correct, or regenerate any one step without redoing the whole chain. This works the same way whether you're running it manually turn-by-turn in ChatGPT or Claude, or wiring it into an automated pipeline.

If you're designing a chain with several steps, it helps to see how token and latency costs compare between a single combined prompt and the chained version before committing to either approach — Compare & Diff lets you put both versions side by side and see the tradeoff directly.

Prompt template

Make this prompt yours

prompt-template
123 tokens
Role: You are executing step [STEP_NUMBER] of a [TOTAL_STEPS]-step workflow for the task: [OVERALL_GOAL]. Input from previous step: [OUTPUT_FROM_PREVIOUS_STEP_OR_NONE_IF_FIRST_STEP] This step's job: [SPECIFIC_INSTRUCTION_FOR_THIS_STEP_ONLY] Constraints: - Only perform this step's job. Do not attempt later steps in the workflow. - Base your output only on the input provided above, not on assumptions about later steps. - [ANY_FORMAT_OR_LENGTH_CONSTRAINT] Output format: [EXACT_STRUCTURE_THE_NEXT_STEP_EXPECTS_TO_RECEIVE]

Want it sharper? Optimize this prompt with Prompt Optimizer, check it with the Prompt Debugger or shorten it with the Token Optimizer.

Example input

example-input
203 tokens
Role: You are executing step 2 of a 4-step workflow for the task: turn a raw customer interview transcript into a polished case study. Input from previous step: Key themes extracted from the transcript: (1) switched from a spreadsheet-based process to the product after missing a renewal deadline, (2) onboarding took under a week, (3) the team now saves roughly 6 hours a week on reporting, (4) favorite feature is the automated reminders. This step's job: Turn these four themes into a three-section outline (Challenge, Solution, Results) for a customer case study, with 2-3 bullet points per section. Constraints: - Only perform this step's job. Do not attempt later steps in the workflow. - Base your output only on the input provided above, not on assumptions about later steps. - Keep each bullet to one sentence. Output format: A markdown outline with three headers (Challenge, Solution, Results), each followed by 2-3 bullet points.

When to use it

  • When a single prompt produces shallow or rushed output because it's asking for too many things at once
  • When you need to inspect or correct an intermediate result (like a draft outline) before the model continues
  • When building an automated pipeline where each step's output feeds the next step's input
  • When different stages of a task genuinely need different instructions, tone, or constraints

Best practices

  • Define a clear, minimal output format for each step so the next step can parse it reliably
  • Keep each prompt focused on exactly one job; resist folding two steps back into one for convenience
  • Pass only what the next step actually needs forward, not the full conversation history, to avoid drifting context
  • Review each intermediate output once while designing the chain, since errors at an early step compound through every step after it

Common mistakes

  • Chaining steps that don't actually need to be separate, which adds latency and cost for no real quality gain
  • Not specifying the exact output format of a step, so the next step receives inconsistent input it can't parse
  • Letting errors from an early step silently pass through instead of validating output before moving to the next step
  • Carrying the entire prior conversation into every step instead of only the specific result each step requires

FAQs

What is prompt chaining?

Prompt chaining is the practice of breaking a complex task into a series of smaller, focused prompts, where each prompt's output becomes the next prompt's input, instead of trying to get a single prompt to handle every stage of the task at once.

When should I use prompt chaining instead of one big prompt?

Use it when a single prompt is producing shallow results because it's juggling too many instructions, when you need to check or correct an intermediate result before continuing, or when you're building an automated pipeline that needs each step's output in a specific, parseable format.

Does prompt chaining work the same way across ChatGPT, Claude, and Gemini?

Yes, the underlying technique is the same across models since it's about how you structure your own prompts and pass data between them, not a model-specific feature. The main difference is how much context each model can hold, which affects how much of the chain's history you can afford to carry forward.

Is prompt chaining more expensive than a single prompt?

It can use more total tokens than one combined prompt since each step repeats some context, but it often produces better results per step, so it's worth comparing the two approaches directly rather than assuming one is always cheaper.

What tool pairs well with testing a prompt chain before building it?

Compare & Diff — it lets you compare a single combined prompt against a chained version side by side, including estimated token and latency cost, so you can see whether splitting the task is actually worth it before you build the pipeline.

Found this prompt useful? Share it.

Share

More in Prompt Fundamentals & Techniques

Prompt Fundamentals & Techniques

AI Prompt for ReAct (Reason + Act) Prompting to Combine Reasoning With Tool Use

A ReAct prompt (short for Reason + Act) is a prompting pattern that asks a model to alternate between explaining its reasoning and taking a…

ROLE:
You are an agent that solves tasks by alternating between reasoning and taking actions. You have access to a fixed set of tools.

AVAILABLE ACTIONS:
[LIST_OF_TOOL_NAMES_AND_WHAT_EACH_ONE_DOES]

CONTEXT:
Task: [DESCRIBE_THE_TASK_OR_QUESTION]
Constraints: [ANY_LIMITS_ON_SCOPE_TIME_OR_TOOLS]

INSTRUCTIONS:
For each step, output exactly these three labeled parts, in order:
Thought: explain what you currently know and what you need to find out or do next.
Action: name exactly one action from the available list and its input, in the format ActionName[input].
Observation: left blank for the system to fill in with the real result of the action.

Repeat the Thought-Action-Observation cycle until you have enough information to answer, or until you reach [MAX_NUMBER] cycles. If a tool call fails or returns an error, say so explicitly in the next Thought instead of inventing a result.

OUTPUT FORMAT:
When you have enough information, stop the loop and output:
Final Answer: [YOUR_ANSWER_BASED_ONLY_ON_WHAT_WAS_ACTUALLY_OBSERVED]

Make this prompt yours

Prompt Fundamentals & Techniques

AI Prompt for Chain-of-Verification (CoVe) Prompting to Reduce Hallucinations

Chain of Verification (CoVe) prompting is a technique for catching a model's own factual slip ups before they reach the reader. Instead of t…

Role: You are a careful fact-checking assistant performing a chain-of-verification pass.

Context:
Topic or question: [TOPIC OR QUESTION]
Intended audience: [AUDIENCE, e.g. internal report, public blog post, client email]

Task (follow these steps in order, showing each step separately):

Step 1 - Draft Answer:
Write a draft answer to the question above in [LENGTH/FORMAT, e.g. 150 words, bullet list].

Step 2 - Verification Questions:
From the draft, extract [NUMBER] specific factual claims (names, dates, numbers, cause-effect statements). For each claim, write one independent, atomic verification question that could be answered without seeing the draft.

Step 3 - Independent Answers:
Answer each verification question on its own, using your own reasoning or stated knowledge, without referencing the draft text. If you are not confident in an answer, say so explicitly rather than guessing.

Step 4 - Revised Answer:
Compare the verification answers to the original draft. List any contradictions found. Then produce a final, corrected answer that resolves those contradictions.

Constraints:
- Do not skip Step 3 or answer verification questions by just repeating the draft
- Flag any claim you cannot verify with reasonable confidence as [UNVERIFIED] rather than deleting it silently
- Keep the final answer within [LENGTH/FORMAT]

Output format:
Return four labeled sections: Draft Answer, Verification Questions & Answers, Contradictions Found, Final Revised Answer.

Make this prompt yours

Prompt Fundamentals & Techniques

AI Prompt for Analogical Prompting to Generate Self-Created Examples Before Answering

Analogical prompting is a technique where, instead of you writing few shot examples by hand, you ask the model to first recall or invent sim…

You are solving a problem using analogical reasoning.

STEP 1: Before solving the problem below, recall or generate 2 related problems that share a similar underlying structure or reasoning pattern. For each one, briefly state the problem and how it would be solved.

STEP 2: Identify what reasoning approach or pattern those examples have in common.

STEP 3: Apply that same reasoning approach to solve the actual problem below. Show your work step by step.

ACTUAL PROBLEM:
[YOUR QUESTION OR PROBLEM HERE]

OUTPUT FORMAT:
- Related Examples: (2 short examples with solutions)
- Shared Pattern: (1-2 sentences)
- Final Answer: (clearly labeled, with step-by-step reasoning for the actual problem)

Make this prompt yours