Prompt Chaining & Decomposition

Chaining

Part of: Advanced Prompting Patterns

You ask a model to "read this 20-page report, extract the risks, rank them, and write an executive summary" in one shot. The result is mushy: some risks missed, ranking arbitrary, summary vague. Now split it into four prompts, each doing one job and feeding the next. Suddenly every stage is sharp. That's prompt chaining : and it's how serious LLM systems get built. What it is Prompt chaining (also called decomposition ) is breaking a complex task into a sequence of smaller prompts, where the output of one becomes the input to the next . Instead of one giant prompt trying to do everything, you build a pipeline of focused steps. The principle behind it is the same one that makes functions better than one thousand-line script: a prompt that does one thing does it better. Each stage has a narrow, clear job, so it's easier to get right, easier to test, and easier to fix when it breaks. How it works Take "summarize the key risks in this report" and decompose it: In code, you literally feed each result forward: Each call is small, inspectable, and independently fixable. If the summary is bad, you can look at ranked to see whether the problem was the ranking step or the summary step. With

Challenge: The Risk Triage Pipeline