Back to cookbook

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

9 views Updated

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.

Example output

example-output
111 tokens

Challenge

  • The team relied on a spreadsheet-based process to track renewals and missed a critical deadline as a result.
  • Manual tracking made it hard to see which accounts needed attention before it was too late.

Solution

  • The team adopted the product and completed onboarding in under a week.
  • Automated reminders replaced the manual tracking that had caused the missed renewal.

Results

  • The team now saves roughly 6 hours a week that was previously spent on manual reporting.
  • Automated reminders became the team's favorite feature for keeping renewals on track.

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

ChatGPT Prompt for Reliable Function and Tool Calling

This is a function and tool calling prompt for developers wiring ChatGPT, Claude, or Gemini into an app that has real tools available — a se…

You are an assistant with access to the following tools:

[TOOL_1_NAME]: [ONE-LINE DESCRIPTION OF WHAT IT DOES AND WHEN TO USE IT]
[TOOL_2_NAME]: [ONE-LINE DESCRIPTION OF WHAT IT DOES AND WHEN TO USE IT]

Before responding to the user, work through these steps:

1. Decide if you can answer fully and accurately using only the conversation so far. If yes, answer directly and do not call any tool.
2. If a tool is genuinely needed, identify which single tool is the best fit. Do not call a tool "just in case."
3. List the required arguments for that tool. For each one, state whether you already have a valid value from the conversation, or whether it is missing.
4. If any required argument is missing, ask the user for it instead of guessing or inventing a value.
5. If all required arguments are present, call the tool with exactly those values.

Context: [DESCRIBE THE USER'S REQUEST OR TASK HERE]

Respond now, following the steps above.

Make this prompt yours

Prompt Fundamentals & Techniques

AI Prompt for Few-Shot Prompting to Get Consistent, Correctly Formatted Output

This is a few shot prompting prompt: a template for teaching ChatGPT, Claude, or Gemini the exact output format you want by showing it two o…

Role: You are a [TASK TYPE, e.g. support ticket classifier / data extractor / content tagger].

Task: Given an input, produce output in the exact format shown in the examples below. Study the pattern across all examples before answering, including how edge cases are handled.

Example 1
Input: [EXAMPLE INPUT 1]
Output: [EXAMPLE OUTPUT 1]

Example 2
Input: [EXAMPLE INPUT 2]
Output: [EXAMPLE OUTPUT 2]

Example 3 (edge case: [DESCRIBE WHAT MAKES THIS ONE TRICKY])
Input: [EXAMPLE INPUT 3]
Output: [EXAMPLE OUTPUT 3]

Constraints:
- Match the exact structure, field names, and formatting shown above
- If the new input does not clearly fit the pattern, output [FALLBACK VALUE, e.g. "UNCLEAR"] instead of guessing
- Do not add commentary, explanation, or text outside the output format

Now classify this new input using the same format:
Input: [NEW INPUT TO PROCESS]
Output:

Make this prompt yours

Prompt Fundamentals & Techniques

AI Prompt for Self-Critique and Refinement Before a Final Answer

This AI prompt for self critique and refinement is for anyone who wants a model to check its own draft answer for gaps, errors, or unsupport…

Role: You are an assistant that produces a draft answer, critiques it against explicit criteria, and then revises it.

Context:
- Task or question: [THE ACTUAL TASK OR QUESTION TO ANSWER]
- Relevant background or constraints: [ANY FACTS, RULES, OR LIMITS THE ANSWER MUST RESPECT]
- Critique criteria: [E.G. FACTUAL ACCURACY, COMPLETENESS, UNSUPPORTED ASSUMPTIONS, CLARITY]

Instructions:
1. Write a first draft answer to the task above.
2. Critique the draft explicitly against each criterion listed. For each one, state whether the draft passes or has an issue, and describe the issue if there is one.
3. Write a revised final answer that addresses every issue found in step 2.

Constraints:
- Do not skip stating an issue just because it would require significant rework
- Do not present the draft and the revision as identical if real issues were found
- If no issues are found for a criterion, say so explicitly rather than omitting it

Output format:
1. Draft Answer
2. Critique (one line per criterion)
3. Revised Final Answer

Make this prompt yours