Skip to main content
Building with AI (Vibe Coding)

⏱ About 15 min15 XP

Showing Examples

Words are slippery. If you tell someone you want a 'professional-looking' header, you and they may picture completely different things. But if you show them a screenshot of a header you like, you both instantly share the same image. Examples short-circuit the ambiguity of description. They show, rather than tell, exactly what you mean. In prompting, examples are one of the most powerful tools you have. They are so powerful that researchers gave this technique a formal name: few-shot prompting. Giving the AI one or a few examples of what you want — inputs and outputs — is often worth paragraphs of description.

What Examples Communicate

An example transmits several things at once that words alone struggle to capture: Format: If you show the AI one output in a specific format, it will match that format for the rest. Trying to describe a format in words often leaves gaps that an example fills instantly. Tone and style: Writing tone is notoriously hard to describe. 'Friendly but professional' means different things to different people. One example sentence in the tone you want communicates the target better than a dozen adjectives. Scope and depth: An example shows the AI how long, how detailed, and how technical the output should be. If your example is three bullet points, the AI understands three bullet points is roughly the right depth — not one, not ten. Pattern: When you give multiple examples, the AI can identify the pattern and apply it to new cases. This is especially powerful for data transformation, formatting, and generating variations on a template.

Few-Shot Prompting

Few-shot prompting is the technique of including one or more input-output examples in your prompt so the AI can match the pattern. 'Zero-shot' means no examples — just a description. 'One-shot' means one example. 'Few-shot' means two to five. More examples narrow the target faster than longer descriptions.

Here is a concrete case. You are building a quiz app and want a specific format for each question object in JSON. You could describe it: 'Each question should be an object with a question string, an array of four answer strings, and a number indicating the correct answer index.' Or you could show it: { "question": "What is the capital of France?", "answers": ["London", "Berlin", "Paris", "Madrid"], "correct": 2 } Now write three more questions about world geography in the same format. The example removes all ambiguity about field names, data types, and structure. The AI matches it precisely. Description alone would leave room for a dozen different interpretations.

How to Use Examples Effectively

A few guidelines make your examples more useful: Make examples realistic. Use actual content, not placeholder text like 'example question here.' The AI learns from the content of your examples, not just their structure. Keep examples consistent. If your examples contradict each other — one has three answer choices, one has four — the AI will not know which pattern to follow. Label what the example is. A short note before the example helps: 'Here is one question in the format I need:' or 'Here is the style of headline I want:' Without the label, the AI might treat the example as part of the task. Use examples alongside descriptions, not instead of them. Examples show format and style best. Descriptions still handle requirements that examples cannot show — for instance, 'avoid questions about religion' is a constraint that no example can communicate.

When Description Fails, Show One

If you have tried describing what you want and the AI keeps missing the mark, stop describing and add an example of the output you want. Often one concrete example resolves mismatches that ten sentences of description could not.

Complete each sentence about few-shot prompting.

Including examples in a prompt is called prompting. A prompt with zero examples is called , while one with two to five is called few-shot. Examples communicate format, tone, and more precisely than words alone.

What does few-shot prompting mean?

Which situation would benefit MOST from adding an example to a prompt?

Show, Don't Tell

  1. Step 1: Pick a type of content you might ask an AI to generate repeatedly: quiz questions, social media posts, vocabulary definitions, story prompts, product descriptions.
  2. Step 2: Write a description-only prompt asking for three more in that style.
  3. Step 3: Now write a single realistic example of what you want.
  4. Step 4: Combine them: place the example in your prompt with a label, then ask for three more.
  5. Step 5: Compare the two prompts. Which one do you think would produce more consistent results, and why? Write two sentences explaining your reasoning.