Every pattern here maps to a lesson in the main course. When a pattern is not working, go back to the lesson it came from and re-read the pitfall box. Keep this open alongside Claude.ai while you build.
Category 1 — Giving clear instructions
Pattern 1.1 — Specific criteria prompt
When to use
When you need consistent categorisation, flagging, or decisions. Use instead of vague instructions like "be careful" or "flag issues."
Template
[Action] this [item].
Only [action] if it contains:
- [Criterion 1]
- [Criterion 2]
- [Criterion 3]
If none apply, respond with: [Default response].
Example
Review this customer email.
Only escalate if it contains:
- An explicit refund request
- A mention of legal action
- Abusive language toward staff
If none apply, respond with: No escalation required.
Watch out
Listing 10 criteria is not better than listing 3 specific ones. More criteria = more ambiguity. Keep the list short and precise.
Pattern 1.2 — Role + task + format
When to use
When you want Claude to adopt a specific perspective and produce a specific type of output. Works well for writing tasks and analysis.
Template
You are a [role].
Your task is to [specific task].
Respond in the following format:
[Format description or template].
Example
You are an experienced property manager.
Your task is to categorise this maintenance request and assign a priority level.
Respond in this format:
Category: [category]
Priority: High / Medium / Low
Reason: [one sentence]
Watch out
The role description should be functional, not decorative. "You are a helpful assistant" adds nothing. "You are a property manager who prioritises tenant safety" gives Claude useful context.
Pattern 1.3 — Step-by-step instruction
When to use
When order matters. Use when Claude needs to complete a multi-step task where each step depends on the previous one.
Template
Complete these steps in order:
1. First, [step 1]
2. Then, [step 2]
3. Finally, [step 3]
Do not move to the next step until the previous one is complete.
Example
Complete these steps in order:
1. First, read the contract and identify all payment terms.
2. Then, check whether each payment term has a corresponding penalty clause.
3. Finally, list any payment terms that are missing a penalty clause.
Do not move to the next step until the previous one is complete.
Category 2 — Using examples to teach consistency
Pattern 2.1 — Basic few-shot example
When to use
When Claude produces inconsistent results on ambiguous cases. Add 2–4 examples showing correct behaviour.
Template
[Your instruction here]
Examples:
Input: "[example input 1]"
Output: [correct output 1]
Input: "[example input 2]"
Output: [correct output 2]
Input: "[example input 3]"
Output: [correct output 3]
Example
Classify this support ticket as: Billing, Technical, or Account.
Examples:
Input: "I was charged twice this month."
Output: Billing
Input: "The app crashes on startup."
Output: Technical
Input: "I need to add a new user to my team."
Output: Account
Watch out
Use examples that cover the edge cases, not the obvious ones. If "I was charged twice" is obvious Billing, it does not need an example. Use examples for the tickets that keep getting misclassified.
Pattern 2.2 — Example with reasoning
When to use
When basic examples are not enough and Claude still makes mistakes on ambiguous cases. Show WHY the answer is correct.
Template
Input: "[ambiguous example]"
Output: [correct output]
Reason: [why this answer, not the obvious alternative]
Example
Input: "I can't log in — my password reset email never arrived."
Output: Technical
Reason: Although this involves account access, the root cause is a system delivery failure, not a billing or account management issue. Login failures caused by system problems are Technical.
Category 3 — Getting structured, usable output
Pattern 3.1 — Fill-in-the-template
When to use
When you need Claude to extract specific fields from a document or email. Produces consistent output every time.
Template
Read this [document type] and fill in the following template exactly.
Leave any field as "Not found" if the information is not present.
[Field 1]: [value]
[Field 2]: [value]
[Field 3]: [value or Not found]
Example
Read this invoice and fill in the following template exactly.
Leave any field as "Not found" if the information is not present.
Vendor name: [value]
Invoice number: [value]
Total amount: [value]
Due date: [value or Not found]
PO number: [value or Not found]
Watch out
Never make all fields required. If a field might genuinely be absent and you force Claude to fill it, Claude will fabricate a plausible value. Always offer "Not found" as a valid option.
Pattern 3.2 — JSON output
When to use
When the output needs to feed into another system, spreadsheet, or the next step in an AI pipeline.
Template
Read this [input] and respond ONLY with a JSON object.
Do not include any explanation, preamble, or markdown formatting.
Use exactly this structure:
{
"field1": "value or null",
"field2": "value or null"
}
Example
Read this maintenance request and respond ONLY with a JSON object.
Do not include any explanation or markdown formatting.
Use exactly this structure:
{
"category": "plumbing / electrical / structural / general",
"priority": "high / medium / low",
"unit_number": "value or null",
"summary": "one sentence"
}
Watch out
JSON output prevents format errors but does not prevent Claude from inventing values for fields when the information is absent. Use null as the value type for optional fields, not an empty string.
Pattern 3.3 — Retry with error feedback
When to use
When Claude's output fails a format check. Send the original input, the failed output, and the specific error.
Template
Your previous response contained an error.
Original input: [paste original]
Your output: [paste failed output]
Error: [describe exactly what was wrong]
Please correct only the error and resubmit.
Example
Your previous response contained an error.
Original input: Invoice dated 15 March 2024
Your output: due_date: "15 March 2024"
Error: The due_date field must be in DD/MM/YYYY format.
Please correct only the error and resubmit.
Watch out
Only retry for format errors. If the information was genuinely not in the source document, retrying will not help — Claude will either repeat "Not found" or fabricate a value.
Category 4 — Managing context and long conversations
Pattern 4.1 — Persistent facts block
When to use
When specific facts must survive a long conversation without being summarised or compressed into vague descriptions.
Template
CASE FACTS (do not summarise — always include verbatim):
[Fact label]: [exact value]
[Fact label]: [exact value]
[Fact label]: [exact value]
[Rest of your message]
Example
CASE FACTS (do not summarise — always include verbatim):
Customer name: Maria Santos
Order number: ORD-44729
Amount disputed: £189 charged, £139 expected
Date noticed: 14 February
The customer has just replied saying the charge is still showing on her bank statement.
Pattern 4.2 — Fresh start with summary injection
When to use
When resuming a long task in a new session, or when context has become stale after files or data changed.
Template
New session. Here is a summary of what was found in the previous session:
[Structured summary of findings]
[List of files or items already reviewed]
[Outstanding items not yet covered]
Continue from where we left off, starting with [next item].
Example
New session. Here is a summary of findings from the previous session:
Files reviewed: auth.js, user.service.js, payment.controller.js
Issues found: 3 input validation gaps in payment.controller.js (lines 44, 67, 112)
Files not yet reviewed: order.service.js, invoice.controller.js
Continue from where we left off, starting with order.service.js.
Category 5 — System prompts for agents
Pattern 5.1 — Agent system prompt structure
When to use
When setting up any agent that will handle real tasks for a client. Use this structure as your starting point every time.
Template
ROLE
You are a [specific role] for [client/context].
SCOPE
You handle: [list what it does]
You do NOT handle: [list explicit exclusions]
PROCESS
[Step-by-step instructions for how to handle a task]
OUTPUT FORMAT
[Exact template to use for every response]
ESCALATION
Escalate to a human immediately if:
- [Trigger 1]
- [Trigger 2]
- The customer explicitly requests a human
Example
ROLE
You are a maintenance request handler for UrbanNest property management.
SCOPE
You handle: categorising requests, setting priority, sending acknowledgements.
You do NOT handle: approving repairs, contacting contractors, or policy exceptions.
PROCESS
1. Read the request and identify the issue type.
2. Assign a category and priority.
3. Draft a tenant acknowledgement.
ESCALATION
Escalate immediately if:
- The tenant mentions water damage, gas, or fire
- The tenant has reported the same issue 3+ times
- The tenant explicitly requests to speak with a manager
Watch out
The SCOPE section — especially what the agent does NOT handle — is as important as the rest. It is what prevents Claude from improvising decisions it should not be making.
Pattern 5.2 — Subagent context passing
When to use
When passing information from one agent to the next in a multi-agent pipeline. Always include both content and metadata.
Template
You are receiving findings from a previous research agent.
Do not re-investigate these findings. Use them as your source material.
FINDINGS FROM [AGENT NAME]:
---
Claim: [finding]
Source: [URL or document name]
Date: [publication date]
Excerpt: "[relevant quote]"
---
[Repeat for each finding]
Your task: [what the subagent should do with this information]
Example
You are receiving findings from the web research agent.
Do not re-investigate. Use these as your source material.
FINDINGS:
---
Claim: The UK solar installation market grew 34% in 2023.
Source: energymonitor.ai/solar-report-2023
Date: January 2024
Excerpt: "Residential solar installations rose 34% year-on-year..."
---
Your task: Synthesise these findings into a 3-paragraph market summary.
Watch out
If you omit the Source and Date fields, the synthesised report will contain claims with no attribution. Once attribution is lost at this step, it cannot be recovered later.
Quick reference — words and phrases that matter
Instruction words that improve reliability
| "exactly" | Signals precision required — Claude should not paraphrase or reformat. |
| "only if" | Restricts when an action should be taken. Use instead of vague guidance. |
| "do not" | Explicit exclusions are more reliable than hoping Claude infers them. |
| "in this order" | Forces sequential execution when step order matters. |
| "verbatim" | Do not paraphrase or summarise this — reproduce it exactly. |
| "Not found" | Valid answer for absent fields. Prevents fabrication. |
Phrases to avoid
| "Be conservative" | Vague. Define what conservative means in concrete terms. |
| "Use your judgement" | Produces inconsistent results. Specify the criteria instead. |
| "If relevant" | Claude's idea of relevant may differ from yours. Be explicit. |
| "As appropriate" | Ambiguous. Write the rule that defines "appropriate." |
| "Be careful" | Means nothing specific. Describe what to be careful about. |
Output format keywords
| JSON | Machine-readable structured output. Use for pipelines and integrations. |
| Template | Fixed fields the client can read directly. Use for human-facing output. |
| Bullet list | Good for enumerated findings. Specify max number if needed. |
| Table | Best for financial data and side-by-side comparisons. |
| Prose | Best for narrative content — news, reports, summaries. |