AI Tools Police
Reader-supported: we may earn a commission from links, at no cost to you. Rankings are never sold. How we investigate →

Beginner · AI Foundations · Lesson 1

What Is Prompt Engineering?

The model makers define it in one sentence. The useful part is knowing which techniques exist, what they change, and when writing a better prompt is the wrong fix.

By the end you will be able to

Explain what prompt engineering is in your own words, name and recognise the core techniques (zero-shot, few-shot, chain of thought, roles, structure, chaining), and judge when a better prompt is, and is not, the right fix.

By Mucahit KayaNov 2, 2026Last checked Oct 28, 2026~10 min read

Prompt engineering is the practice of writing instructions that get a language model to do what you want. OpenAI's guide says "Prompt engineering is the process of writing effective instructions for a model", and Google's describes "the process of creating prompts, or natural language requests, that elicit accurate, high quality responses". Either way, you change what you send, not the model.

What is a prompt?

A prompt is whatever you give the model to respond to. That can be a single question, a long set of instructions, a few examples of the output you want, a document to summarise, or all of those together. In most chat tools you type the prompt. In an application built on a model, a developer usually writes a standing prompt that the user never sees, and the user's own message is added to it.

The word engineering can mislead. Nothing here requires code, and nothing is guaranteed. Google's own documentation says "Prompt engineering is iterative", which is a plain admission that you write a prompt, read what comes back, and adjust. The skill is mostly in noticing why an answer missed and changing the right part of the input.

How does prompt engineering work?

A language model produces its answer from the text it is given, so the prompt is the main thing you control. Clearer instructions, relevant context and good examples give the model more to work from. Anthropic's best-practices page puts the basic idea in one line: "The more precisely you explain what you want, the better the result."

Google's documentation says something close: "An effective and efficient way to customize model behavior is to provide it with clear and specific instructions." Notice what both statements share. Neither says to find a secret phrase. They say to be specific about the task, the audience, the format and the limits.

Most of the work follows a loop:

  1. State what a good answer looks like. Anthropic's overview assumes you already have success criteria and a way to test against them, and says that if you do not, you should spend time establishing that first.
  2. Write a first draft of the prompt.
  3. Read the output against your criteria and change one thing at a time.

That loop is the core of the discipline. The named techniques below are tools inside it.

What are the main prompt engineering techniques?

The core techniques are giving examples (zero-shot and few-shot), asking for reasoning steps (chain of thought), assigning a role, structuring the prompt with tags, and splitting work into a chain of prompts. The table summarises each; the sub-sections explain them using the model makers' and researchers' own words.

TechniqueWhat you doWhere it comes from
Zero-shotGive an instruction and no examplesBrown et al., 2020
Few-shotInclude a few demonstrations of the taskBrown et al., 2020; OpenAI, Google and Anthropic docs
Chain of thoughtShow or elicit intermediate reasoning stepsWei et al., 2022
Role / system promptSet who the model is and how it should behaveAnthropic docs
Structure with tagsSeparate instructions, context and data with XML tagsAnthropic docs
Prompt chainingBreak a task into sequential callsAnthropic docs

What are zero-shot and few-shot prompting?

Zero-shot means you give only an instruction. In the GPT-3 paper by Brown et al. (2020), the zero-shot setting is where "no demonstrations are allowed, and the model is only given a natural language instruction describing the task". Few-shot adds examples: the setting where "the model is given a few demonstrations of the task at inference time as conditioning".

The paper's abstract also says GPT-3 was applied "without any gradient updates or fine-tuning" for all tasks. The examples sit in the prompt and do not change the model. Close the chat and the model has learned nothing from them.

The makers recommend examples. OpenAI says "Few-shot learning lets you steer a large language model toward a new task". Google goes further: "We recommend to always include few-shot examples in your prompts." Anthropic calls the same idea "known as few-shot or multishot prompting".

What is chain-of-thought prompting?

Chain-of-thought prompting asks the model to work through intermediate steps before giving a final answer. Wei et al. (arXiv, January 2022; latest revision January 2023) report that "chain of thought prompting improves performance on a range of arithmetic, commonsense, and symbolic reasoning tasks." Their abstract also says the approach "significantly improves the ability of large language models to perform complex reasoning".

In their method, the prompt includes a few worked examples that show the intermediate steps. Those are the authors' own results on the models they studied in 2022, and we have not checked them independently. As the reasoning-models section below explains, the advice has shifted since then.

What are roles and system prompts?

A role tells the model who to act as, usually in the system prompt, the standing instruction that sits above the user's messages. Anthropic's documentation says "Setting a role in the system prompt focuses Claude's behavior and tone for your use case." A role such as a careful copy editor changes tone and focus.

OpenAI's guide covers the same ground under message roles and instruction following, and also lists versioning prompts among its strategies.

Why use XML tags or other structure in a prompt?

Structure keeps instructions, background material and the data to be processed from blurring together. Anthropic's documentation says "XML tags help Claude parse complex prompts unambiguously". If you paste an email into a prompt, wrapping it in labelled tags makes it clear where the email ends and your instructions begin.

OpenAI's guide lists Markdown and XML formatting among its strategies, so the habit is not specific to one maker. The exact tag names rarely matter. What matters is that each part of the prompt is labelled and consistent.

What is prompt chaining?

Prompt chaining means splitting a task into steps, with each step its own prompt and the output of one feeding the next. Anthropic describes "Explicit prompt chaining (breaking a task into sequential API calls)" as "still useful when you need to inspect intermediate outputs". The benefit is visibility: if the final answer is wrong, you can see which step went wrong.

A chain is also one way to deal with long tasks. For example, one call could extract facts from a report, a second could check them against a list, and a third could write the summary.

Do newer reasoning models still need prompt engineering?

Yes, but the advice changes: reasoning models tend to do better with high-level goals than with detailed step-by-step instructions. OpenAI's guide says "reasoning models will provide better results on tasks with only high-level guidance", and adds "This differs from GPT models, which benefit from very precise instructions".

Anthropic's best-practices page points the same way. It says "Prefer general instructions over prescriptive steps", and adds: "Claude's reasoning frequently exceeds what a human would prescribe." In our reading of that page, for the current Claude models listed there it recommends relying on the model's built-in thinking instead of asking for written-out reasoning, and keeps manual chain of thought as a fallback when thinking is switched off.

Google's Gemini documentation, as we read it, makes a similar point: the Gemini 2.5 and 3 models generate internal reasoning automatically, so you usually do not need the response to spell out its steps. We did not capture an exact sentence for this, so treat it as our summary and read the page yourself.

This matters for anyone learning from older tutorials. A 2022 recommendation to ask a model to think step by step was written for models that did not reason on their own. The practical reading is that the technique depends on the model. The skills that last are stating the goal, giving the right context and defining what a good answer is. Because vendor documentation is rewritten often, check the maker's current page for the model you actually use.

What is the difference between prompt engineering and fine-tuning?

Prompt engineering changes the input to a model that stays the same. Fine-tuning changes the model itself by training it further on examples. The Brown et al. abstract draws this line when it says GPT-3 was applied "without any gradient updates or fine-tuning": the few-shot examples live in the prompt, not in the model.

Some explainers use the term fine-tuning loosely for polishing a prompt's wording, which blurs the two ideas. In this lesson, fine-tuning always means training the model. A later lesson compares the options side by side, alongside retrieval, which feeds relevant documents into the prompt.

When is prompt engineering the wrong fix?

It is the wrong fix when the problem is not in the prompt. Anthropic's overview says "Not every success criterion or failing eval is best solved by prompt engineering", and that "you can sometimes improve latency and cost more easily by choosing a different model."

Some signs that you should look elsewhere:

  • You have no success criteria, so you cannot tell whether a change helped. Define them first.
  • The model is too slow or too expensive for the job. The overview points to choosing a different model.
  • The model lacks information it was never given. A prompt cannot supply facts you have not included, so the fix is better context.
  • You are asking for something the model cannot do reliably. Rewording the request will not change that, and a different model or a different tool may.

Our reading of the makers' guidance is that prompt engineering is the cheapest thing to try first, and only one of several levers. Treat it as a hypothesis you test against your criteria, not a promise.

What does a before-and-after prompt look like?

A good rewrite adds a role, context, a clear task, an output format and one example. The pair below is an illustration written for this lesson. We did not run it against any model, and we make no claim about the output.

Before:

Summarise this email.

After:

You are an assistant helping a busy project manager.
Summarise the email inside the <email> tags in two sentences,
then list any deadlines as bullet points. If there are no
deadlines, write "No deadlines."

Example of the format:
Summary: The vendor has delayed delivery by one week.
Deadlines:
- New delivery date: 14 March

<email>
[paste the email here]
</email>

The second version names a role, uses tags to separate the email from the instructions, fixes the format with an example, and states what to do when there is nothing to list. Each addition maps to a technique above. It is the same advice as the vendors' pages, applied to one small job.

What is prompt injection?

Prompt injection is a security vulnerability in applications built on language models. OWASP, which ranks it first in its 2025 Top 10 for LLM Applications, defines it this way: "A Prompt Injection Vulnerability occurs when user prompts alter the LLM's behavior or output in unintended ways." OWASP's page lists the mitigations it recommends.

Is prompt engineering a real skill?

It is a skill the model makers document at length, and you can see it in practice: OpenAI, Google and Anthropic each publish a prompting guide, and they agree on the basics of being specific, giving examples and iterating. We have left out claims about prompt engineering jobs or salaries because we have no primary source for them, and unsourced figures are common in explainers on this topic.

What you can do with the skill is practical. The aim is usable output in fewer attempts, and the ability to tell when a failure needs something other than a rewrite.

Later lessons build on this one: how to write a prompt step by step, how context engineering relates to prompt engineering, and how retrieval and fine-tuning compare with prompting.

Notes. The sources for this lesson were read on 28 October 2026. The vendor documentation pages show no publication or update dates, and the Google reasoning-model point is our summary rather than a quotation. We ran no prompt for this lesson, and the before-and-after example is an illustration only.

Check what you learned

  1. 1. Which statement best describes what prompt engineering changes?

    1. A. The model's internal weights, through extra training
    2. B. What you send to the model: the instructions, examples and context in the prompt
    3. C. The company that hosts the model
    4. D. How many parameters the model has
    Show answer

    B. Prompt engineering works on the input. The Brown et al. paper that introduced few-shot prompting for GPT-3 states the model was applied without any gradient updates or fine-tuning, which is the difference between changing a prompt and changing a model.

  2. 2. You give a model three worked examples of the output format you want, then ask it to do a new case. Which technique is that?

    1. A. Zero-shot prompting
    2. B. Prompt chaining
    3. C. Few-shot prompting
    4. D. Prompt injection
    Show answer

    C. Few-shot prompting means the model is shown a few demonstrations of the task inside the prompt. Zero-shot gives only an instruction and no demonstrations. Chaining splits a task across several calls, and injection is an attack.

  3. 3. Which statement matches Anthropic's prompt engineering overview?

    1. A. Every failing evaluation is best solved by prompt engineering
    2. B. Not every success criterion or failing eval is best solved by prompt engineering, and choosing a different model can sometimes improve latency and cost more easily
    3. C. Prompt engineering should be skipped in favour of fine-tuning
    4. D. Once you pick a model you cannot change it
    Show answer

    B. Anthropic's overview says not every success criterion or failing eval is best solved by prompt engineering, and that you can sometimes improve latency and cost more easily by choosing a different model.

  4. 4. Which advice do OpenAI and Anthropic give for reasoning models?

    1. A. Spell out every step in as much detail as possible
    2. B. Always ask for the answer in one word
    3. C. General, high-level guidance often works better than very prescriptive steps
    4. D. Prompts no longer matter at all
    Show answer

    C. OpenAI says reasoning models do better with high-level guidance, unlike GPT models that benefit from very precise instructions. Anthropic's best-practices page says to prefer general instructions over prescriptive steps. Neither says prompts stop mattering.

  5. 5. What is prompt injection, in OWASP's terms?

    1. A. Adding XML tags to make a prompt clearer
    2. B. Training a model on a new dataset
    3. C. A vulnerability where user prompts alter the model's behavior or output in unintended ways
    4. D. Breaking a long task into several prompts
    Show answer

    C. OWASP lists prompt injection as LLM01 in its 2025 Top 10 for LLM Applications, defined as user prompts altering the model's behavior or output in unintended ways. It is a security problem, not a prompting technique.

See more of this work on Google

Google lets you name the sites you want to see more of. Adding AI Tools Police changes what Google shows you, not where we rank for anyone else, and it tells us nothing about you.

Add as a preferred source on Google