Teach an AI Workflow With Real Input and Output Examples
"Make it sound like me" is a preference. One real input paired with one approved output is a demonstration. A few-shot prompt gives the model several demonstrations before the new task, so it can copy the decision pattern instead of guessing what your adjectives meant.
The examples matter more than the label. Three polished happy paths teach the model to behave as if every input is polished and happy.
Choose examples by failure mode
Start with a small evaluation set from real task shapes, with sensitive data removed. Pick examples that cover:
- the normal case;
- an ugly but valid input;
- a missing-value case;
- a case the workflow must refuse or escalate;
- the mistake the current prompt makes most often.
You may only need two or three examples in the production prompt. The larger evaluation set tells you which examples earn their token cost.
Use complete input-output pairs
INPUT:
Customer says: "charged twice, second one still pending"
APPROVED OUTPUT:
intent: possible_duplicate_charge
confidence: 0.72
needs_human_review: true
reason: one charge is pending, so duplication is not confirmed
Show the exact schema, tone, null behaviour, and stopping rule you want. If the model should not infer a date, include an example where the approved output leaves the date null.
Negative examples need an approved response too. "Do not do X" is weaker than showing the input that tempts X and the correct refusal or escalation.
Keep examples current
Examples become part of the interface. When the output schema changes, update them in the same change. Give the block a version and run it through CI with the prompt evaluation cases.
Do not paste raw customer conversations into a permanent prompt. Redact or replace identifying details while preserving the structure that caused the failure.
Measure whether the examples help
Run the same cases with and without the example block. Compare task correctness, schema validity, refusal behaviour, latency, and token cost. One better demo is not a result. Inspect regressions, especially on cases that resemble the examples less closely.
Claude can help cluster failures and propose candidate examples. A person approves what counts as the correct output.
Run the starter locally
npm test
npm run validate
npm run sample
The dry-run validates the example-pack inputs and returns a reviewable output shape. Docker Compose includes n8n for orchestration. Nothing updates a production prompt automatically.