- What is prompt engineering
- How to write better prompts
- Prompt engineering for beginners
- Prompt engineering examples and techniques
- Prompt engineering vs fine-tuning
- Prompt engineering for business
Prompt Engineering Examples: 6 Techniques With Before-and-After Prompts
The difference between a weak prompt and a strong one is not mystery or talent. It is technique. Researchers have identified and validated specific prompting methods that reliably improve AI outputs, and each one has a concrete before-and-after example that shows exactly what changes. This post covers six of them.
In 2022, researchers at Google published a paper that changed how practitioners thought about prompting. Wei et al. (arXiv:2201.11903) showed that simply asking a language model to "think step by step" before answering a multi-step reasoning problem dramatically improved accuracy. The technique had a name: chain-of-thought prompting. It required no additional training, no new model, and no code. The only thing that changed was the prompt.
That paper was not the first to show that prompt structure matters. Brown et al. had already demonstrated in 2020 (arXiv:2005.14165) that adding worked examples to a prompt improved model performance across a wide range of tasks, the technique now called few-shot prompting. And subsequent work on self-consistency (Wang et al., arXiv:2203.11171), tree-of-thought reasoning (Yao et al., arXiv:2305.10601), and least-to-most problem decomposition (Zhou et al., arXiv:2205.10625) extended the field further.
The practical implication of this body of research is that prompt engineering is not about intuition or guesswork. There are named techniques with documented effects, and you can apply them deliberately. This post introduces six of the most useful ones, explains what each one does, shows a concrete before-and-after example, and tells you when to reach for each one. The techniques range from simple (zero-shot) to more structured (chain-of-thought and step decomposition), but none require any technical background to use.
Why Named Techniques Matter
You could spend time experimenting with prompts and gradually develop intuitions about what works. Many practitioners do exactly that. The problem with pure intuition is that it is hard to reproduce, hard to teach, and hard to debug when something stops working. Named techniques solve all three problems.
When you know that "add a few worked examples to the prompt" is the few-shot technique and that it reliably improves performance on classification and extraction tasks, you can apply it deliberately rather than stumbling on it by accident. When a colleague asks why a prompt works, you can explain the technique rather than shrugging. And when the output degrades, you can diagnose whether the examples you added are representative, whether there are too many, or whether the task actually requires a different technique entirely.
Named techniques also help you communicate clearly with others. If you are working on an AI project with a team, "let's try chain-of-thought here" is a much more efficient instruction than "let's try asking it to explain its reasoning." The shared vocabulary speeds up collaboration. This is why the research community's habit of naming techniques is practically useful, not just academically tidy.
Named techniques let you apply improvements deliberately rather than stumbling on them by accident.
The Six Techniques
Summarize this article.
Summarize this article in three sentences. The first sentence should state the main argument. The second should give the key supporting evidence. The third should state the implication for a business audience.
Classify the sentiment of this customer review as positive, negative, or neutral.
Classify the sentiment of each review. Examples: Review: "Arrived on time, works perfectly." Label: Positive Review: "Stopped working after a week." Label: Negative Review: "It does the job." Label: Neutral Now classify: [paste review]
A project takes 40 hours, two team members work on it, one works twice as fast as the other. How many hours does each person work?
Think through this step by step before giving your answer. A project takes 40 hours total. Two team members work on it. One works twice as fast as the other. How many hours does each person contribute? Show each reasoning step.
Explain the risks of this contract clause to a client.
You are a commercial contract lawyer advising a small business owner with no legal background. Explain the risks of the following contract clause in plain language. Avoid legal jargon. Be specific about what could go wrong and what the business owner should negotiate before signing.
Tell me about the pros and cons of remote work for a company.
Create a structured comparison of remote work for a company. Use a table with three columns: Factor, Pro, Con. Include exactly six factors. Keep each cell to one sentence. Factors should be: Productivity, Talent Pool, Office Costs, Team Cohesion, Communication, Compliance.
Write a business case for adopting a new CRM system.
Complete these steps in order to write a business case: Step 1: List the three main pain points with the current system. Step 2: Identify the two most important evaluation criteria for a new CRM. Step 3: State the expected benefit in each criterion area. Step 4: Write a one-paragraph executive summary using the above. Show each step's output before moving to the next.
A Visual Comparison of All Six Techniques
The table below summarizes each technique across three dimensions: what it changes in the prompt, and the category of task it handles best. Use it as a quick reference when deciding which technique to reach for.
Combining Techniques
These six techniques are not mutually exclusive. Many of the most effective prompts in real-world use combine two or three of them. Role prompting plus chain-of-thought is a natural pairing for analytical tasks: you set the expert identity, then ask for step-by-step reasoning within that frame. Few-shot combined with format specification works well for extraction tasks where you need a specific output schema: the examples show what the completed schema looks like, and the format instruction reinforces the structure.
The clinical note summarization work in MEDFIT-LLM (Rao, Jaggi, Naidu, IEEE RMKMATE 2025, DOI:10.1109/RMKMATE64574.2025.11042816) used a combination of role prompting, format specification, and step decomposition to produce structured summaries from unstructured clinical text. No single technique alone produced the output quality needed for clinical use. The combination did. That is representative of how practitioners approach complex real-world tasks: start with the technique most likely to address the core challenge, then layer in others to address remaining gaps.
A practical approach when you are developing a new prompt is to start with zero-shot and see what the model's default response looks like. The default response tells you a great deal: whether the model understands the task, what format it reaches for, what assumptions it makes about audience and scope. Then add the technique that addresses the specific gap in that default response. If the format is wrong, add format specification. If the reasoning is shallow, add chain-of-thought. If the vocabulary is off for the audience, add role prompting. Build up from the base rather than adding every technique at once.
When Techniques Stop Working
Prompting techniques are not magic. They improve outputs on average, across many tasks. On any specific task, they may not produce the result you need, and understanding why helps you choose a better path.
Chain-of-thought helps most on tasks where the model has enough knowledge to reason correctly if prompted to do so. If the model lacks the underlying knowledge (rare domain knowledge, very recent events, proprietary information about your organization), chain-of-thought cannot compensate. The model will reason visibly through incorrect premises and arrive at an incorrect conclusion with apparent confidence. In those cases, you need to provide the relevant facts in the prompt itself, not just a reasoning instruction.
Few-shot examples help when the examples are representative of the task. If your examples are all easy cases and your actual task is a hard case, the examples may actively mislead the model by setting a precedent that does not apply. Vary your examples to include cases that represent the full range of difficulty you expect to encounter.
Format specification fails when the requested format and the content are in tension. Asking for a three-column table when the information genuinely does not fit a tabular structure produces forced, low-quality content. Format should serve the information, not override it. If the format you specify keeps producing poor content, consider whether the format is actually appropriate for the task or whether you are imposing a structure out of habit rather than necessity.
Security researchers have also identified risks in complex prompting workflows. Greshake et al. (arXiv:2302.12173) documented prompt injection attacks where malicious content embedded in documents or web pages can redirect a model's behavior when the model is given unseen input as part of its context. If you are building a system where the model processes user-supplied or external content, this is a constraint to account for in how you structure prompts and what you allow the model to act on.
Learn This Free in Prompt Engineering Fundamentals
A structured course covering all six techniques with exercises, real-world applications, and a practical capstone project. Free to access, no account required.
Start the Free Course → Book a Strategy CallKnowledge Check
Which technique, shown by Wei et al. (arXiv:2201.11903) to improve multi-step reasoning, asks the model to show its working before giving a final answer?
You are building a prompt to classify customer support tickets into five categories. Which technique should you use first?
A model produces accurate content but the output structure is hard to use in your report. Which technique addresses this most directly?
- Six research-backed techniques give you a deliberate toolkit: zero-shot, few-shot, chain-of-thought, role prompting, format specification, and step decomposition.
- Techniques can and should be combined. Start with the one that addresses the most obvious gap in the default response, then layer in others as needed.
- Techniques have limits. Chain-of-thought does not substitute for missing knowledge. Format specification does not make unsuitable structure work. Know when to switch approaches rather than force a technique that does not fit.
References
- Brown, T. et al. (2020). Language Models are Few-Shot Learners. arXiv:2005.14165. https://arxiv.org/abs/2005.14165
- Wei, J. et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv:2201.11903. https://arxiv.org/abs/2201.11903
- Wang, X. et al. (2022). Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171. https://arxiv.org/abs/2203.11171
- Yao, S. et al. (2023). Tree of Thoughts: Deliberate Problem Solving with Large Language Models. arXiv:2305.10601. https://arxiv.org/abs/2305.10601
- Zhou, D. et al. (2022). Least-to-Most Prompting Enables Complex Reasoning in Large Language Models. arXiv:2205.10625. https://arxiv.org/abs/2205.10625
- Greshake, K. et al. (2023). Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. arXiv:2302.12173. https://arxiv.org/abs/2302.12173
- Rao, S., Jaggi, A., Naidu, R. (2025). MEDFIT-LLM: Clinical Note Summarization with Large Language Models. IEEE RMKMATE 2025. DOI:10.1109/RMKMATE64574.2025.11042816. https://doi.org/10.1109/RMKMATE64574.2025.11042816
- Yao, S. et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. arXiv:2210.03629. https://arxiv.org/abs/2210.03629