Manuals / Prompt Engineering / Ch 4

A · StructureIntermediate35 min read

4. Few-shot examples & negative constraints

Prompt Engineering · 48 pages source format

Show 1–3 input→output examples for the pattern you want. Also say what NOT to do — models respond well to explicit boundaries.

What you'll learn

  • Few-shot prompting
  • Negative constraints
  • Edge case examples

Build a 3-example set

Pick a repetitive task (bug titles, test case names, commit messages). Write 3 gold examples.

Do this now

Prompt with examples. Compare output quality vs zero-shot.

Clear?

Add "do not" rules

"Do not invent features. Do not use passive voice. Do not exceed 100 words."

Do this now

Add 3 negative constraints to a prompt. Measure violation rate on 5 runs.

Clear?

Checklist