Learn · Prompt engineering & structured output · CCAR-F task 4.2

Few-shot prompting for consistency

A few well-chosen examples fix format and judgement better than more instructions. Always include the hard, ambiguous case.

Key ideas

Worked example: Teaching the null case

If Claude invents values when data is missing, add an example whose correct output is null with reason "unclear". One worked edge case usually beats a paragraph of rules about missing data.

Exam traps

Official docs

Practise CCAR-F questions · Next lesson: Structured output with schemas and tools