Prompt engineering for beginners: zero-shot, few-shot and chain-of-thought
The short answer
Zero-shot prompting gives the model a clear task with no examples. Few-shot prompting adds two or three input-output examples to establish a pattern. Chain-of-thought asks the model to reason step by step before answering, which helps with multi-step problems but can hurt simple tasks and increase cost.
Zero-shot: a clear task with no examples
Zero-shot is a single instruction. It works well for tasks the model has seen thousands of times: summarising, rewriting, classifying common categories, drafting a standard email.
```text Rewrite the paragraph below for clarity. Keep every fact. Target a Grade 9 reading level. Return the rewrite, then a bullet list of changes.
Paragraph: {{paragraph}} ```
Use it when: the task is common, the output format is simple, and you can judge the result quickly.
It fails when: the task has a house style, an unusual schema, or a definition of "good" that only you know.
Few-shot: show the pattern
Few-shot adds two or three examples. It is the fastest way to teach tone, format or a classification edge case.
```text Classify each support message as billing, bug, feature request or other.
Message: "I was charged twice this month." Category: billing
Message: "The export button does nothing on Safari." Category: bug
Message: "Can you add a dark mode?" Category: feature request
Message: "{{message}}" Category: ```
Use it when: the output must follow a convention, the categories are ambiguous, or the model keeps producing the right content in the wrong shape.
Watch out for: examples that contradict each other, or examples that are too similar and fail to cover edge cases. Include one tricky example.
Chain-of-thought: reason before answering
Chain-of-thought (CoT) asks the model to work through the problem before giving the final answer. It helps with maths, logic, multi-step planning and code debugging. It can hurt simple tasks by adding noise and cost, and it can leak reasoning you do not want in the final output.
```text Solve the problem below. Reason through it step by step, then put only the final answer in a section called "Answer".
Problem: {{problem}} ```
For production, separate the reasoning from the deliverable: "reason silently, then output only the requested format". This keeps the answer clean while preserving the accuracy benefit.
Use it when: the task has multiple dependent steps, the model is making arithmetic or logical errors, or you need to audit the reasoning.
Do not use it when: you need a one-line classification at scale, or the reasoning would expose sensitive internal instructions.
Other techniques worth knowing
Role prompting. "You are a senior editor" sets vocabulary and standards. It works best when paired with a concrete task and audience.
Structured output. Give a schema and two valid examples. Validate the result in code.
Self-critique. Ask the model to review its own draft against explicit criteria, then revise. Useful for writing; less reliable for factual accuracy.
Decomposition. Split a complex task into steps and run them separately. More reliable than one giant prompt, and easier to debug.
Retrieval grounding. Provide the source and require citations. This reduces invention but does not eliminate it; verify the citations.
A practical workflow
- Write the brief in plain language, as if to a colleague.
- Add the output format and one example.
- Test on three inputs you know the answer to.
- Note the failure pattern, not just the failure.
- Change one thing and test again.
- Write down the version that works.
The mistakes that matter
- Vague quality words. "Engaging", "professional" and "high quality" mean nothing without an audience and a format.
- No output contract. If the format matters, specify it.
- Too many instructions. Conflicting constraints produce unpredictable output.
- No examples of edge cases. A happy-path example teaches the model nothing about ambiguity.
- Trusting facts. Models invent citations, numbers and quotes. Verify anything that matters.
Where to go next
Read the Prompt Engineering Guide repository for the research background, then practise on tasks you can evaluate. Our writing prompts and coding prompts include complete briefs you can adapt.
The fastest improvement is not a new technique. It is writing a clearer brief and testing it three times.
Copy-ready prompts featured in this guide
Copy any prompt below or open its full page with interactive variable fields and platform tabs.
Site Admin
Author & Platform Administrator
Administrator and lead editor at AIPrompt123, curating high-performance AI prompts, SEO/AEO/GEO strategies, and developer repositories.
Questions about this guide
Short answers to what readers ask most about this topic.
Keep reading
The best ChatGPT prompts for students (that actually help you learn)
Most 'study prompts' generate summaries that feel productive and teach you nothing. These twelve prompts are built around retrieval, feedback and self-testing.
The Midjourney prompt formula (with 12 copy-ready examples)
A repeatable structure for Midjourney v7: subject, light, lens, composition and parameters. Plus the mistakes that make images look generic.
How to write a system prompt that actually holds
A five-block structure for system prompts, with examples, the rules that cannot be enforced in a prompt, and how to test for drift.