Manuals / Prompt Engineering / Chapter 4

A · Structure · intermediate · ~35 min · Chapter 4 of 12

Few-shot examples & negative constraints

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

Path progress
29%

Step 1 of 2

Build a 3-example set

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

Build a 3-example setDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Build a 3-example drag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Do this now

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

Was this step clear?
Chapter learning outcomes
  • Few-shot prompting
  • Negative constraints
  • Edge case examples

Clear these before you leave

Side quest

Test case generator

Few-shot prompt that turns user stories into Given/When/Then cases.