Jul 18, 2026 Prompt Engineering Techniques
Prompt Engineering Series: 6 Parts
  1. What is prompt engineering
  2. How to write better prompts
  3. Prompt engineering for beginners
  4. Prompt engineering examples and techniques
  5. Prompt engineering vs fine-tuning
  6. Prompt engineering for business
Intermediate·14 min read

Prompt Engineering Examples: 6 Techniques With Before-and-After Prompts

By Arjun Jaggi  ·  Prompt Engineering Series, Part 4

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.

6
Named prompting techniques covered in this post, each with a peer-reviewed research citation and a concrete before-and-after example
2022
Year Wei et al. published chain-of-thought prompting (arXiv:2201.11903), showing that asking a model to reason step by step significantly improves performance on multi-step tasks
5+
Peer-reviewed papers in 2022 alone demonstrating measurable improvements from specific prompt structures, establishing prompt engineering as a research discipline

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

1. Zero-Shot Prompting Foundation
Zero-shot prompting means giving the model a task with no examples. You describe what you want and expect the model to complete it using only its training. It is the default mode most people use without realizing it has a name. The key to making it work well is writing the task instruction with enough specificity that the model does not have to guess about format, audience, or scope.
Before

Summarize this article.

After

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.

Best for: Well-defined tasks where the output format is clear and the model has strong prior knowledge of the domain. Works well for summarization, translation, classification of common categories, and simple rewriting tasks.
2. Few-Shot Prompting Brown et al. arXiv:2005.14165
Few-shot prompting adds one or more worked examples to the prompt before the actual task. The examples show the model what a correct input-output pair looks like, narrowing the space of possible responses. Brown et al. (arXiv:2005.14165) demonstrated that even a small number of examples significantly improves performance on tasks that require a specific output format or classification scheme the model might otherwise interpret broadly.
Before

Classify the sentiment of this customer review as positive, negative, or neutral.

After

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]

Best for: Classification tasks, extraction tasks with a specific output schema, and any task where your definition of "correct" differs from the model's default interpretation. Particularly useful when outputs need to follow a precise format or use specific vocabulary.
3. Chain-of-Thought Prompting Wei et al. arXiv:2201.11903
Chain-of-thought prompting asks the model to show its reasoning before giving a final answer. The instruction can be as simple as "think through this step by step before answering" or more structured, walking the model through the reasoning stages explicitly. Wei et al. (arXiv:2201.11903) showed this technique significantly improves performance on arithmetic, commonsense reasoning, and symbolic reasoning tasks, because the intermediate reasoning steps catch errors before they propagate to the final answer.
Before

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?

After

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.

Best for: Multi-step reasoning problems, math and logic tasks, decisions with multiple dependencies, and any task where intermediate steps affect the final result. Also useful for debugging: the chain of thought shows you where the model's reasoning diverged from correct logic.
4. Role Prompting Framing Technique
Role prompting assigns the model an explicit persona or expert identity before giving the task. This shapes vocabulary, assumed knowledge level, tone, and the frame through which the model interprets the request. The technique works because the model has learned different patterns of language associated with different roles, and activating a specific role activates those patterns. Many practitioners find that role prompting consistently shifts output toward more domain-appropriate language and more focused responses.
Before

Explain the risks of this contract clause to a client.

After

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.

Best for: Tasks where domain expertise, tone, or assumed audience matters. Useful when you need the model to write as a specific type of professional, adapt its vocabulary to a specific reader, or stay within the perspective of a particular role rather than giving a generic all-angles response.
5. Format Specification Output Control
Format specification is the explicit instruction about the structure of the output: how many items, what heading structure, what length per section, what visual form (table, bullet list, numbered steps, JSON, markdown). Many practitioners underuse this technique, accepting whatever structure the model defaults to. Specifying format precisely does two things: it makes the output immediately usable without reformatting, and it forces the model to make deliberate decisions about what information fits into each section, which often improves content quality as well as presentation.
Before

Tell me about the pros and cons of remote work for a company.

After

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.

Best for: Any situation where you will use the output directly in a document, presentation, or system. Especially useful for producing tables, structured reports, JSON or YAML outputs, and content that needs to fit a specific template. Reduces post-processing time significantly.
6. Step-by-Step Decomposition Zhou et al. arXiv:2205.10625
Step-by-step decomposition breaks a complex task into explicitly sequenced sub-tasks within the prompt. Rather than asking the model to complete a complex goal in one shot, you tell it to complete step one, then step two, then step three, with each step building on the previous. Zhou et al. (arXiv:2205.10625) called a related approach "least-to-most prompting": starting with simpler sub-problems and working toward the complex goal. The key insight is that language models perform better when given an explicit plan to follow rather than an undifferentiated complex objective.
Before

Write a business case for adopting a new CRM system.

After

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.

Best for: Complex tasks with multiple stages, situations where the final output depends on earlier decisions (strategy documents, business cases, structured analyses), and tasks where a single-shot prompt tends to produce shallow or generic responses. Also useful for tasks you want to review at each stage before committing 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.

TECHNIQUE WHAT IT CHANGES BEST FOR Zero-Shot Specificity of task instruction Clear tasks, known domains Few-Shot Adds worked examples Classification, extraction Chain-of-Thought Requests visible reasoning steps Math, logic, multi-step tasks Role Prompting Activates domain persona Expert tone, audience fit Format Specification Defines output structure exactly Reports, tables, templates Step Decomposition Breaks task into ordered stages Complex analysis, strategy docs
Six prompting techniques, what each one changes in the prompt, and the task type each handles best. Techniques can be combined: role prompting plus chain-of-thought is a common pairing for analytical tasks.

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 Call

Knowledge Check

Quiz: Check Your Understanding

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?

Before You Go
  • 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.
Reflection question: Think of a task you do repeatedly where the AI output is usually close but not quite right. Which of the six techniques is most likely to address the specific gap you see in those outputs?
Pre-written LinkedIn Share
Prompt engineering is not about magic words. It is about named techniques backed by research. Six you should know: 1. Zero-Shot: clear task instruction, no examples 2. Few-Shot: worked examples narrow the output space (Brown et al. 2020) 3. Chain-of-Thought: step-by-step reasoning before the answer (Wei et al. 2022) 4. Role Prompting: expert persona shapes vocabulary and frame 5. Format Specification: explicit output structure you can use directly 6. Step Decomposition: sequence of sub-tasks for complex goals (Zhou et al. 2022) Before-and-after examples for all six: https://arjunjaggi.com/blog/prompt-engineering-examples

References

  1. Brown, T. et al. (2020). Language Models are Few-Shot Learners. arXiv:2005.14165. https://arxiv.org/abs/2005.14165
  2. Wei, J. et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv:2201.11903. https://arxiv.org/abs/2201.11903
  3. Wang, X. et al. (2022). Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171. https://arxiv.org/abs/2203.11171
  4. Yao, S. et al. (2023). Tree of Thoughts: Deliberate Problem Solving with Large Language Models. arXiv:2305.10601. https://arxiv.org/abs/2305.10601
  5. 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
  6. 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
  7. 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
  8. Yao, S. et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. arXiv:2210.03629. https://arxiv.org/abs/2210.03629