Skip to main content

Prompt Patterns Library

All levels

A toolbox of reusable prompting patterns. Each card: what it is, when to reach for it, and a copy-paste template. They stack — combine freely. New here? Start with Prompting Basics first.

Zero-shot (just ask, clearly)

When: simple, common tasks. Why: least effort, often enough.

Summarize the text below in 5 bullets for a busy manager.
TEXT: """{paste}"""

Few-shot (show examples)

When: you need a specific format or style. Why: examples teach faster than descriptions. See Few-Shot Done Right.

Classify the sentiment as positive/negative/neutral.
Review: "Loved it, shipped fast" → positive
Review: "Broke on day one" → negative
Review: "{new review}" →

Chain-of-thought (think step by step)

When: math, logic, multi-step reasoning. Why: reasoning before answering improves accuracy.

Work through this step by step, then give the final answer on its own line.
PROBLEM: {problem}

Decomposition (break it down)

When: big, fuzzy tasks. Why: smaller subtasks are easier and more reliable.

First, list the sub-tasks needed to {goal}. Then do them one at a time,
showing each result before moving on.

Role prompting (assign a persona)

When: you want a specific lens or standard. Why: primes relevant behaviour.

You are a meticulous senior copy editor. Edit the text for clarity and concision
without changing meaning. Show a bullet list of the changes you made.

Output-format constraint

When: the result feeds another tool, or you want consistency. Why: predictable shapes are usable.

Reply with ONLY valid JSON matching: {"title": string, "tags": string[]}.
No prose, no markdown fences.

Self-consistency / self-critique

When: correctness matters. Why: a second pass catches first-pass errors.

Answer the question. Then, in a section called "Check", critique your own answer
for errors or missing cases and revise if needed.

Grounding (answer only from provided context)

When: facts matter — Q&A over your docs, RAG, anything where a wrong answer is worse than no answer. Why: the single biggest lever against hallucinations is forbidding the model to invent and giving it explicit permission to abstain.

Answer the QUESTION using ONLY the CONTEXT below. Quote the exact sentence(s)
you relied on. If the context does not contain the answer, reply exactly:
"Not found in the provided context." Do not use outside knowledge.

CONTEXT: """{paste your sources}"""
QUESTION: {question}

Meta-prompting (let AI improve your prompt)

When: your prompt underperforms. Why: the model is good at spotting what it's missing.

Here's my prompt: "{prompt}". Ask me the 3 questions that would most improve it,
then rewrite it incorporating sensible defaults.

Iterative refinement

When: almost always. Why: the first output is a draft, not the destination.

{after a result} Shorter and more concrete. Keep the second paragraph. Add one
example. Drop the marketing tone.

:::tip Combine them A strong real prompt is often: a role + an example + an output constraint + permission to say "I don't know." Layer the cards. :::

Next