Phase 8 · Applied Prompt EngineeringModule 30~32 min read

Prompt Patterns & Recipes

A working cookbook of reusable prompt patterns — from summarization and extraction to classification and rewriting — you can adapt to almost any task.

What you'll learn

Most real-world prompting is a handful of patterns reused endlessly — summarize, extract, classify, rewrite, answer. Learn the reusable shapes and you stop starting from scratch every time. This module is a working cookbook you can adapt to almost any task.

By the end of this module you'll be able to:

  • Recognize the core prompt patterns behind most tasks
  • Apply ready-made recipes for summarizing, extracting, classifying, and rewriting
  • See how each recipe combines techniques from earlier phases
  • Build your own reusable template library

Thinking in patterns

Nearly every prompt is a variation on a few shapes. Each recipe below is just the techniques you already know — clear instructions, a role, a format spec, delimiters, an "out" — assembled for a job. Learn the shape once, then swap in the specifics.

PatternRecipe skeletonKey techniques
Summarization“Summarize [text] in [N] [format] for [audience].”Length & format control (Mod 9)
Extraction“Extract [fields] from [text] as JSON matching [schema].”Structured output (Mod 14)
Classification“Classify [text] as one of [labels]. Return only the label.”Enums, few-shot (Mod 7, 14)
Rewriting“Rewrite [text] to be [tone/length/format]. Keep the meaning.”Tone & style control (Mod 9)
Q&A / grounded“Answer using only [context]; cite it; say if not found.”Grounding (Mod 18)
Comparison“Compare [A] and [B] across [criteria] as a table.”Format control (Mod 9)
Six patterns cover a huge share of real prompting. Each is a combination of techniques you've already learned.

Summarize & extract

Summarization and extraction are the workhorses of AI-in-software: turn messy text into something short or structured. Extraction in particular should almost always return JSON (Module 14) so code can use it.

Prompt

Extract the contact details as JSON with keys name, email, phone (use null if missing). "Hi, this is Dana Reyes — reach me at dana@acme.co or just reply here."

AI response

{"name": "Dana Reyes", "email": "dana@acme.co", "phone": null}
The extraction recipe: name the fields, specify JSON, and handle missing values — a pattern you'll reuse constantly.

Classify & route

Classification turns free text into one of a fixed set of labels — the basis of routing (send this to billing, that to support) and filtering. Constrain the labels with an enum and ask for the label only, so the output drops straight into code.

System

Classify the message intent as exactly one of: billing, technical, sales, other. Reply with only the label.

Prompt

My card was declined but I really want to upgrade to the Pro plan.

AI response

billing
A tight classification prompt: fixed labels, 'reply with only the label', ready to route on. Add few-shot examples for tricky cases.

Rewrite & transform

Rewriting reshapes text while preserving meaning: change the tone, shorten it, translate it, fix it, or convert its format. The essential clause is "keep the meaning" — plus a precise description of the target style or format (Module 9).

Tip

For transformations, show a one-line before/after example (few-shot, Module 7) when the target style is hard to describe in words. A single demonstration often pins down a tone that a paragraph of adjectives can't.

Build your own template library

The real productivity win is to save your best prompts as reusable templates with slots to fill in. Over time you accumulate a personal (or team) library — tested, documented prompts you can drop in instead of reinventing them. It's the natural companion to your eval set (Module 26): templates you trust because you've measured them.

  • Parameterize the variable parts (audience, length, labels) as clear placeholders.
  • Document what each template is for and any gotchas.
  • Version and test them with your evals, just like code.

Recap & quick check

Key takeaways

  • Most prompting reuses a few patterns: summarize, extract, classify, rewrite, grounded Q&A, and compare.
  • Each recipe is just earlier techniques assembled — format control, structured output, enums, grounding.
  • Extraction should return JSON with a schema and null handling so code can consume it directly.
  • Classification uses a fixed enum of labels and 'reply with only the label' for clean routing.
  • Save your best prompts as documented, parameterized, eval-tested templates — a reusable library.

Quick check

1. What's the value of thinking in prompt patterns?

2. What should an extraction prompt almost always return?

3. What makes a classification prompt easy to route on?

4. Why build a template library?

Patterns are general shapes. Next we get concrete, with playbooks tuned to specific domains you'll actually work in. Next up: Module 31 — Domain Playbooks: Writing, Code, Data & Support.