Chapters — Prompt Engineering
Prompt Engineering·Leveling Up·6 min read·Sep 5, 2026

Teaching By Example

How to teach an AI a pattern with two or three examples instead of a paragraph of instructions, and how many examples is too many.

Show, don't just tell

Instructions describe a pattern in words; examples let the model see the pattern directly. For anything with a specific shape (a format, a voice, a structure), two or three good examples usually beat a paragraph of description.

Turning Slack messages into changelog entries
Convert engineering Slack updates into public changelog entries: Example 1: Slack: "finally killed that bug where the export button double-fired on slow connections" Changelog: "Fixed: the export button no longer triggers twice on slow network connections." Example 2: Slack: "added dark mode toggle to settings, took forever but it's in" Changelog: "Added: a dark mode toggle, available in Settings." Now convert: Slack: "invoices load way faster now, we were doing 3 db calls for no reason"

Changelog: "Improved: invoices now load significantly faster."

What makes an example worth including

  • Relevance: it matches the actual task, not a nearby one
  • Clarity: the input→output relationship is obvious at a glance
  • Consistency: every example follows the same structure
  • Completeness: it shows the full output, not a truncated version
  • Variability: 2–3 examples cover different scenarios, not the same one twice
How many examples do you actually need?
One
Simple, low-ambiguity tasks: the pattern is obvious from a single case.
Two to three
Most tasks: enough to show the pattern without wasting tokens.
Four to five
Complex tasks, or ones where you need to show meaningful variation.
More than five
Rarely worth it: diminishing returns, and it buries the actual request.

Common mistakes

Inconsistent examples
Mixing formats or quality levels teaches the model the wrong pattern. Keep every example aligned.
Weak example quality
Your examples are the template; the model follows them closely, flaws included.
Irrelevant detail
Strip anything that doesn't relate to the pattern you're teaching.
Too little input context
Include enough of the input side that the AI understands what drove each output.

Few-shot examples earn their keep on custom formats, a brand voice that's hard to describe in words, and any task where you need consistent output across many similar requests.

Part of a free guide

Prompt Engineering

A simple guide to writing better prompts, so AI gives you the answer you actually want.

Browse All Guides →