Home / Glossary / Zero-Shot Prompting
Zero-Shot Prompting
Zero-shot prompting is a technique where you instruct an AI model to perform a task without providing any examples of the desired input-output format. You describe what you want in natural language, and the model relies entirely on its pre-trained knowledge to produce the output. It is the most natural way to interact with AI—just tell it what to do.
When zero-shot prompting works well
Zero-shot prompting works best when the task is well-understood by the model from its training data. Common coding tasks—writing a function to sort an array, creating a REST endpoint, adding input validation—are tasks the model has seen thousands of times in training. For these, a clear instruction is all you need. Zero-shot is also effective when you are using the model's default conventions, since it naturally generates idiomatic code for well-known patterns.
When to upgrade from zero-shot
Zero-shot falls short when you need specific formatting, team conventions, or unusual patterns. If the model keeps generating Express.js code when you use Fastify, or uses callbacks when you prefer async/await, or formats errors differently from your team's standard—that is when you need few-shot examples or more detailed instructions. The progression is: try zero-shot first, add details if needed, add examples if format matters, and use CLAUDE.md for persistent conventions.
# Zero-shot prompting — just describe the task
$ claude
> "Write a TypeScript function that takes an array
of user objects and returns a Map grouped by
their department, sorted alphabetically within
each group."
# The model uses its training to produce idiomatic code.
# No examples needed for a standard task like this.
# When to add more context (upgrading from zero-shot):
> "Write the same function, but follow the pattern
in src/utils/collections.ts for error handling
and naming conventions."
# Now you are referencing an example file — this is
# transitioning toward few-shot territory.Claude Code is optimized for zero-shot interactions. Because it reads your project context, it can infer conventions from your existing code without explicit examples in your prompt. CLAUDE.md further reduces the need for few-shot prompting.
Is zero-shot prompting less accurate than few-shot?+
Can zero-shot work for complex coding tasks?+
How does CLAUDE.md relate to zero-shot prompting?+
Related terms
Master Claude Code in days, not months
37 hands-on lessons from beginner to CI/CD automation. Module 1 is free.
START FREE →