Prompt Engineering Techniques
Go beyond basic prompting. Learn zero-shot, few-shot, chain-of-thought, and system messages to consistently get better AI responses.
Beyond Basic Prompts
You know how to write decent prompts. Now let’s explore the techniques that professionals use to get consistently excellent results.
Zero-Shot: Just Ask
The simplest technique. You give the AI a task with no examples:
“Classify this customer review as positive, negative, or neutral: ‘The delivery was late but the product quality is amazing.’”
Works well for straightforward tasks. If results are inconsistent, try the next technique.
Few-Shot: Show by Example
Give the AI 2-3 examples before your actual request:
“Classify these customer reviews:
Review: ‘Absolutely love it!’ → Positive Review: ‘Broke after two days’ → Negative Review: ‘It’s okay, nothing special’ → Neutral
Now classify: ‘The delivery was late but the product quality is amazing.’”
Few-shot is remarkably effective. The AI picks up your exact format, style, and criteria from the examples.
Chain-of-Thought: Think Step by Step
For complex problems, ask the AI to show its reasoning:
“A store has 15 apples. They receive 3 boxes with 8 apples each. They sell 12 apples. How many are left? Let’s think step by step.”
The AI will break it down:
- Start with 15 apples
- Add 3 × 8 = 24 apples → 39 total
- Sell 12 → 39 - 12 = 27 apples
Without chain-of-thought, AI often gets math and logic wrong. With it, accuracy jumps dramatically.
System Messages
System messages set the AI’s behaviour for an entire conversation. They’re like giving your assistant a job description:
System: “You are a concise financial advisor for young professionals. Always explain terms in plain English. Give specific, actionable advice. Never give guarantees about returns. End each response with one action step.”
This shapes every response the AI gives. Most AI apps let you set custom instructions that work like system messages.
Structured Output
Need AI to respond in a specific format? Tell it:
“Analyse this business idea and respond in exactly this format: VIABILITY: [High/Medium/Low] KEY RISK: [one sentence] FIRST STEP: [one sentence] ESTIMATED COST: [range]”
Structured output makes AI responses consistent and easy to use in workflows.
Combining Techniques
The real power comes from combining these:
- System message sets the persona and rules
- Few-shot examples show the expected format
- Chain-of-thought ensures thorough reasoning
- Structured output makes the response usable
Practice: Take a task you regularly use AI for. Try it with zero-shot, then few-shot, then chain-of-thought. Compare the results — you’ll see a clear quality improvement with each technique.
Quick Quiz
Test what you just learned. Pick the best answer for each question.
Q1 What is 'zero-shot' prompting?
Q2 What makes 'few-shot' prompting powerful?
Q3 What is chain-of-thought prompting?
Q4 What is a 'system message' or 'system prompt'?