Introduction
In Lesson 4, you learned that a large language model generates text by predicting likely next tokens from the context available to it. A prompt is part of that context. It gives the model a task, background, source material, and instructions that influence what it is likely to produce.
Prompt engineering is the practice of designing and improving those instructions so the response is more useful for a particular job. It is not a secret phrase, a trick that unlocks hidden knowledge, or a guarantee that the model will obey every request.
Imagine asking a colleague, "Can you help with this customer?" That person would have to guess what you need. Do you want an email, a summary, a phone script, or a list of questions? What does the customer already know? Which policy applies? What should happen if an important detail is missing?
An AI assistant faces the same problem, except it does not automatically know your workplace, your intentions, or your current policies. The prompt is where you make the job clear and provide the information the model is allowed to use.
Throughout this lesson, we will work with Harborlight Home Services, a fictional company used for practice in this course. Its customer questions, policies, and examples are invented for learning. They are not real business records.
By the end, you will be able to turn a vague request into a structured prompt, provide a source the model can work from, ask it to identify missing information, and review the result instead of trusting fluent wording by itself.
What you will learn
- Explain prompt engineering as the practice of shaping the context and instructions supplied to a language model.
- Turn a vague request into a clear task with a defined audience and desired result.
- Provide relevant context and identify which source material the model should use.
- Set boundaries for missing information, unsupported claims, tone, length, and output format.
- Use examples to demonstrate a desired response pattern without treating examples as guarantees.
- Improve a prompt through deliberate revision and evaluation.
- Recognize what prompting cannot guarantee and when human review or another system is required.
The lesson
1. A prompt is part of the model's context
A prompt is the input that tells an AI model what you want it to do and provides information that may help it do the task. In a chat product, the prompt may include your latest message, earlier conversation turns that are still included, attached text, and instructions added by the application.
Lesson 4 introduced the next-token process. The model uses the context it receives to estimate what text is likely to come next. Your prompt helps shape that context.
Consider two requests:
Vague request
Help me with a customer.
More useful request
Draft a polite email replying to a customer who asked whether a weekend service fee applies. Use only the fictional FAQ included below. If the FAQ does not state the fee, say that the office needs to confirm it. Do not invent a price. Keep the reply under 100 words.
The second request gives the model a clearer job and a boundary. It reduces the amount of guessing required.
Prompt engineering is the process of making this kind of improvement deliberately. You describe the job, provide the relevant information, set expectations, and check the result.
Clearer does not mean magical
A carefully written prompt can make the desired response easier to produce. It cannot guarantee that every answer is correct. The model may misunderstand an instruction, overlook part of a source, produce a plausible but unsupported detail, or respond differently when the same prompt is used again.
A prompt is guidance supplied to a model, not a replacement for verified information, software permissions, or human judgment.
A useful question before you type
Ask yourself: If I gave this request to a capable new employee who knew nothing about my situation, what would I need to explain?
That question is a practical starting point for better prompts.
2. State the task and define what a good result looks like
Begin with a clear action. Tell the model what you want it to produce.
Useful task verbs include:
- Draft: write a first version of an email, notice, or message.
- Summarize: shorten supplied material while preserving the important points.
- Compare: identify similarities and differences between supplied options.
- Organize: turn rough notes into a checklist, outline, or table.
- Explain: teach a topic at a stated level.
- Review: check a draft against criteria you provide.
- Brainstorm: suggest possibilities for a person to evaluate.
A vague request such as "Help me with marketing" leaves many decisions open. A clearer request might be:
Create a one-week content outline for a fictional home-services company. The audience is homeowners who need routine maintenance. Suggest one educational post and one customer-question post for each weekday. Do not write advertisements that promise a particular result.
Now the model knows the task, audience, time span, and an important boundary.
Describe the finish line
A useful prompt explains what success looks like. Consider these questions:
- What should the response help you accomplish?
- Who will read or use it?
- What information must be included?
- What must be left out?
- How will you decide whether the result is acceptable?
For a customer email, success might mean that the answer addresses the customer's question, uses the approved policy, sounds respectful, and leaves out any fee that has not been confirmed.
For a meeting summary, success might mean that decisions, open questions, owners, and next steps are separated rather than blended into one paragraph.
Separate the main task from optional work
If you ask for a customer email, a marketing plan, a legal review, and a spreadsheet in one request, the model may produce a broad response that does none of those jobs particularly well.
Break complicated work into manageable stages. First ask for an outline. Review it. Then ask for a draft of the first section. This keeps the task easier to inspect and gives you a chance to correct assumptions before the work grows.
3. Give the model relevant context
Context is the background information that helps the model understand the request. It can include the audience, situation, purpose, definitions, earlier decisions, and relevant constraints.
Without context, the model may fill gaps with generic assumptions. With relevant context, it has more information to use.
For example, "Write an appointment reminder" does not tell the model whether the message is for a first-time customer, whether the appointment is confirmed, or what tone the company prefers.
A more complete request might say:
The customer has already confirmed a maintenance appointment. Write a friendly reminder that asks them to contact the office if they need to reschedule. Do not add an appointment time because it is not included in the information below.
The prompt gives the model the situation and explains what is missing.
Add the information that changes the answer
Useful context often includes:
- Audience: who will read the result.
- Purpose: what the result should accomplish.
- Situation: what has happened so far.
- Definitions: what a term means in this particular task.
- Preferences: tone, reading level, or house style.
- Relevant history: earlier decisions that still apply, if they are available and appropriate to share.
Do not add background merely to make the prompt longer. Include details that change what a good answer should look like.
A role can help, but it does not create expertise
You may begin with a role such as:
You are a writing assistant helping a small service company prepare clear customer communications.
That gives the model a useful perspective for the task. It does not make the model a licensed technician, attorney, accountant, or employee with access to company records. A role description changes the framing of the request; it does not grant credentials, authority, or access.
Use only information you are permitted to share
Context can contain sensitive information. Follow your organization's rules and the AI provider's privacy terms. Remove names, addresses, account details, payment information, health information, and other personal data unless the tool and workflow have been specifically approved to handle it.
A better prompt cannot make an unapproved data-sharing practice safe.
4. Provide source material and tell the model how to use it
A prompt can tell the model to use a particular source, but the source itself must be available in the context or through an authorized tool.
This is especially important when an answer depends on a current business fact. The model's general language ability does not mean it knows a company's latest prices, policies, appointment availability, inventory, or customer records.
Imagine Harborlight receives this question:
Do you charge an extra fee for weekend appointments?
For this exercise, Harborlight's fictional approved FAQ says:
The office can explain available appointment options. The FAQ does not list a weekend service fee. Staff must confirm any fee with the office before quoting it.
A weak prompt would be:
Answer the customer's question about weekend fees.
A stronger prompt would identify the FAQ as the source and explain what to do if the answer is absent.
Label the source
When you paste reference material, give it a clear heading such as Approved FAQ, Current policy excerpt, or Meeting notes. This helps distinguish your instructions from the material being discussed.
Then state the source rule:
Use only the approved FAQ below for policy details. Do not add a fee or infer one. If the FAQ does not answer the question, say that the information is not provided and identify what a staff member must confirm.
Ask for a boundary between known and unknown
Useful instructions include:
- Use only the supplied source for policy details.
- Do not fill gaps with assumptions.
- If a requested fact is missing, say that it is missing.
- If two supplied sources conflict, identify the conflict instead of choosing one silently.
- Do not invent a citation, policy clause, date, name, or amount.
- Separate facts from suggestions.
These instructions can reduce unsupported additions, but they do not prove that the model followed them. Compare the answer with the source before relying on it.
Source material is not the same as live access
Pasting a policy gives the model that pasted text. It does not automatically connect the model to the company's policy database or guarantee that the pasted version is current. If a workflow uses an authorized connection, confirm what information that connection actually provides and whether it is current.
The basic rule is simple: if a fact matters, provide an approved source or retrieve it through an approved system, then verify the result.
5. Set boundaries and explain what to do when information is missing
A good prompt describes not only what the model should do, but also what it should avoid.
These instructions are often called constraints or guardrails. They define the boundaries of the requested response.
Examples:
- Do not invent prices, dates, policies, or names.
- Do not promise an outcome that the source does not support.
- Do not include personal information.
- Do not change the meaning of the supplied policy.
- If a required detail is missing, ask a question instead of guessing.
- If the source is unclear, identify the unclear passage.
Make uncertainty actionable
"Be accurate" is a reasonable goal, but it does not tell the model what to do when the answer is uncertain.
Try a specific instruction:
If the supplied material does not answer the question, write: "The supplied information does not confirm this." Then list the exact detail that needs human confirmation. Do not create a likely answer.
This gives the model a response pattern for missing information.
Distinguish hard controls from written instructions
A prompt can ask a model not to perform an action. It is not the same as a permission system that technically prevents that action.
For example, telling a model not to send an email is not a substitute for an application that requires human approval before sending. Telling a model not to change a price is not a substitute for software permissions that prevent unauthorized price changes.
Use prompts to communicate the task and boundaries. Use application controls, validated data, and human approval for actions that must be restricted.
Avoid contradictory instructions
A prompt can accidentally ask for incompatible things:
Explain every detail, but keep the answer to one sentence.
Or:
Use only the supplied FAQ, and add current market prices from the internet.
When instructions conflict, the model may choose one, blend them, or ask for clarification. Write priorities explicitly:
Use the supplied FAQ for policy details. If a question requires information outside the FAQ, identify what is missing. Do not search for or invent a replacement policy.
Clear priorities make the request easier to follow.
6. Specify the audience, tone, length, and format
A useful answer is not just correct in substance. It also needs to be usable by the person who receives it.
Tell the model who the response is for and how it should be presented.
Audience and reading level
Compare:
Explain the service process.
With:
Explain the service process to a homeowner who has never scheduled a maintenance visit. Use everyday language and explain any technical term the first time it appears.
The second prompt tells the model what the reader already knows and what may need explanation.
Tone
Tone words are helpful, but examples are often clearer. You might ask for a message that is:
- Friendly and professional.
- Calm and reassuring without making promises.
- Direct and respectful.
- Warm but not overly casual.
- Clear without sounding defensive.
If a particular phrase or style is important, show an approved example and explain what should be retained.
Length
Be specific about the intended size:
- A short text message.
- A three-paragraph email.
- A one-page outline.
- A checklist with no more than a few words per item.
A word limit is a target, not a guarantee. Review the result and shorten it if necessary.
Format
Name the structure you want:
| Desired result | Useful instruction |
|---|---|
| Include a subject line, greeting, body, and closing. | |
| Checklist | Use action-oriented bullets with one task per line. |
| Comparison | Use a table with one row per option. |
| Meeting notes | Separate decisions, open questions, and next steps. |
| Customer reply | Give the customer-facing draft first, then list facts that need confirmation separately. |
Separate the draft from the review notes
For a business task, you might ask:
First provide the customer-facing draft. After it, add a separate section titled "Staff review" listing any fact, amount, date, or policy detail that the source did not confirm. Do not include the staff review section in the customer message.
This makes it easier for a person to see what is ready to edit and what still needs attention.
7. Use examples to show the pattern you want
Sometimes a description is not enough. You can include an example of the kind of input and output you want the model to imitate.
This technique is often called few-shot prompting. The examples show a pattern in context. The model can use that pattern when producing a new response.
For example, you might provide:
Example input
Customer: I need to move my appointment. What should I do?
Example output
Thanks for letting us know. Please contact the office so the team can review the available appointment options with you.
Then ask the model to use the same style for a different customer question.
Make examples representative
A useful example should demonstrate the features that matter:
- The level of detail.
- The tone and vocabulary.
- The structure.
- The difference between confirmed information and information that needs review.
If every example is unusually short, the model may produce answers that are too brief. If an example includes a fact that should not be repeated, the model may copy it into a new answer.
Include a counterexample when it helps
You can show what not to do:
Do not promise that a technician will arrive at a particular time unless the approved schedule confirms it.
A counterexample can clarify a boundary, especially when the mistake is easy to make.
Examples are guidance, not guarantees
The model may imitate an example too closely, copy an irrelevant detail, or miss the pattern you intended. Use fictional or approved sample data. Remove personal information. Review the result to make sure the model followed the intended pattern rather than copying the example's facts.
Start with a small number of clear examples. Add more only when they teach a distinct pattern that the model needs to recognize.
8. Build a prompt using a repeatable framework
You do not need a complicated formula for every request. A simple framework can help you remember the pieces that matter.
The six-part prompt plan
Purpose: What job should the model perform?
Context: What background does it need to understand the situation?
Source: Which supplied or authorized information should it use?
Boundaries: What must it avoid, and what should it do when information is missing?
Output: Who is the audience, and what format, tone, and length do you want?
Review: What should the model flag for a person to check?
Not every prompt needs all six parts. A simple request to explain a common term may need only a task and audience. A customer response involving a company policy needs more.
Reusable prompt template
Copy this structure and replace the bracketed instructions with information appropriate to your task:
You are helping with [type of task].
TASK
[Describe exactly what you want produced.]
CONTEXT
[Explain the situation, audience, and purpose.]
SOURCE
[Paste or identify the approved source material.
State which source controls if more than one is supplied.]
BOUNDARIES
[State what not to invent, change, disclose, or assume.
Explain what to do when information is missing.]
OUTPUT
[Specify tone, format, length, and required sections.]
REVIEW
[List facts or decisions a person must verify before using the result.]
A completed fictional example
You are helping a fictional home-services company draft customer replies.
TASK
Draft a reply to a customer asking whether a weekend service fee applies.
CONTEXT
The customer needs a clear answer. The reply should be polite and concise.
SOURCE
Use only the fictional approved FAQ supplied below:
"The office can explain available appointment options.
The FAQ does not list a weekend service fee.
Staff must confirm any fee with the office before quoting it."
BOUNDARIES
Do not invent a fee or imply that the fee is zero.
If the FAQ does not answer the question, say that the office
must confirm the information.
OUTPUT
Write a short customer-facing email in a friendly,
professional tone.
REVIEW
After the email, list any fact that still needs staff confirmation.
The completed example gives the model a task, context, source, boundaries, output expectations, and a review requirement. It does not make the model the authority on the company's fee policy. A person still compares the draft with the approved source before sending it.
9. Improve prompts through deliberate iteration
Your first prompt is a starting point. Prompt engineering usually involves trying a request, inspecting the response, and making a purposeful change.
Avoid changing everything at once. If you change the audience, source, tone, and format together, it becomes difficult to tell which change improved the result.
A practical improvement loop
- Write the first prompt. State the task and the information available.
- Run it. Read the response instead of judging it by how polished it sounds.
- Identify the problem. Is it inaccurate, incomplete, too long, too vague, or in the wrong format?
- Change one important part. Add missing context, clarify the source, or change the output requirement.
- Run it again. Compare the new response with the original.
- Check against the success criteria. Keep the change only if it improves the result without creating a new problem.
Ask for a diagnosis, not just another attempt
Instead of saying:
Try again.
You can say:
The draft added a weekend fee that does not appear in the supplied FAQ. Revise the prompt so the response must identify missing fee information rather than guessing. Then produce a new draft using only the FAQ.
This identifies the failure and the behavior you want changed.
Test more than one example
A prompt that works for one easy question may fail when the source is incomplete or the customer asks something unexpected.
Try a small set of different cases:
- The source clearly answers the question.
- The source does not contain the requested fact.
- Two supplied passages appear to conflict.
- The customer asks for something outside the task.
- The source contains a phrase that could be misunderstood.
Look for repeated problems. A reusable prompt should work acceptably across the kinds of requests it is meant to handle, not only the example used to create it.
Save useful prompts with their purpose
For repeated work, keep an approved copy of the prompt, the intended source, and a few test examples. Give it a clear name and a version date if your process requires one. When you change it, test it again.
This turns prompt improvement into a repeatable work process rather than a collection of random phrases.
10. Know what prompt engineering cannot do
Prompt engineering is useful, but it has limits.
A prompt cannot automatically:
- Give a model access to a file, database, website, or live schedule that the application has not provided.
- Make an outdated source current.
- Turn an uncertain answer into a verified fact.
- Guarantee that the model will follow every instruction.
- Grant professional credentials or decision-making authority.
- Replace software permissions, validation, or required human approval.
- Make it appropriate to share confidential information with an unapproved service.
A role such as "act as an expert" can influence the style and framing of a response. It does not prove that the model has the qualifications or information of that expert.
A request such as "never make a mistake" does not create a technical guarantee. For important tasks, use an approved source, a suitable system of record, ordinary software checks where possible, and a qualified person to review the result.
Use the right tool for the job
If you need an exact calculation, use a calculator or tested software and verify the inputs. If you need a current appointment slot, use the authorized scheduling system. If you need a company policy, consult the approved policy source. A language model may help explain, summarize, or draft around that information, but it should not replace the source of truth.
Keep private information private
Before entering information into an AI tool, check whether the tool is approved for that information and what its privacy and data-handling terms say. Use fictional or de-identified examples when practicing. Do not paste customer records, payment details, passwords, private health information, or confidential business information into an unapproved tool.
Keep a person responsible
A prompt can help prepare a draft. A person remains responsible for checking the facts, deciding whether the response is appropriate, and approving consequential actions. This is especially important when a response affects safety, money, legal rights, employment, or a customer's account.
The goal is not to make the model sound certain. The goal is to make its work easier to inspect and safer to use.
11. What to remember
A strong prompt gives the model a clear job and the context needed to attempt it.
Remember these principles:
- State the task in plain language.
- Explain the audience and purpose.
- Supply relevant context instead of expecting the model to know your situation.
- Identify the approved source for facts that matter.
- Tell the model what to do when information is missing.
- Specify tone, format, and length when they affect the result.
- Use examples when you need to demonstrate a pattern.
- Improve prompts by testing and changing them deliberately.
- Verify important facts and keep a person responsible for decisions.
Lesson 4 explained why prompts matter: the model predicts likely next tokens from the context it receives. Lesson 5 has shown how to shape that context with care.
The best prompt is not necessarily the longest prompt. It is the prompt that gives the model enough relevant information to do a clearly defined job, while making the result easy for a person to review.
Try it
Turn a vague request into a useful prompt
Compare the two requests. Notice how the stronger version makes the task, source, boundaries, and output clearer.
Weaker prompt
Reply to this customer about weekend fees.
Stronger prompt
Draft a short, friendly email replying to a customer who asks whether a weekend service fee applies. Use only this fictional approved FAQ: "The office can explain available appointment options. The FAQ does not list a weekend service fee. Staff must confirm any fee with the office before quoting it." Do not invent a fee or imply that the fee is zero. If the FAQ does not answer the question, say that the office must confirm it. After the customer-facing draft, add a separate staff-review note identifying the missing fee information.
The stronger prompt defines the job, supplies the source, identifies the audience, sets a boundary against inventing a fee, and separates the customer-facing draft from the staff-review note. It gives the model information to use instead of asking it to guess.
Build a prompt one part at a time
Move through the steps to see how a broad request becomes a prompt that is easier to evaluate.
Step 1 of 6
Name the task
Start with a clear action: Draft a reply to a customer asking about a weekend appointment fee. Avoid beginning with a broad request such as 'help me with this customer.'
Step 2 of 6
Add the context
Explain that the customer needs a clear answer and that the reply should be polite and concise. Do not add facts that are not known.
Step 3 of 6
Provide the source
Paste the fictional approved FAQ and label it clearly. The model can only use the supplied text as a source if that text is actually available in the prompt or through an approved connection.
Step 4 of 6
Set the boundary
Say that the model must not invent a fee. If the FAQ is silent, it must say so and identify what the office needs to confirm.
Step 5 of 6
Choose the output
Request a short customer-facing email, followed by a separate staff-review note. Specify a friendly, professional tone.
Step 6 of 6
Review the result
Compare every policy statement with the FAQ. Check that no fee was invented, that the message answers the question, and that the staff-review note is not accidentally included in the customer email.
What is missing from this prompt?
Read each request and decide what information would make it more useful. Select a prompt to reveal the teaching point.
Write a customer email.
The task is too broad. Ask what the email is about, who will receive it, what facts it should use, and what action the reader should take.
Tell the customer our weekend fee.
The source of the fee is missing. Provide an approved current policy or fee schedule. If the source does not state a fee, instruct the model to say that it needs confirmation rather than inventing an amount.
Make this sound better.
The goal is unclear. Explain whether you want a warmer tone, shorter wording, simpler language, a more professional style, or a clearer structure. Tell the model to preserve the original meaning.
Summarize this document and include every important detail.
The request may contain conflicting expectations. A summary must select and compress information. Specify the audience, purpose, desired length, and which details must not be omitted.
What each prompt element contributes
| Element | Question it answers | Example instruction |
|---|---|---|
| Task | What should be done? | Draft a customer reply. |
| Context | What situation matters? | The customer is asking about a weekend visit. |
| Source | Which facts may be used? | Use only the approved FAQ below. |
| Boundaries | What must not happen? | Do not invent a fee. Flag missing information. |
| Output | What should the result look like? | Write a short, friendly email. |
| Review | What needs human attention? | List any detail that the source does not confirm. |
Copy a reusable prompt template
Use this as a starting point. Replace the bracketed instructions with details that are appropriate for your task. Do not include confidential information unless the tool and workflow are approved for it.
You are helping with [type of task]. TASK [Describe exactly what you want produced.] CONTEXT [Explain the situation, audience, and purpose.] SOURCE [Paste or identify the approved source material. State which source controls if more than one is supplied.] BOUNDARIES [State what not to invent, change, disclose, or assume. Explain what to do when information is missing.] OUTPUT [Specify tone, format, length, and required sections.] REVIEW [List facts, amounts, dates, or decisions a person must verify before using the result.]
Hands-on exercises
Beginner AI Beginners
Beginner: improve a vague prompt
Choose a low-risk task you might ask an AI assistant to help with, such as planning a simple meal, organizing a household checklist, or explaining a common topic.
Start with a vague request, such as "Help me plan my week."
Rewrite it using the six-part prompt plan:
- Purpose: What should the model do?
- Context: What background matters?
- Source: Is there any information it should use?
- Boundaries: What should it avoid assuming?
- Output: What should the result look like?
- Review: What should you check?
Try the original request and your improved request in an AI tool. Compare the two responses. Do not enter private information. Use a task where an imperfect answer would be easy to recognize and correct.
Help me plan my week. Rewrite this as a clearer prompt. Ask me only for information that is necessary, avoid assuming my schedule, and return a simple plan that separates fixed commitments from flexible tasks.
What a good result looks like: A clearer prompt that names a task, supplies relevant context, identifies assumptions, and requests a useful output. The learner can explain what changed and whether the response became easier to use.
Business Business Owners and Professionals
Business: create a source-bound Harborlight reply
Use this fictional customer question:
Do you charge an extra fee for weekend appointments?
Use this fictional approved FAQ:
The office can explain available appointment options. The FAQ does not list a weekend service fee. Staff must confirm any fee with the office before quoting it.
Write a prompt that asks an AI assistant to draft a customer reply. The prompt must:
- Identify the customer-facing task.
- Label the FAQ as the only source for policy details.
- Prohibit inventing a fee or implying that the fee is zero.
- Tell the model what to say when the source is silent.
- Request a separate staff-review note.
Run the prompt if you have access to an approved tool. Compare the draft with the FAQ. Mark any statement that is not supported by the source. Use only the fictional example. Do not paste real customer details or business records into an unapproved tool.
Draft a short, friendly customer email answering this question: "Do you charge an extra fee for weekend appointments?" Use only this fictional approved FAQ: "The office can explain available appointment options. The FAQ does not list a weekend service fee. Staff must confirm any fee with the office before quoting it." Do not invent a fee or imply that the fee is zero. If the FAQ does not answer the question, say that the office must confirm it. After the email, add a separate staff-review note identifying what still needs confirmation.
What a good result looks like: A prompt that keeps the model in a drafting role, uses the supplied FAQ as the source, and makes missing information visible for a staff member to confirm.
Advanced Advanced AI and Technical Development
Advanced: test prompt changes systematically
Create a small prompt evaluation using the same fictional task and source material.
- Write a basic prompt with only the task.
- Write a structured prompt with context, source, boundaries, and output format.
- Write a third version that adds one representative input/output example.
- Test all versions against the same set of fictional cases: a fact stated in the source, a fact missing from the source, and two conflicting source passages.
- Score each response against the same checklist: uses the source, identifies missing facts, avoids invented details, follows the requested format, and remains clear.
- Record which prompt changes improved the result and which did not.
Do not treat one successful output as proof that a prompt is reliable. The exercise is about building a repeatable evaluation, not finding magic wording.
What a good result looks like: A small comparison showing how prompt structure affects outputs across more than one case, with clear criteria and a record of remaining failure modes.
Business
Path B: Prompt engineering in a small business
Treat prompts as work instructions, not business records
Harborlight Home Services is a fictional company. Imagine its staff receive customer questions about appointments, service options, and company policies.
An AI assistant may help draft a reply, organize notes, or turn an approved procedure into a checklist. It should not be treated as the source of the company's actual prices, appointment slots, warranty terms, or customer account details.
Start with one narrow workflow
A sensible first workflow is a draft reply based on an approved FAQ.
The task: A customer asks whether a weekend service fee applies.
The source: The fictional FAQ says that the office can explain appointment options, but it does not list a weekend fee and staff must confirm any fee before quoting it.
The prompt: Ask for a short customer-facing draft. Tell the model to use only the FAQ, not invent a fee, and flag the missing information.
The human step: A staff member compares the draft with the FAQ, confirms the policy with the office if needed, edits the message, and sends it through the normal approved process.
Separate the work into clear lanes
| Work | Appropriate role for an AI assistant | What remains outside the prompt |
|---|---|---|
| Routine customer wording | Draft or rewrite a message using approved facts | Staff review and send the message |
| FAQ summary | Organize information from an approved FAQ | The FAQ owner confirms the policy is current |
| Appointment question | Draft a response explaining how to request an appointment | The scheduling system confirms actual availability |
| Price or fee question | Identify what the supplied source says or does not say | The approved price list or authorized staff confirms the amount |
| Safety concern | Help organize a report or list questions for a technician | A qualified person evaluates the safety issue |
Create a staff prompt standard
A short internal standard can make repeated work safer:
- Use only AI tools approved for the type of information involved.
- Use fictional or de-identified examples for training.
- Do not paste customer personal information, payment details, passwords, or confidential records into an unapproved tool.
- Identify the approved source for policy, price, and schedule details.
- Tell the assistant to flag missing information instead of guessing.
- Keep the draft separate from staff-only notes.
- Have an authorized person verify the result and approve any customer communication or business action.
Measure whether the prompt helps
Do not measure success only by how quickly the first draft appears. Review whether staff must correct facts, add missing details, remove unsupported promises, or rewrite the message.
A useful prompt should reduce avoidable rework without lowering accuracy or customer care. If the same error keeps appearing, revise the prompt, improve the source material, or move the task to a more appropriate system. Prompting alone may not solve a workflow that lacks reliable data or clear business rules.
Build a small approved prompt library
For repeated tasks, store the approved prompt with its purpose, approved source, owner, and review date. Keep sample inputs fictional or approved. Test a changed version before staff rely on it. Do not let an old prompt silently become the authority for a policy that has changed.
The business benefit comes from a well-designed workflow: useful drafting, reliable sources, clear permissions, and human review.
Common misconceptions
- Myth There is one magic prompt that works perfectly for every model and every task.
- Reality
Different tasks, models, and applications can respond differently. Start with a clear prompt, test it against the task, and improve it using observable results.
- Myth The longer the prompt, the better the answer.
- Reality
Relevant context helps, but unnecessary detail can distract from the task and use the available context budget. Include what changes the answer, organize it clearly, and remove repetition.
- Myth Telling an AI to act as an expert makes it a qualified expert.
- Reality
A role instruction can shape style and perspective. It does not grant credentials, live access, professional accountability, or verified knowledge.
- Myth If I tell the model not to hallucinate, it cannot make anything up.
- Reality
Instructions can encourage the model to identify uncertainty, but they do not guarantee compliance. Supply approved sources and verify important statements.
- Myth One example is enough to make the model follow a pattern every time.
- Reality
Examples can demonstrate a desired pattern, but the model may copy irrelevant details or fail on a different case. Use representative examples and test the result.
- Myth A good prompt can replace a company's database, permissions, or approval process.
- Reality
A prompt communicates instructions. It does not replace the system that stores current records, controls access, validates data, or authorizes actions.
Knowledge check
Answer every question, then check your answers. You need 70% to pass. A question marked "select all that apply" counts as correct only when you choose every correct answer and no others.
Advanced Advanced AI and Technical Development
Advanced companion
Path C: Prompt engineering as context design
This companion treats a prompt as an engineered input to a conditional language model. It connects Lesson 4's next-token prediction and context window to the practical design of instructions, reference material, examples, and output constraints.
The goal is not to find a universal prompt formula. The goal is to define a task, construct a useful context, and evaluate whether the resulting behavior meets explicit criteria.
The code examples use only the Python standard library. They assemble prompt text and perform simple deterministic checks. They do not call a model, estimate model quality, or establish factual correctness.
1. A prompt is an engineered prefix
In Lesson 4, a language model was described as estimating the next-token distribution given the tokens already in context. If the prompt contains the sequence , the next token is modeled conditionally:
The prompt therefore acts as a prefix that conditions generation. Its task description, context, source material, examples, and constraints all become part of the input available to the model.
This gives a technical reason that prompt structure matters. Clear section labels and delimiters do not create new model capabilities, but they can make the intended relationships among instructions and data easier for the model to use.
The same principle also explains why a prompt cannot make absent information available. If a current price is not in the model's parameters in a reliable retrievable form, not in the context, and not available through a tool, a request for that price does not supply it. The model can still produce a plausible continuation. The prompt must therefore distinguish known source facts from missing facts, and the surrounding application must provide any authorized data access.
The prompt is not a deterministic program. It is an input to a model whose output is generated from learned parameters and a decoding procedure.
2. Separate instructions, context, and source data
A robust prompt distinguishes what the model is being told to do from the material it is being asked to process.
One useful structure is:
- Instructions: the task, priorities, boundaries, and output requirements.
- Context: audience, purpose, situation, and relevant background.
- Source data: the FAQ, notes, excerpt, or records that the response must use.
- Output contract: the expected structure, fields, or sections.
Use clear labels such as TASK, SOURCE, and OUTPUT. Markdown headings, separators, or other delimiters can make boundaries visible. In an application, structured message roles or typed input fields may provide additional separation.
For a source-grounded answer, state whether the source is authoritative, whether other sources may be used, and what to do when the source is incomplete or conflicting. Avoid vague instructions such as "use the information above" when several different documents or examples are present.
For long inputs, label each source and identify the relevant section. If the application retrieves passages, the prompt should still ask the model to distinguish retrieved evidence from inference. Retrieval can improve access to relevant information, but the model can still misread or misuse the retrieved text.
3. Examples, schemas, and pattern conditioning
A prompt can contain examples of inputs and desired outputs. In the prompting literature and provider documentation, this is often described as few-shot prompting. The examples demonstrate a pattern in the context rather than changing the model's trained parameters.
Examples are most useful when the desired pattern is difficult to describe abstractly. They can show tone, classification labels, formatting, or how to handle a missing value.
Choose examples that represent the intended task. Include meaningful variation. If the examples all contain the same easy case, they may not show how the model should behave when a source is silent or a request is ambiguous. A counterexample can clarify a boundary, but label it clearly so it is not mistaken for a desired output.
For machine-readable outputs, specify a schema or a precise field list. A text instruction such as "return valid JSON" can help, but a production application should use a structured-output feature or validate the result with ordinary software when correctness of the structure matters. Prompt wording alone is not a schema validator.
Examples and schemas serve different purposes: examples communicate patterns; schemas define structure. Neither proves that the content is factually correct.
4. Treat prompt improvement as evaluation
Prompt iteration is more reliable when the success criteria are defined before the prompt is tuned.
A simple evaluation workflow:
- Define the intended task and what counts as an acceptable result.
- Collect representative test inputs, including ordinary cases and edge cases.
- Create a baseline prompt.
- Run the same test inputs through the baseline.
- Change one important prompt element.
- Compare the results against the same criteria.
- Keep, revise, or reject the change.
For Harborlight's fictional weekend-fee task, the evaluation criteria might include:
- Does the reply use only the supplied FAQ for policy details?
- Does it avoid inventing a fee?
- Does it state that the FAQ is silent about the fee?
- Does it separate customer-facing text from staff-only review notes?
- Is the wording clear and appropriate for the intended audience?
A simple checklist can catch visible omissions or formatting problems. It cannot determine every semantic or factual error. Human review against the authoritative source remains necessary.
Avoid tuning a prompt only against the exact example used to create it. That can make the prompt appear successful while leaving other cases untested. Keep a separate set of test cases where possible, and rerun them after meaningful prompt changes or model changes.
5. Context budgets, prompt maintenance, and security
Prompt content consumes part of the model's context budget. Long prompts are not automatically better. Repeated instructions, unrelated background, and excessive examples can make the important requirements harder to locate and leave less room for source material or the response.
Organize the prompt so that stable instructions are easy to maintain and task-specific information is clearly separated. In an application, static instructions may be maintained separately from dynamic fields such as a particular question or retrieved source. Validate dynamic inputs before they are inserted.
A prompt library should include the purpose of each prompt, the owner, the expected inputs, the approved sources, and representative test cases. Version changes so a team can identify which prompt was used for a particular workflow.
Treat source documents and user-provided text as data, not automatically as instructions. A document can contain language that appears to direct the model to ignore earlier instructions or reveal information. The application should define which instructions have authority, isolate untrusted content where possible, and avoid giving the model unnecessary tools or permissions.
Do not rely on a prompt to protect secrets. Do not place credentials, passwords, or sensitive information into a prompt unless the system is explicitly designed and approved to handle them. Security depends on the application, data handling, and access controls as well as the wording of the prompt.
6. When prompt engineering is not the right fix
Not every poor output is a prompt problem.
If the model lacks a current source, improve the data connection or provide an approved source. If the task requires exact arithmetic, use a calculator or tested code. If the workflow requires a strict output shape, validate it with a schema. If an action must be approved, enforce that requirement in the application. If the model repeatedly fails a task despite clear instructions and good context, reconsider the model, the task, or the overall system design.
A useful diagnosis asks which layer is failing:
- Prompt: Are the task and constraints unclear?
- Context: Is relevant information missing, stale, or poorly organized?
- Model: Is the task beyond the model's reliable capability?
- Application: Are retrieval, tools, validation, or permissions missing?
- Process: Is a human review or approval step absent?
Prompt engineering is one part of a larger system. It should not be used to disguise missing data, missing controls, or a task that needs a different tool.
Assemble a prompt from named sections
# Standard library only. This example assembles text; it does not call an AI model.
prompt_parts = {
"role": "You are a writing assistant for a fictional home-services company.",
"task": "Draft a short reply to a customer question.",
"context": "The customer asks whether a weekend fee applies.",
"source": "The supplied FAQ does not list a weekend service fee.",
"boundaries": "Do not invent a fee. Identify missing information.",
"output": "Write a friendly email, then a separate staff-review note."
}
required = ("role", "task", "context", "source", "boundaries", "output")
missing = [
name for name in required
if not prompt_parts.get(name, "").strip()
]
if missing:
raise ValueError("Missing prompt sections: " + ", ".join(missing))
prompt = "\n\n".join(
f"## {name.title()}\n{prompt_parts[name]}"
for name in required
)
print(prompt)
print("\nCharacter count:", len(prompt))
print("Whitespace-separated word count:", len(prompt.split()))
print("A word count is not a model token count.")The dictionary keeps prompt sections separate, checks that each required section contains text, and assembles them in a consistent order. The character and whitespace-separated word counts are simple text measurements, not tokenizer counts. The example uses no files, network access, credentials, or third-party packages.
Run a simple output-format check
# Standard library only. These checks inspect visible text, not factual truth.
import re
def review_reply(text):
paragraphs = [part for part in text.strip().split("\n\n") if part.strip()]
checks = {
"has two paragraphs": len(paragraphs) == 2,
"mentions that the FAQ is silent": "faq does not state" in text.lower(),
"contains no dollar amount": re.search(r"\$\s*\d", text) is None,
}
return checks
draft = (
"Thanks for checking with us. We can help explain the available "
"appointment options.\n\n"
"The FAQ does not state a weekend service fee, so our office must "
"confirm that information before we quote it."
)
for label, passed in review_reply(draft).items():
print(("PASS" if passed else "REVIEW"), "-", label)
print("These checks do not prove that the draft is accurate.")
This small example checks a few visible requirements for the fictional exercise: two paragraphs, a statement that the FAQ is silent, and no dollar amount. A real workflow would need checks designed for its policy and output. Passing these checks does not establish that the wording is true or appropriate; a person must still compare it with the source.
Experiment: Compare task-only and structured prompts
Use the fictional weekend-fee question and FAQ from the lesson. Run a task-only prompt and then a structured prompt that includes context, source, boundaries, and output requirements. Keep the source and task identical. Compare whether each response invents a fee, identifies missing information, and follows the requested format. Record the differences without assuming the structured prompt must win in every case.
Experiment: Test what happens when the source is incomplete
Create three fictional FAQ versions: one that states a fee, one that does not state a fee, and one that contains conflicting fee statements. Use the same prompt with each version. Check whether the assistant distinguishes the cases and flags the conflict rather than silently choosing an answer. Do not use real company policies or customer records.
Experiment: Run a controlled prompt revision
Start with a baseline prompt. Make one change, such as adding an explicit audience, a missing-information rule, or an output format. Run both versions against the same test inputs. Record what improved, what stayed the same, and what became worse. Repeat with a different single change.
Experiment: Design a prompt evaluation rubric
Create a small rubric for a repeated task. Include criteria for source use, factual support, missing-information handling, format, tone, and human-review flags. Apply the rubric to several fictional test cases. Explain which criteria can be checked by simple software and which require a person to judge meaning and correctness.
Resources
- OpenAI: Prompt engineering guide
Official technical guidance on prompt structure, context, examples, and model-specific prompting. Some sections are intended for developers building applications.
- Anthropic: Prompt engineering overview
Official overview covering success criteria, evaluation, and links to detailed prompting techniques. Guidance may be model-specific.