Prompt Engineering Patterns: Proven Techniques
By Marcin Piekarski builtweb.com.au · Last Updated: 11 February 2026
TL;DR: Master advanced prompting techniques: chain-of-thought, few-shot, role prompting, and more. Get better AI outputs with proven patterns.
TL;DR
Advanced prompting patterns improve AI outputs: chain-of-thought for reasoning, few-shot for examples, role prompting for expertise, and structured outputs for consistency.
Chain-of-Thought (CoT)
Concept: Ask AI to "think step-by-step"
Example:
- Without: "What's 15% tip on $47?"
- With CoT: "What's 15% tip on $47? Think step-by-step."
- AI: "1. Calculate 15% of $47: 0.15 × 47 = 7.05. 2. The tip is $7.05."
When to use: Math, logic, complex reasoning
Few-Shot Prompting
Concept: Provide examples before asking
Example:
Classify sentiment:
"I love this!" → Positive
"Terrible experience" → Negative
"It's okay" → Neutral
"Best purchase ever" → ?
AI: "Positive"
When to use: Classification, formatting, style matching
Zero-Shot Prompting
Concept: No examples, just ask directly
Example: "Summarize this article in 3 sentences."
When to use: General tasks, when examples are hard to provide
Role Prompting
Concept: Ask AI to adopt a persona
Example:
- "You are an expert SQL developer. Write a query to..."
- "You are a kindergarten teacher. Explain photosynthesis..."
When to use: Need domain expertise or specific tone
Constrained Output
Concept: Specify exact output format
Example:
Extract info and return as JSON:
{
"name": "",
"email": "",
"phone": ""
}
When to use: Structured data extraction, API responses
ReAct (Reasoning + Acting)
Concept: AI reasons, acts, observes, repeats
Example:
Question: What's the weather in Paris?
Thought: I need to search for Paris weather
Action: Search "Paris weather"
Observation: 15°C, cloudy
Thought: I have the answer
Answer: It's 15°C and cloudy in Paris.
When to use: Multi-step tasks, tool use
Self-Consistency
Concept: Generate multiple answers, pick most common
Process:
- Ask same question with temperature > 0
- Generate 5-10 responses
- Return most frequent answer
When to use: Critical tasks, reduce hallucinations
Negative Prompting
Concept: Tell AI what NOT to do
Example:
- "Explain AI. Don't use jargon. Don't exceed 100 words. Don't assume technical background."
When to use: Avoid common mistakes, control output
Prompt Chaining
Concept: Break complex tasks into steps
Example:
- First prompt: "List main points from this article"
- Second prompt: "For each point, provide supporting evidence"
- Third prompt: "Write a summary integrating all points"
When to use: Complex tasks, exceeding context limits
Meta-Prompting
Concept: Ask AI to improve your prompt
Example:
- "I want to write better product descriptions. Suggest a good prompt for that."
When to use: Learning, optimization
Best practices
Be specific:
- "Write a 200-word email" > "Write an email"
Provide context:
- "For a technical audience familiar with AI"
Use delimiters:
- Use
triple backticksfor code - Use """ for text blocks
Iterate:
- Start simple, add constraints
- Test and refine
Common mistakes
- Too vague ("Tell me about AI")
- Too complex (multiple tasks in one prompt)
- No examples when needed
- Assuming AI knows your context
Template example
[Role]: You are an expert [domain]
[Context]: The user is [description]
[Task]: [Specific request]
[Constraints]: [Format, length, style]
[Examples]: [If needed]
What's next
- Prompting 101 (basics)
- Evaluating AI Answers
- Advanced Prompt Optimization
Frequently Asked Questions
Which prompting pattern should I learn first?
Start with chain-of-thought and few-shot prompting. Chain-of-thought improves reasoning accuracy by asking the AI to think step-by-step. Few-shot prompting lets you show examples of what you want. Together, these two patterns handle most common use cases.
Can I combine multiple prompting patterns in one prompt?
Yes, and this is often the best approach. For example, you can combine role prompting with chain-of-thought and constrained output: give the AI an expert role, ask it to reason step-by-step, and specify JSON output format. Layer patterns as needed for your task.
Do these patterns work with all AI models?
Most patterns work across ChatGPT, Claude, Gemini, and other major models. Chain-of-thought and few-shot prompting are nearly universal. Some patterns like ReAct work best with models that support tool use. Test with your specific model to confirm effectiveness.
When should I use few-shot versus zero-shot prompting?
Use zero-shot for simple, well-defined tasks where the AI likely understands what you want. Use few-shot when you need specific formatting, classification categories, or a particular style. If zero-shot results are inconsistent, adding 2-3 examples usually fixes the problem.
Was this guide helpful?
Your feedback helps us improve our guides
About the Authors
Marcin Piekarski· Frontend Lead & AI Educator
Marcin is a Frontend Lead with 20+ years in tech. Currently building headless ecommerce at Harvey Norman (Next.js, Node.js, GraphQL). He created Field Guide to AI to help others understand AI tools practically—without the jargon.
Credentials & Experience:
- 20+ years web development experience
- Frontend Lead at Harvey Norman (10 years)
- Worked with: Gumtree, CommBank, Woolworths, Optus, M&C Saatchi
- Runs AI workshops for teams
- Founder of builtweb.com.au
- Daily AI tools user: ChatGPT, Claude, Gemini, AI coding assistants
- Specializes in React ecosystem: React, Next.js, Node.js
Areas of Expertise:
Prism AI· AI Research & Writing Assistant
Prism AI is the AI ghostwriter behind Field Guide to AI—a collaborative ensemble of frontier models (Claude, ChatGPT, Gemini, and others) that assist with research, drafting, and content synthesis. Like light through a prism, human expertise is refracted through multiple AI perspectives to create clear, comprehensive guides. All AI-generated content is reviewed, fact-checked, and refined by Marcin before publication.
Transparency Note: All AI-assisted content is thoroughly reviewed, fact-checked, and refined by Marcin Piekarski before publication.
Key Terms Used in This Guide
Prompt
The text instruction you give to an AI model to get a response. The quality and specificity of your prompt directly determines the quality of the AI's output.
Chain-of-Thought
A prompting technique that asks AI to show its reasoning step-by-step, improving accuracy on complex tasks like maths, logic, and multi-step problem-solving.
AI (Artificial Intelligence)
Making machines perform tasks that typically require human intelligence—like understanding language, recognizing patterns, or making decisions.
Related Guides
Prompt Engineering: The Complete Masterclass
IntermediateGo from prompting basics to advanced techniques. A comprehensive A-Z guide covering everything from simple prompts to production-grade prompt systems.
18 min readContext Engineering: Beyond Prompt Engineering
IntermediateThe 2026 paradigm shift from crafting prompts to engineering entire context windows. Learn to design the informational environment that makes AI systems reliable.
12 min readPrompting 201: Structured Prompts & JSON Output
IntermediateAdvanced prompting: structured formats, JSON output, few-shot learning, chain-of-thought, and prompt templates for production.
11 min read