Prompt Engineering · Shot Prompting

Zero · One · Few-Shot Prompting

The "shot" in prompting refers to how many examples you provide. Zero examples (zero-shot), one example (one-shot), or many examples (few-shot) — each technique serves a different purpose and produces different results.

🎯 Zero-Shot📸 One-Shot🎬 Few-Shot📋 Pattern Learning

What is "Shot" Prompting?

The term "shot" comes from machine learning research, specifically from GPT-3 (2020), which demonstrated that language models could perform tasks with just a few examples in the prompt — without any gradient updates (training). A "shot" is a single example of input → desired output.

📖 Why Claude Learns From Examples in the Prompt

Claude is a large language model trained to predict the most likely continuation of text. When you provide examples in your prompt, you're essentially showing Claude the pattern you want it to continue. It's not "learning" in a permanent sense — the examples just establish a very strong prior for what the task looks like and what successful completion looks like.

Zero-Shot Prompting

Zero-shot means giving Claude a task with no examples — just instructions. You're relying on Claude's pre-trained knowledge to understand what you want.

Zero-shot works best when:

Zero-Shot Examples

👤 Zero-Shot — Translation
Translate the following English sentence to French: "Machine learning is transforming every industry in the modern economy."
👤 Zero-Shot — Summarization
Summarize the following research paper abstract in 2 sentences: [abstract text]
👤 Zero-Shot — Code
Write a Python function that takes a list of numbers and returns the second-largest value. Handle edge cases.
💡 When Zero-Shot Fails

If your zero-shot prompt produces outputs in the wrong format, style, or with wrong assumptions, that's your signal to add examples (one-shot or few-shot). The failure mode is often Claude being correct but not in the specific way you needed.

One-Shot Prompting

One-shot prompting means providing exactly one example before your actual request. This single example acts as a template that Claude will use to understand the format, style, and approach you want.

One-shot is ideal when you want Claude to match a specific style or format that's hard to describe in words but easy to demonstrate once.

One-Shot Example — Vocabulary Flashcards

👤 One-Shot Prompt
Generate vocabulary flashcards for my GRE prep. Use this exact format: EXAMPLE: Word: Obfuscate Definition: To make unclear or confusing; to muddle or obscure Etymology: Latin "obfuscare" (to darken) Sentence: "The politician's answer only served to obfuscate the real issue." Memory Hook: "OB-FUSK-ATE" → Picture a frog (frog sounds like "fusk") sitting in dark fog, making things hard to see Difficulty: ★★★☆☆ Now generate 8 more flashcards in this exact format for these words: ephemeral, laconic, sycophant, perfidious, munificent, obdurate, equivocate, loquacious

The single example taught Claude: field names, emoji usage, difficulty rating, memory hook style, etymology inclusion — all without needing to describe each element separately.

One-Shot Example — Meeting Notes

👤 One-Shot — Meeting Notes Format
Format raw meeting notes into structured summaries. Use this format: EXAMPLE INPUT: "we talked about the budget, sarah said we're 20k over, john wants to cut the marketing spend, meeting next tuesday" EXAMPLE OUTPUT: 📋 Meeting Summary Date: [Date not specified] Attendees: Sarah, John Key Discussion: Budget overrun — current spend is $20K above target Decision: Proposed cutting marketing spend (John's recommendation) Action Items: - [ ] Follow-up meeting scheduled for Tuesday Now format these raw notes: "[paste your notes here]"

Few-Shot Prompting

Few-shot prompting means providing 2 to ~10 examples before your actual request. Multiple examples allow Claude to infer a more complex or nuanced pattern.

Few-shot is most valuable when:

Few-Shot Example — Sentiment Classification

👤 Few-Shot — Sentiment Classifier
Classify student feedback as POSITIVE, NEGATIVE, or MIXED. Use these examples: Review: "The professor explains concepts clearly and is always available during office hours." Classification: POSITIVE Reason: Clear praise of explanation quality and accessibility Review: "The content is interesting but assignments are unreasonably long." Classification: MIXED Reason: Positive on content, negative on workload Review: "Lectures are boring, slides are outdated, and grading is inconsistent." Classification: NEGATIVE Reason: Multiple distinct criticisms, no positive elements Review: "I love the hands-on projects, though the deadlines could be more flexible." Classification: MIXED Reason: Strong positive (projects) with moderate negative (deadlines) Now classify these reviews: 1. "Great textbook choices but the TA support is terrible." 2. "Best class I've taken. Challenging but incredibly rewarding." 3. "Waste of time. Nothing practical, pure theory." 4. "Decent course overall, some lessons could be cut for being too repetitive."
🤖 Claude — Consistent, Formatted Output
Review 1: "Great textbook choices but the TA support is terrible." Classification: MIXED Reason: Clear positive (textbook selection) paired with clear negative (TA support) Review 2: "Best class I've taken. Challenging but incredibly rewarding." Classification: POSITIVE Reason: Superlative praise; the "challenging" aspect is framed positively as rewarding Review 3: "Waste of time. Nothing practical, pure theory." Classification: NEGATIVE Reason: Explicit dismissal ("waste of time") with specific criticism Review 4: "Decent course overall, some lessons could be cut for being too repetitive." Classification: MIXED Reason: Moderately positive overall ("decent") with specific negative (repetition)

Few-Shot Example — Writing Tone Matching

👤 Few-Shot — Match My Writing Voice
I want you to write in my personal essay voice. Study these samples of my writing: Sample 1: "The library smelled like possibility — that particular combination of old paper and ambition that only universities can manufacture." Sample 2: "Professor Chen had a talent for making you feel simultaneously stupid and inspired, which I suspect was entirely intentional." Sample 3: "There's a special kind of exhaustion that comes from caring deeply about something you're failing at spectacularly." Now in my voice, write an opening paragraph for an essay about learning to code for the first time.

Decision Guide: When to Use Each Technique

SituationBest TechniqueReasoning
Translating text, summarizingZero-ShotCommon tasks Claude already knows well
Matching a specific template/formatOne-ShotOne example efficiently demonstrates the pattern
Consistent classification across itemsFew-Shot (3-5)Multiple examples establish nuanced decision rules
Matching your personal writing styleFew-Shot (3-6)More samples = better voice calibration
Data extraction/transformationOne or Few-ShotShows input→output structure clearly
Creative tasks with open formatZero-Shot + iterationExamples can be too constraining for creativity
High-stakes, must-be-consistent tasksFew-ShotMinimizes format drift across many outputs

Example Quality Matters More Than Quantity

🔑 The Golden Rule of Few-Shot

Three excellent examples outperform ten mediocre examples. Bad examples can actively confuse Claude by introducing inconsistent patterns. Always make sure your examples are:

Bad vs Good Few-Shot Examples

❌ Inconsistent Examples
Q: Capital of France? A: Paris. Q: What's 2+2? A: The answer is 4! Q: Who wrote Hamlet? A: It was William Shakespeare who composed this famous play.

3 different response styles — Claude doesn't know which to follow.

✅ Consistent Examples
Q: Capital of France? A: Paris Q: What's 2+2? A: 4 Q: Who wrote Hamlet? A: Shakespeare

Same format every time — Claude will match this pattern reliably.

Student Use Case Examples

Academic Citation Formatter (One-Shot)

👤 One-Shot — Citation Formatting
Format bibliographic information into APA 7th edition citations. EXAMPLE: Input: Author: Johnson, M. Year: 2022. Title: Computational Thinking in Schools. Journal: Educational Technology Research. Volume 15, Issue 3, Pages 45-62. APA Output: Johnson, M. (2022). Computational thinking in schools. Educational Technology Research, 15(3), 45–62. Now format these: 1. Author: Chen, L & Park, S. Year: 2023. Title: Federated Learning Privacy Challenges. Journal: IEEE Transactions on Parallel Systems. Volume 34, Issue 8, Pages 201-215. 2. Author: Williams, K. Year: 2021. Title: Bias in Machine Learning Models. Journal: AI Ethics Journal. Volume 6, Issue 1, Pages 12-29.

Lab Report Analysis (Few-Shot)

👤 Few-Shot — Lab Data Analysis
Analyze experimental results and provide a structured interpretation. Follow this format: OBSERVATION: [what the data shows] INTERPRETATION: [what this likely means scientifically] CONFIDENCE: [HIGH / MEDIUM / LOW] — [brief reason] POSSIBLE ERRORS: [experimental factors that could explain anomalies] Example 1: Data: Control group: 98.6°F avg. Treatment group: 102.1°F avg. N=30 each. OBSERVATION: Treatment group shows 3.5°F temperature elevation over controls INTERPRETATION: The treatment likely induces a febrile response, suggesting immune system activation CONFIDENCE: HIGH — large sample size, clear numerical separation POSSIBLE ERRORS: Environmental temperature variations; subject activity level before measurement Example 2: Data: Reaction time without caffeine: 287ms avg. With caffeine: 241ms avg. N=12. OBSERVATION: Caffeine associated with 46ms (16%) faster reaction time INTERPRETATION: Caffeine may enhance CNS alertness and motor response speed CONFIDENCE: MEDIUM — improvement is meaningful but sample size is small POSSIBLE ERRORS: Practice effect (second test always faster); expectation bias; caffeine dosage variation Now analyze: [your data here]
🎓 Quick Reference Card