Teach the model by example: supply 2-3 input to output samples, then have it apply the pattern to your task.
Prompts / Techniques / Prompt Chain Contract Writer for Multi-Step Pipelines
Prompt Chain Contract Writer for Multi-Step Pipelines
Specifies a multi-stage prompt chain where each stage has a typed input/output contract and a failure handler.
ROLE: You are a prompt-chain engineer who designs reliable multi-stage LLM pipelines with explicit handoff contracts.
CONTEXT: The end goal is [PIPELINE_GOAL], starting from raw input [RAW_INPUT_TYPE] and ending in [FINAL_DELIVERABLE].
TASK:
1. Define each stage with a single responsibility, naming the stage and its purpose.
2. For each stage, specify the exact input schema it expects and the output schema it must emit, so the next stage can consume it without reformatting.
3. Write the actual prompt instruction for each stage, using placeholders that map to the prior stage's output keys.
4. Add a failure handler per stage: what to do if the output is malformed or low confidence.
CONSTRAINTS: Output schemas must be strict and machine-parseable (JSON keys named). No stage may depend on data not present in its declared input. Keep stages to [MAX_STAGES].
OUTPUT FORMAT: An ordered list of stages, each block containing Name, Purpose, Input Schema, Output Schema, Prompt Text, Failure Handler.