Examples
Show the AI what good looks like
Describing a style in words is hard. Showing it is easy. Adding examples to your prompt is one of the quickest ways to get the exact format you want.
Why examples work
Imagine teaching someone to fold a paper airplane. You could explain each fold. Or you could fold one in front of them. Most people learn faster from the second way.
AI works the same. When you show one or two samples, it copies the pattern: the length, the tone, and the layout.
- Zero-shot — you give no examples, only instructions.
- One-shot — you give one example.
- Few-shot — you give two to five examples.
"Shot" just means "example" here. The names sound technical, but the idea is simple.
Zero-shot: instructions only
Zero-shot is what you've done so far. It works well for common tasks where any reasonable answer is fine.
Write a short motivational message for someone who just finished a 7-day habit streak.The answer will be fine, but you can't predict the style. It might be long, use emojis, or sound too formal.
Few-shot: show the pattern
When you want a specific style, show it. Here we give two examples, then ask for a new one.
Write streak messages for my habit tracker app. Match the style of these examples.
Example 1:
Streak: 3 days
Message: Three in a row. You're building something real.
Example 2:
Streak: 10 days
Message: Ten days strong. This is who you are now.
Now write one for:
Streak: 7 days
Message:Let's break this down:
- Both examples are short, calm, and start with the number. The AI notices this.
- The labels
Streak:andMessage:show the exact layout to follow. - Ending with an empty
Message:tells the AI exactly where to fill in.
| Feature | Zero-shot | Few-shot |
|---|---|---|
| Effort to write | Low | Medium |
| Control over style | Low | High |
| Consistent format | Sometimes | Almost always |
| Best for | Common, simple tasks | A specific tone or layout |
Show the format you want
Examples are great for data too. If you're building an app, you often need many items in the same shape. Show one item, and the AI will match it.
I'm adding sample products to my online store. Create 4 more products
in exactly this format:
Name: Linen Table Runner
Price: $34
Category: Kitchen
Description: Soft natural linen, handmade in small batches.
Use handmade home goods only. Keep each description under 12 words.You can also show a "bad" example to steer the AI away from something:
Write a product title for a ceramic mug.
Good: "Speckled Ceramic Mug, 12 oz"
Bad: "AMAZING Best Mug Ever!!! Perfect Gift"
Follow the good style.Using real material as examples
You don't have to write examples yourself. You can paste something you already like.
Here is a README from a project I like:
[paste it here]
Write a README for my habit tracker app using the same sections and tone.Common mistakes
- Giving examples that don't match each other, so the AI can't find a pattern.
- Giving too many examples. Two or three is usually enough.
- Forgetting to say "match this style". Make it clear the examples are a pattern, not content to copy.
- Expecting the AI to copy your example word for word. It copies the pattern, not the exact text.
Practice
Try these exercises to lock in what you just learned.
What's next?
You now know how to get the answer you want. Next, let's learn how to stop the AI from doing things you don't want, with guardrails.