One-Shot Prompting

One-shot prompting means providing one example of the desired output before asking the model to complete the task.

The example is a template. It tells the model about format, tone, length, and style without you having to describe any of those things in words. The model infers the pattern from the example and applies it to your new input.

Structure

A one-shot prompt looks like this:

Here's an example of [what you want]:
[YOUR EXAMPLE]

Now [do the same thing] for [new input].

Concrete version:

Here's a tagline I like for a pair of running shoes:
"Built for the miles you haven't run yet."

Write a tagline in the same style for a reusable water bottle.

Without the example, you'd get a generic tagline. With it, the model has something to match — a punchy, second-person, forward-looking tone that you couldn't easily describe in words.

Why showing beats telling

Describing a style is harder than demonstrating it. "Write something punchy but not cliché, in a second-person voice, present tense, under 10 words" is harder to write than just pasting a single example that has all those properties. The model picks up the pattern from the example itself.

That said, the quality of the example matters. A weak example gets a weak result. Paste something you actually like.

When one-shot adds real value

One-shot helps most when:

  • The output needs a specific style that's hard to describe
  • You want a consistent format (an HTML component, a JSON structure, a bio template)
  • You're doing tone or voice matching (generating something in your own writing style)

For simple, well-known tasks, a good zero-shot prompt with clear instructions often works just as well. One-shot adds value when the desired output has a specific shape.

Using it for web development

One-shot is particularly useful when generating HTML and CSS components that match an existing page. Instead of describing what you want, paste an existing element as the example:

Here's a card component from my page:
[paste your existing HTML block]

Write a new card in the same style for: [description of new content].

The model matches your classes, your tag choices, your spacing patterns — things that would take paragraphs to describe but are obvious from a single example.

Run the output in the browser. See what's right, see what's off. If the style doesn't match perfectly, re-prompt with more specific corrections.