Resource Library
Guide · 6 min read

Prompt Patterns: 10 Practices for Reliable Output

A working reference of ten prompt engineering practices, from few-shot examples to hardening against prompt injection, with a short example for each.

These are ten practices I rely on for getting reliable output from an AI system, with a short example for each. They build on the basics covered in Prompting Fundamentals.

#PracticeWhat to doQuick example
1Pick the right "mode."A conversational prompt is ad hoc and forgiving. A product or system prompt powers real software, so I treat it like production code: version it, test it, monitor it.Product prompt for an email-draft feature: SYSTEM: Draft a friendly reply using {{tone}}. Include {{cta}}.
2Use few-shot prompting.I show a handful of input-output pairs that the model should mimic. This consistently improves accuracy on classification and formatting tasks.Prompt: Classify ICD-10 codes.
EX1: "Broken wrist" → S62.101
EX2: "Type 2 diabetes" → E11.9
User text: "Migraine without aura"
3Decompose tough tasks.I ask the model to break the problem into sub-steps before it attempts to solve it."First list the needed API calls, then write the Python script."
4Add self-criticism.I have the model review and improve its own answer before I see it."Provide a draft, then critique it in three bullets or fewer, then give a final improved version."
5Feed rich, relevant context.I prepend documents, background, or prior messages, with the most important material first.Put the client's last three exchanges above the request so the model has the relevant history.
6Ensemble when the stakes are high.I run several differently worded prompts and take the majority or highest-confidence answer.Three prompts each propose a formula; the version at least two of them agree on is the one I use.
7Use chain-of-thought sparingly.I let the model reason step by step only when I need to see that reasoning. Otherwise I ask it to hide the intermediate steps."Show your step-by-step reasoning, but put only the answer after a line that says FINAL:."
8Skip "role" and "threat" tricks for accuracy.Telling the model it is a Nobel laureate changes its tone, not its correctness, and threatening it tends to hurt rather than help. I reserve role prompts for voice and style, not for accuracy.Creative writing prompt: "Write in the style of a formal legal memo."
9Harden against prompt injection.I assume that any text a user or a document supplies could contain instructions aimed at the model. I use retrieval-time filters, output checks, and logging rather than trusting the input.Sanitize a user-supplied file name before it is included in a prompt that triggers a system action.
10Iterate like software.I test variants, log the failures, and refactor for brevity. Small wording changes can materially change the result.Track prompt versions the same way I track code, and roll back a version if it starts producing more errors.

For a structured way to put this into practice, see Executive AI Fluency Accelerator.