# Prompt Chaining Using the output of one prompt as the input to the next, creating a sequential pipeline of AI operations. Each step in the chain handles one focused task, and the results flow forward. ## Why chain prompts - **Break complexity**: a task too complex for one prompt becomes manageable as a series of simpler steps - **Improve quality**: each step can be optimized independently - **Add validation**: insert checks between steps (did step 2 produce valid output before feeding step 3?) - **Enable branching**: different outputs from step 1 can route to different step 2 prompts ## Common patterns - **Research -> Summarize -> Write**: gather information, distill key points, produce final output - **Generate -> Critique -> Refine**: create a draft, evaluate it against criteria, improve based on feedback - **Extract -> Transform -> Load**: pull data from a source, reshape it, store in target format - **Plan -> Implement -> Review**: design approach, execute, validate result ## Connection to AI agents Prompt chaining is the manual precursor to [[Agentic loops]]. An agent automates the chain: it decides what to do next based on the previous step's output. Prompt chaining is explicit and human-sequenced; agent loops are dynamic and self-directed. [[AI Agent Skills]] often implement prompt chains internally: a skill that "writes a newsletter" chains research, drafting, formatting, and link-checking steps. ## Connection to [[Prompt Lazy Loading AI Design Pattern (PLL)]] PLL is a form of chaining: load context only when a step needs it, rather than loading everything upfront. This preserves [[Context Budget]] across the chain. ## References - ## Related - [[Prompt Engineering]] - [[Prompt Engineering Strategies]] - [[Agentic loops]] - [[AI Agent Skills]] - [[AI Skill Composability]] - [[Prompt Lazy Loading AI Design Pattern (PLL)]] - [[Context Budget]] - [[Chain-of-Thought (CoT) prompting]]