prompt-engineering-chain
Installation
SKILL.md
Prompt Chaining
Disclaimer. Patterns are independent of orchestration framework (LangGraph, Mastra, custom DAGs) — those libraries' docs are authoritative for their APIs.
A single prompt forces one model to understand, plan, and generate at once. A chain breaks the work into specialized steps, each focused on one job. Each step is cheaper to debug, easier to swap models on, and produces an intermediate artifact you can validate before moving on.
When to chain
- One prompt is producing inconsistent results because it has competing objectives.
- Different parts of the task want different model tiers (cheap classifier → frontier writer).
- You need to validate intermediate output (a parsed JSON, a fact-checked claim) before committing.
- The pipeline must branch (route by intent, by language, by severity).
- The task is naturally iterative: draft → critique → revise.
Don't chain when one prompt already works at acceptable quality and cost — chains multiply latency.