Table of Contents
Quick Answer
Few-shot prompting means showing the model 1-5 examples of the input-output pairs you want before asking for the real one. In 2026 it's still the most reliable way to lock in format and tone.
- 1-3 examples beat instructions for format matching
- Always use the exact format you want in the output — the model copies structure
- Use few-shot for consistency; use CoT for reasoning (combine both for best)
Prompt Examples
Classify the sentiment of the following reviews as Positive, Negative, or Neutral. Respond with only the label. Example 1: "The product broke in a week." -> Negative. Example 2: "Works exactly as advertised." -> Positive. Example 3: "It's okay I guess." -> Neutral. Now: "Shipping was slow but the quality is great." ->
Convert the following user requests into SQL queries against the
orderstable (id, user_id, total, created_at). Example: "How much did I spend in July?" -> SELECT SUM(total) FROM orders WHERE user_id = :me AND created_at BETWEEN '2026-07-01' AND '2026-07-31'; Example: "Show my last 5 orders." -> SELECT * FROM orders WHERE user_id = :me ORDER BY created_at DESC LIMIT 5; Now: "What was my biggest purchase this year?"Rewrite the following sentences in the style of Hemingway (short, concrete, no adverbs). Example: "She was walking quickly through the incredibly foggy streets." -> "She walked fast. The fog was thick." Example: "He felt extraordinarily sad about losing his beloved dog." -> "His dog was gone. He was sad." Now: [paste sentence].
Extract entities from news headlines. Output as JSON with keys "person", "org", "location". Example: "Tim Cook Announces Apple Vision Pro 2 in Cupertino" -> {"person": "Tim Cook", "org": "Apple", "location": "Cupertino"}. Example: "Reuters: Sam Altman Meets World Leaders in Davos" -> {"person": "Sam Altman", "org": "Reuters", "location": "Davos"}. Now: [paste headline].
Write email subject lines for cold outreach. Format: under 40 chars, one specific fact, no emojis, ends with a hook. Example: Context: "prospect got Series A, we sell churn tools." -> "Series A congrats + your first churn cliff". Example: Context: "prospect just launched a podcast, we do transcription." -> "Your new podcast + 3 minutes saved per ep". Now: Context: [paste].
Summarize research papers into structured abstracts. Example: Input: "Paper on LLM hallucination rates…" -> Title: [title]. Problem: hallucinations in LLMs. Method: benchmark of 12 models on 5 tasks. Finding: best model hallucinated 2% of the time. Limitation: only English tasks. Now: [paste paper excerpt].
Generate Git commit messages following Conventional Commits. Example: Diff: "added login button." -> "feat(auth): add login button to header". Example: Diff: "fixed typo in readme." -> "docs(readme): fix typo in setup instructions". Now: Diff: [paste].
Translate product descriptions into Spanish while keeping brand name untouched and preserving markdown. Example: "Acme Pro is the best CRM for teams." -> "Acme Pro es el mejor CRM para equipos." Example: "## Features - Fast - Secure" -> "## Caracteristicas - Rapido - Seguro". Now: [paste].
Write user stories in the format "As a [role], I want [goal] so that [benefit]." Example: feature: dark mode toggle -> "As a user who reads at night, I want a dark mode toggle so that I can reduce eye strain." Example: feature: CSV export -> "As a finance analyst, I want to export data to CSV so that I can run custom analysis in Excel." Now: feature: [paste].
How to Customize
- Use 1-3 examples for format, 3-5 for tone, 5+ for subtle style
- Make examples diverse — cover edge cases
- Format examples identically to the target output
- Put the real task last — recency bias helps
Common Mistakes
- Examples that don't match the target format — model copies wrong structure
- Biased example set — 3 positives + 1 negative skews the classifier
- Examples too simple — model can't generalize to real complexity
- Forgetting the "Now:" prefix — model sometimes appends another example instead of answering
Top Tools
| Tool | Strength | Free Tier | Best Use Case |
|---|---|---|---|
| GPT-5 | Fast few-shot | Yes | Any task |
| Claude 4.6 | Long examples (1M ctx) | Yes | Document transforms |
| Gemini 2.5 Pro | Multimodal few-shot | Yes | Image + text |
| DSPy | Auto-optimize prompts | Yes | Production |
| PromptHub | Versioning | Yes | Teams |
Conclusion
Few-shot prompting is deceptively simple — show, don't tell. Master it and you'll get consistent JSON, cleaner classifications, and brand-matching copy without fine-tuning.
Documenting your prompt library? Host your prompt collection on Misar.Blog — code-friendly editor, searchable archive.
