Introduction to Prompt Engineering

Learn how tasks, background, constraints, and output requirements turn vague requests into clear prompts.

🎯 Introduction

Suppose you run an online store and need to email a customer that their purchase will ship two days late.

You open an AI chat tool and enter:

Write me an email.

AI may produce an email, but it may not be what you need: it knows neither the recipient nor the purpose.

To get a suitable result, make your requirements clear. We will use this email to learn how to write a clear prompt.


🧱 What Is a Prompt?

“Write me an email” is a prompt.

A prompt is content we provide to AI to tell it what task to perform. It can be one sentence or include background and specific requirements.

Prompt engineering means organizing, testing, and improving this information so AI can better meet our needs.


🧱 What Makes a Clear Prompt?

Keep refining the email request. Rather than aiming for a perfect prompt immediately, identify the missing information.

Step 1: Define the Task

The original prompt:

Write me an email.

Add the recipient and purpose:

Write an email to a customer explaining that their purchase will ship late.

This defines the task: what AI should do.

Step 2: Add Necessary Background

AI still needs the cause and expected delay:

Write an email to a customer explaining that their purchase will ship late.
Heavy rain is expected to delay shipping by two days.

This is background: information needed to complete the task. Include relevant details without making it unnecessarily long.

Step 3: Specify Requirements

You want a sincere tone without promising an arrival date, because only the shipping delay is known:

Write an email to a customer explaining that their purchase will ship late.
Heavy rain is expected to delay shipping by two days.
Use a sincere tone, do not promise an exact delivery date, and use no more than 150 characters.

These are constraints the model must follow.

An expected two-day shipping delay and no promised delivery date are compatible. Shipping means dispatching goods; delivery means the customer receives them.

Step 4: Specify the Output

To copy the email directly without introductory commentary, add:

Return only the email body, without additional explanation.

These are output requirements, defining the form of the result.

Combining everything gives a usable prompt:

Write an email to a customer explaining that their purchase will ship late.
Heavy rain is expected to delay shipping by two days.
Use a sincere tone, do not promise an exact delivery date, and use no more than 150 characters.
Return only the email body, without additional explanation.

We used four elements:

ElementQuestion
TaskWhat should AI do?
BackgroundWhat does it need to know?
ConstraintsWhich requirements must it follow?
Output requirementsHow should it return the result?

These elements help check clarity; they are not a mandatory template. One sentence may suffice for a simple task. Add information when needed.


🧱 Improving Vague Prompts

If an existing prompt gives an unsatisfactory result, first identify what is unclear rather than immediately rewriting everything.

For example:

Vague requestWhy it is unclearPossible revision
Make it better“Better” is undefinedUse a natural, polite customer support tone
Make it shorterNo target lengthUse no more than 100 characters
Analyze thisNo analytical focusIdentify three main risks and explain their effects

Check: Is the task clear? Is necessary background missing? Are requirements specific? Is the desired result defined?

If an email sounds too formal, adding “Use a natural, friendly customer support tone” may help without adding extensive background.

Review the actual response, then revise for specific issues instead of accumulating unrelated instructions.


💡 Why Can AI Still Make Mistakes with a Clear Prompt?

Clear prompts help AI follow requirements, but do not guarantee perfect results.

For example, “Shipping is expected to be delayed by two days” must come from actual order information, rather than a model's guess.

AI can compose the notice, but does not know every order's status. Shipping dates, prices, and refund amounts still require reliable business data.

Prompts specify requirements; actual information still needs verification. Check whether the response meets those requirements.


❓ Knowledge Check

Q1: Are longer prompts always better?

No. Include the information needed for the task. Repeated, irrelevant, or conflicting requirements can obscure the point.

Q2: Must prompts explicitly label task, background, constraints, and output?

No. They are organizational elements, not required syntax. A few clear sentences, as in the email example, are sufficient.

Q3: Does a clear prompt guarantee compliance?

No. Check for omissions, violated requirements, and inaccurate content.


🧪 Exercise

Suppose your store's homepage needs a notice: the website will undergo maintenance this Sunday from 22:00 to 23:00, and customers may be unable to place orders during that period.

Start with:

Write an announcement.

Turn it into a prompt ready to send to AI. Address store customers, use a clear and polite tone, limit it to 100 characters, and request only the announcement body.

Send the prompt to your usual AI tool and inspect the result.

Success criteria: Specify the task, maintenance period and impact, writing requirements, and output format. Check that the notice accurately includes the time and possible ordering disruption without inventing promises.

Compare your version with this example:

Write a maintenance notice for customers on the online store's homepage.
Maintenance is scheduled for this Sunday from 22:00 to 23:00. Customers may be unable to place orders during that period.
Use a clear, polite tone, keep it within 100 characters, and return only the notice body.
Do not add promises that have not been provided.

This is one possible prompt. Before publishing, replace “this Sunday” with an explicit date and confirm the maintenance time.


🎉 Congratulations! You can use tasks, background, constraints, and output requirements to clarify vague requests. Next, we will organize roles and instructions.