The 8 Prompt Patterns That Survived My Last 6 Months
Six months in production. Patterns that didn't churn out and the ones that did.
1. Role anchoring
Open the prompt with a clear, specific role. Not "you are a helpful assistant" — that's table stakes. "You are a B2B SaaS support agent for {company}; you triage tickets and route to humans when uncertain." The anchor narrows behaviour. Wider anchors drift. Narrower anchors hold.
2. Structured I/O
Always output JSON when downstream code consumes the output. Always validate. When the model outputs malformed JSON, return a "your last output was not valid JSON, try again" turn — don't try-catch and silently fail.
3. Refusal scaffold
Explicitly authorise refusal. List the cases where the model should say "I don't know" or "I can't do that." Default model behaviour skews toward answering; you have to opt in to refusal.
4. Few-shot rotation
Few-shot examples in the prompt drift with traffic. Rotate them based on what's actually showing up in production. I refresh the example set weekly from the previous week's hardest cases.
5. Output validators
For every structured output, write a validator that checks:
- Schema compliance.
- Constraint compliance (e.g., the cited chunk_id actually exists).
- Domain-specific sanity (e.g., a "discount" field is between 0 and 1).
If any validator fails, return the failure to the model and ask it to fix. Don't ship invalid output.
6. Retry-with-correction
When the model fails, return the failure as data and let it self-correct. "Your output had this error: X. Please fix and respond again." This is reliably better than re-prompting from scratch.
7. Lazy elaboration
Don't pre-fill detail you won't use. If the user asks "yes or no?" the agent should answer "yes" or "no" — not a paragraph. Pattern: explicitly tell the model to elaborate only if asked.
8. Privilege walls
Architectural, not prompt-based. The agent that reads user content must not be the same agent (or have the same tool privileges as) the agent that takes destructive actions. Prompt-injection defenses that live entirely inside the prompt fail eventually.
What didn't survive
- "Take a deep breath" / "think step by step" boilerplate. Marginal at best on modern models.
- Long lists of "do not"s. Models have a budget for negative instructions; you blow it past about 5.
- "Pretend you are an expert with 30 years of experience." Pure performance theater.
- Multi-page system prompts. They drift, they overlap, they're hard to maintain. Compose smaller prompts instead.