Chapter BPrompt pattern libraryPage 7 of 8

Prompt pattern library

Stacking patterns and failure modes

Patterns can combine, but every added instruction is a chance for conflict, bloat, and false confidence.

~14 minEdge cases and tradeoffs

Before you start

Why this matters

Production prompts often stack role + context + few-shot + schema + safety rules. That can work. It can also create a prompt nobody understands, where examples contradict the schema and the role asks for creativity while the schema forbids invention.

Stacking is a design choice. Add a pattern only when it removes a specific failure you have observed.

1Learn the idea

Read

Compatible stacks

Common useful combinations:

  • Role + criteria + prose task for drafting and tutoring.
  • Few-shot + structured fields for classification and extraction.
  • Clarify + decompose + human gate for multi-stage work.
  • System prompt policy + user task when standing rules must persist across turns.

Keep standing rules short and stable. Put case-specific material in the user turn. If everything is “system,” nothing is prioritized.

Teach

Conflict patterns

Watch for these collisions:

  • Examples show invented values while instructions forbid guessing.
  • Role says “be bold and decisive” while criteria say “mark uncertainty.”
  • Chain-of-thought asks for hidden reasoning that invents facts not in context.
  • Multiple output formats requested at once (JSON and a marketing essay).
  • Safety rules buried under long stylistic lectures the model may ignore.

When conflicts appear, the model may satisfy the loudest or latest instruction. Do not leave priority implicit. State a precedence line: “If instructions conflict, follow evidence rules over style.”

Read

Bloat and attention

Long prompts dilute attention. Symptoms include skipped fields, ignored edge-case examples, and regressions when you add one more paragraph. Countermeasures:

  • remove duplicate rules;
  • replace essays with one example;
  • move rare policies to a linked checklist humans apply;
  • split stages instead of lengthening a single shot;
  • test after every major edit.

A prompt library entry should be readable in two minutes by a new teammate.

Read

False confidence failure modes

Even a clean stack can fail:

  • Fluent wrong structure: valid JSON, false content.
  • Schema theater: fields present, evidence empty or circular.
  • Overfitting to examples: works on demo cases, fails on messy real input.
  • Instruction smuggling: user content tries to override system rules.
  • Silent drift: model or tool updates change behavior without your prompt changing.

Mitigations include evidence fields, validation, held-out tests, treating user content as data, and versioning templates with owners.

Read

Debugging sequence

When output is bad:

  1. Diagnose the failure family (vague task, missing context, format, invention, tone, conflict).
  2. Change one pattern element.
  3. Re-test the same case plus one new case.
  4. Only then consider stacking another technique.

Randomly adding “think step by step,” a stern role, and three more examples at once teaches you nothing.

Read

Maintenance habits

Assign an owner for shared prompts. Record purpose, inputs, outputs, known limitations, and last test date. Retire templates that nobody can explain. For consequential workflows, keep an evaluation set of ten to thirty cases and re-run after edits.

Read

Prefer replace over accumulate

When a stack misbehaves, the temptation is to add another stern sentence. Prefer replacing a weak component: swap a bad example, shorten a role, or move a stage out of the mega-prompt. Accumulation hides the causal link between change and result. Replacement keeps the prompt teachable and keeps your iteration skill aligned with one-change loops from nearby lessons.

Checking tutor…

Continue learning · glossary & guides