Prompt Engineering course · lesson 1 of 26
- 1What Is Prompt Engineering? A Practical Beginner's Guide
- 2How a Model Reads Your Prompt: Tokens and Context
- 3Choosing a Model and Reading Its Documentation
- 4Controlling Model Output: Sampling and Limits
- 5Your First Prompt Workflow: Test One Change at a Time
- 6Be Clear and Direct: Give the Model a Usable Task
- 7System, Role, and Context Prompts: Give Instructions Their Place
- 8Zero-Shot, One-Shot, and Few-Shot Prompting
- 9Structure Prompts with Delimiters, Tags, and Templates
- 10Structured Output: Get Answers You Can Parse and Check
- 11Prompting with Long Documents and Large Context
- 12Prompt Recipes for Ten Common Jobs
- 13Chain-of-Thought Prompts and Thinking Models
- 14Step-Back Prompting and Prompt Chaining
- 15Self-Consistency, Tree of Thoughts, and ReAct
- 16Self-Evaluation and Reliability Checks
- 17Define Success and Build Test Cases
- 18Compare Prompts with Graders
- 19Debug a Failing Prompt
- 20Automatic Prompt Engineering
- 21Version and Document Your Prompts
- 22Hallucinations and Grounding
- 23Bias and Debiasing Prompts
- 24Prompt Injection and Safe Prompting
- 25Prompts in Production
- 26Capstone: Build and Test a Prompt Library
By the end of this lesson, you will be able to explain what a prompt is, describe what prompt engineering can and cannot change, and choose a sensible first step when an AI answer misses the mark. You do not need programming or machine learning experience. We will use an everyday writing task to make the ideas concrete.
A prompt is the request and the material around it
Suppose you ask an AI assistant, “Help me with this email.” That is a prompt, but it leaves a lot open. Does “help” mean correct grammar, shorten it, make it warmer, or write a reply? Who will receive it? Should the assistant preserve the facts and the writer’s tone?
A prompt is the input you give a language model to guide the response it produces. It can be a short question, a set of instructions, background information, examples, or a combination of these. In an application, a prompt may also include messages from earlier in the conversation or information retrieved from a document store. The exact pieces depend on the product.
An instruction tells the model what to do. Context is information that helps it do the task, such as the intended reader or relevant facts. An example shows a pattern you want the model to follow. The model’s generated answer is often called its response or output. These terms describe parts of the request. They do not guarantee a particular result.
Here is a first version of the email request:
Help me with this email: “The report is late. Send it today.”
The assistant has to guess what kind of help you want. If it rewrites the sentence as “I hope you’re having a wonderful day! Whenever you have a chance, could you send the report?”, it may have softened the tone but also removed the urgency. You did not say whether urgency mattered.
Try making the goal visible:
Rewrite this message as a polite but direct note to a teammate. Keep the request and deadline clear. Do not add a reason that is not in the original. Return one version under 35 words.
Message: “The report is late. Send it today.”
An illustrative response might be:
Hi, could you please send the report today? We’re past the deadline, so I need it as soon as you can share it.
This response is illustrative. No live model generated it for this lesson, and another model or run could phrase it differently. In the revised request, the task, audience, tone, must-keep detail, word limit, and source text are easier to identify.

What prompt engineering means
Prompt engineering is the deliberate process of designing and improving prompts so a model is more likely to produce a response that meets a defined need. It includes writing the first request, deciding what context or examples belong with it, checking the results, and revising when the results fall short.
The word “engineering” can make the work sound more mysterious than it is. There is no hidden syntax or magic phrase. Start with a clear task and the information it needs. Decide how you will judge the answer, then check more than one attempt when the task matters.
This is why a prompt is not “good” just because it sounds polished. A prompt for a friendly social post may be successful if it preserves a few facts and sounds natural. A prompt that extracts an invoice total may need to return a predictable field and avoid inventing a value when the document does not include one. The standard depends on the job.
Before revising a prompt, write down what success looks like. For the email example, you might require that the reply:
- Keeps the request to send the report.
- Keeps “today” as the deadline.
- Sounds polite without making the deadline optional.
- Adds no new reason or background.
- Stays under 35 words.
Those checks make “better” more specific. Anthropic’s prompt engineering overview recommends establishing success criteria and ways to test against them before tuning a prompt. OpenAI’s prompt engineering guide and Google’s prompt design strategies also present prompting as an iterative practice: give clear instructions, try them, and refine them based on the task and observed results. The details differ by model, so use the current documentation for the model you choose.
For a low-stakes task, your checks can be informal. Read the answer and ask whether it did what you wanted. For a repeated task, such as processing customer messages, write several representative examples and check each output against the same criteria. Later lessons will show how to make those checks systematic.
What can a prompt change?
A prompt can guide how the model approaches the information it receives. You can clarify the task, provide missing background, show a preferred format, include examples, or state limits. These changes can make an answer more relevant to your situation.
For instance, “Summarize this meeting” may produce a general paragraph. If you need a practical handoff, you could ask for decisions, action items, owners, and dates, and tell the model to write “not stated” when the notes do not name an owner. The model now has a more useful target and a way to handle missing information.
But a prompt cannot make the model know a private fact you have not supplied, guarantee that every answer is true, or turn an unreliable process into a reliable one by wording alone. If your request depends on current information, the model may need a search or another source. If it must calculate an exact total, a calculator or program may be a better check. If the desired output has to follow a strict data shape, an API’s structured-output feature may be more appropriate than asking for “valid JSON” in ordinary text.
Prompt engineering is one tool in a larger set of choices. Sometimes the right fix is to improve the prompt. Sometimes you need to provide better information, use a different model, add retrieval, use a tool, change the application, or decide that the task needs human review.
Prompting is not the same as training a model
It helps to separate several approaches that are often mentioned together:
| Approach | What changes | Example use |
|---|---|---|
| Prompt engineering | The instructions and information supplied for a request | Ask for a short summary with named sections |
| Retrieval | The information selected from a source and supplied alongside the request | Find the current return policy, then answer using it |
| Fine-tuning | Additional training that changes a model’s learned behavior for a recurring task | Adapt a model to a narrow style or repeated classification task |
| Model selection | Which model handles the task | Choose a model with suitable quality, speed, cost, or input support |
These methods can be combined. A support system might retrieve a current policy, place it in the prompt, and ask a selected model to answer in a consistent format. A team might first improve instructions and evaluation examples, then consider fine-tuning if the task is frequent and the gains justify the effort.
Retrieval means finding relevant material from an external source and making it available to the model for a particular request. The model has not learned that material permanently; the application supplies it as context. This is useful when answers must refer to a changing set of documents, such as product manuals or company policies. Retrieval can still return irrelevant or incomplete passages, so the source selection and the answer need checking.
Fine-tuning means continuing the training process with selected examples so the model’s behavior or patterns change. It is a separate technical workflow, not simply a longer prompt. It may help with some repeated tasks, but it is not the first fix for every poor answer. You need suitable examples, a way to evaluate the result, and a reason to maintain a specialized model. Provider options and recommendations change, so check current documentation before planning a fine-tuning project.

Model selection can also matter more than another prompt rewrite. A model that is fast and inexpensive may be a good fit for simple classification, while a more capable model may be needed for a complex analysis. This is not a fixed ranking: models and prices change, and performance depends on the task. We will compare model choices in Choosing a model and reading its docs.
When a prompt fails, first identify the type of failure. Did you leave out a necessary fact? Is the task ambiguous? Does the model lack access to the current source? Does the answer need a format the application can validate? Or does this model struggle with the task even after a fair attempt? Naming the failure helps you choose the next experiment instead of adding unrelated instructions.
A small prompt improvement, step by step
Let’s use a simple task that can be checked by a person: turn a short product note into a customer-facing update. The note says:
We are moving the monthly export from Friday to Monday. Existing exports are not affected.
The first prompt is:
Write an update about the export change.
That may produce a fluent message, but it does not say who will read it, whether to mention the old schedule, or which fact must not be lost. We can improve it in a few deliberate steps.
1. Decide what a useful answer must contain. For this task, the update should mention the change from Friday to Monday, say that existing exports are unaffected, and avoid inventing a reason. It should be understandable to a customer.
2. Give the model the task and its limits. We do not need to tell it every sentence to write. We do need to make the important boundaries clear.
3. Keep the source material separate. Label the note so it is clear which words are the material to rewrite. In a simple chat, a heading is enough; structured tags are covered later in the course.
Here is the revised prompt:
Write a clear, friendly update for customers about the schedule change. State that monthly exports will move from Friday to Monday and that existing exports are not affected. Do not invent a reason for the change. Keep it under 60 words.
Source note: “We are moving the monthly export from Friday to Monday. Existing exports are not affected.”
An illustrative answer could be:
Monthly exports will arrive on Monday instead of Friday. This change does not affect exports you have already received.
Now compare the answer to the checks. It includes the new day, the old day, and the effect on previous exports. It adds no reason and stays below the word limit. That makes it a better fit for this task. The result does not tell us how the prompt will work for every announcement or model. Try notes with exceptions, missing dates, or a different audience before using it repeatedly.
If the answer had missed the “existing exports” detail, the next change should focus on that failure. Adding general requests such as “be creative” or “think carefully” would not address the omission. Make one targeted change, then check the result again.
When prompt engineering is the right next step
Try improving the prompt when the task is suitable for a language model but the request is unclear, the answer uses the wrong format, or the model lacks context you can provide. You might also need examples when a pattern is hard to describe in words. The coming lessons explore those techniques one at a time.
Pause before prompt tuning when the task needs facts the model cannot access, the source material is wrong, the application has no reliable way to validate an important answer, or the cost of a mistake is high. More elaborate wording does not replace a trustworthy source, software validation, or expert review. For tasks involving an agent that can use tools or take actions, see What an AI agent is and prompting for agents. This course focuses on general prompting, while those lessons cover additional concerns that come with tool use and agent behavior.
Mistakes beginners make
- Trying to find a magic phrase. There is no universal sentence that fixes every task. Start with the goal and check the result.
- Giving instructions without the needed facts. A model cannot use background you never shared unless the product retrieves it from somewhere.
- Changing several things at once. If you rewrite the whole prompt after one weak answer, you will not know which change helped or made things worse.
- Judging by fluency alone. A smooth answer can still omit a requirement or invent a detail. Compare it with explicit checks.
- Using prompt changes to solve every problem. Sometimes the source, model, retrieval setup, validation code, or task itself needs attention.
Recap and try it yourself
A prompt combines a task with the instructions and information you give a model. Prompt engineering means shaping that input and improving it against a clear definition of success. It works alongside other choices, such as retrieval, fine-tuning, model selection, tools, and human review. The useful question is not “What magic words should I add?” but “What specifically should the answer do, and how will I tell whether it did it?”
Try it: ask a model to turn a short note you wrote into a message for a specific reader. Before you run it, write three checks the answer should pass. Then revise the prompt to address one weakness you notice. Keep both versions so you can compare them. In the next lesson, we will look at how a model reads your prompt.