Prompt Chain Template

Split a task that keeps failing into sequential single-purpose prompts, each with a checked handoff, so errors are caught between steps.

A chain is the fix for a prompt that tries to do three things and does all of them adequately. Each step does one job, and the handoff between steps is checkable.

**Step 1: Extract or gather.**

```
Extract [WHAT] from the material below.

Output ONLY this structure, with no commentary:
[SCHEMA OR EXACT FORMAT]

Rules: use only what appears in the material. For any field the material does not contain, output [null or the explicit missing marker], never an inferred value.

Material:
"""
[INPUT]
"""
```

**Checkpoint 1:** is every field either grounded in the material or explicitly null? Anything invented here becomes a fact in every later step, so this is the cheapest place in the chain to catch an error.

**Step 2: Transform or decide.**

```
[THE ANALYSIS, DECISION, OR TRANSFORMATION], using only the structured data below.

[THE DECISION RULES]

Output format: [EXACT FORMAT]

Data:
[PASTE STEP 1 OUTPUT]
```

**Checkpoint 2:** does every conclusion trace to a field in the step 1 output? Reject anything that does not.

**Step 3: Generate the deliverable.**

```
Write [THE OUTPUT] for [AUDIENCE], based only on the analysis below.

[VOICE, LENGTH, AND FORMAT CONSTRAINTS]

Analysis:
[PASTE STEP 2 OUTPUT]
```

**Optional step 4: Critique and revise.**

```
Review the draft below against these criteria: [3-5 SPECIFIC, CHECKABLE CRITERIA].

For each criterion: pass or fail, with the quoted text that fails it. Then produce the revised version fixing only the failures. Do not rewrite passing sections.

Draft:
"""
[PASTE STEP 3 OUTPUT]
"""
```

---
How to build a chain:

- Chain when a single prompt is inconsistent after 3-5 examples, when steps need different reasoning (extraction is careful and literal, generation is creative), when an intermediate result is worth inspecting, or when one long input is degrading everything downstream.
- Do not chain a task a single clear prompt already handles. Each step adds latency, cost, and one more place for information to be lost.
- The handoff between steps must be structured. Passing prose between steps reintroduces the ambiguity the chain was meant to remove.
- Each step should be independently testable with a fixed input, which is what lets you find the step that is actually failing.
- Put the check between steps, not at the end. An error caught at step 1 costs one rerun; the same error caught at step 4 costs four.

How to use

The most common reason a complicated prompt underperforms is that it is really three prompts sharing one instruction budget, and the model quietly optimizes for whichever objective it read last. Chaining is not more sophisticated prompting, it is smaller scope per call. The structured handoff is the part people skip: passing a paragraph of prose from step to step gives back exactly the ambiguity the split was supposed to remove.

Originated fromStan SedberryUpdated
Templatesintermediate

More agent prompts

You are a software engineering agent working in the [PRODUCT/TEAM] codebase ([LANGUAGE/STACK]). Your objective is to take an assigned task from description to verified, working code. You may read and modify anything in the repository; you do not push, merge, deploy, or alter CI configuration unless the task explicitly says to.

# Operatin

Coding Agent System Prompt

Autonomous coding agent that matches repo conventions, proves work with passing tests before claiming done, and reports failures truthfully.

Agentintermediate
You are a debugging agent for the [PRODUCT] codebase. Your objective is to find the root cause of a reported bug, fix it with the smallest possible change, and prove the fix. You are not here to refactor, harden, or improve unrelated code: a debugging session that ends in a 40-file diff has failed even if the bug is gone.

# Reproduce Bef

Debugging Agent System Prompt

Root-cause-first debugging agent: no fix until the bug is reproduced, minimal diffs only, and done means the repro dies while the test suite stays green.

Agentintermediate
You are a code migration agent. Your objective is to move the [PRODUCT] codebase from [SOURCE VERSION/FRAMEWORK] to [TARGET VERSION/FRAMEWORK] while preserving behavior exactly. You are a mechanical translator with judgment, not a redesigner: the product must work the same after every step you take.

# The Prime Rule: Migration Changes On

Code Migration Agent System Prompt

Framework-upgrade agent that migrates in build-green slices, verifies every codemod, follows official guides over memory, and never mixes in behavior changes.

Agentadvanced

Search prompts

Find a prompt by title, description, tag, or category.