Back to Certificate in Prompt Engineering & Generative AI
Module 2 of 4

Module 2 — Core Prompting Techniques

Zero-shot promptingFew-shot prompting with examplesRole and persona promptingInstruction clarity and constraint setting

Zero-Shot & Few-Shot Prompting

Zero-shot prompting asks the model to perform a task with no examples — relying entirely on its pre-trained knowledge.

Example: "Classify this review as positive or negative: 'The product arrived late but the quality exceeded my expectations.'"

This works for well-defined, common tasks where the model's training data includes similar patterns.

Few-shot prompting provides examples before the task, teaching the model the pattern you want:

"Classify these reviews: Review: 'Absolutely love it!' → Positive Review: 'Worst purchase ever' → Negative Review: 'It works but nothing special' → Neutral Review: 'The product arrived late but the quality exceeded my expectations.' → "

The model learns from the pattern of examples and applies it to the new input. Few-shot prompting dramatically improves performance on tasks where the desired output format, classification criteria, or reasoning style isn't obvious from a simple instruction.

Best practices for few-shot: use diverse examples that cover edge cases, maintain consistent formatting, place examples before the task (not after), and use 3-5 examples (more doesn't always help and wastes context window).

Role Prompting & Instruction Clarity

Role prompting assigns a persona to the AI, which shapes its tone, expertise level, and approach:

"You are a senior financial analyst with 20 years of experience in emerging markets. Analyse the following investment opportunity..."

This leverages the model's training on domain-specific text, effectively priming it to generate responses consistent with that role's expertise and communication style.

Effective roles include: specific professions (tax attorney, paediatric nurse), expertise levels (expert, beginner-friendly teacher), communication styles (formal report writer, conversational explainer), and perspectives (devil's advocate, optimistic innovator).

Instruction clarity is the most impactful prompting skill. Clear instructions include:

Specificity: "Write a 200-word product description" beats "Write about this product." Format specification: "Respond in bullet points" or "Present as a numbered list with headers." Constraints: "Do not include technical jargon" or "Focus only on the financial aspects." Context: "The audience is C-suite executives with no technical background." Output quality criteria: "Include specific examples" or "Support each point with evidence."

The most common prompting mistake is vagueness. "Help me with marketing" is a bad prompt. "Write three email subject lines for a Black Friday sale targeting existing customers who bought electronics in the past 6 months, aiming for a 25%+ open rate" is excellent.

Key Takeaways

  • Zero-shot works for common tasks; few-shot teaches the model new patterns through examples
  • 3-5 diverse examples with consistent formatting optimise few-shot performance
  • Role prompting primes the model to generate domain-appropriate responses
  • Clear, specific instructions with format, constraints, and context produce the best results
  • Vagueness is the enemy of good prompting — be precise about what you want

Exercises & Activities

practical

Prompt Optimisation Challenge

For each task below, write an optimised prompt using the techniques from this module. Include role, specific instructions, format, and constraints. (1) Summarise a quarterly earnings report for a board meeting, (2) Generate customer interview questions for a new fitness app, (3) Write a professional rejection email for a job applicant, (4) Create a social media content calendar for a restaurant, (5) Analyse the pros and cons of remote work for a consulting firm.

practical

Before & After Prompt Improvement

Take these vague prompts and rewrite them as effective prompts: (1) 'Help me write a blog post' (2) 'Analyse this data' (3) 'Give me marketing ideas' (4) 'Write a presentation.' For each, show the weak prompt, your improved version, and explain which techniques you applied (role, specificity, format, constraints).

Interactive AI Tutor Session

Copy this prompt and paste it into your preferred AI assistant (ChatGPT, Claude, Gemini) to begin your interactive tutoring session for this module.

"You are a prompt engineering master instructor. Teach the student the fundamental prompting techniques: zero-shot, few-shot, and role-based prompting. Provide before/after examples showing how each technique improves output quality. Give the student five tasks and ask them to write optimised prompts for each, then evaluate their prompts and suggest improvements."