Skip to main content
Practice

What Is a Prompt?

A prompt is the entire input message you send to a generative AI telling it "what to do and how." It is more than a single line of text. Think of it as a request package that can include task instructions, background information, reference materials, and output formatting requirements.

Prompt components

For example, if you want to summarize a news article, you might send a prompt like this:

Prompt Example
Read the following news article and summarize only the key points in 3 sentences.

When a prompt is well written, you get the result you want on the first try. When a prompt is vague, results become inconsistent. It helps to think of a prompt as consisting of four components: Instruction, Context, Input Data, and Output Directives.

Instruction

The instruction is the part that summarizes in one sentence what task AI must perform. It determines the type of task: "summarize this," "translate this," "analyze this," "compare these." When the instruction is unclear, AI has to guess "what kind of answer is wanted?" When that guess is off, the result may be unsatisfying.

Bad Instruction Example
Draw me a cabin.

This instruction is too broad. There is no information about style (photorealistic or illustrated), atmosphere (daytime or nighttime), or surrounding setting. If the result is not what you wanted, you end up asking again and again, wasting time and cost.

Good Instruction Example
Draw a small wooden cabin nestled in a quiet mountain setting. Surround it with dense green trees, and render the background sky with an orange and pink gradient sunset.

A good instruction organizes conditions clearly enough that AI can follow "the scene you are picturing in your head." What matters is not length but not leaving out any criterion that needs to be decided.

Context

Context is the background information that helps AI execute the instruction more precisely. Even the same task word, "analyze," should produce different results depending on the purpose. Adding context helps AI understand "why this task is being done" and makes it easier to focus the response appropriately.

Prompt Example
# Instruction
Based on the product sales data below, analyze the sales trends by category over the past 5 years.

# Context
Market competition has intensified recently, and we are re-evaluating strategy by product line.
We need to understand how sales vary by season and which categories are growing or declining.

When the purpose of "strategy formulation" is given as context, AI does not stop at simply summarizing a chart. It will more actively include interpretations relevant to decision-making: growth/decline patterns, seasonality, and implications.

Input Data

Input data is the raw material AI should reference. Everything that serves as the basis for the task goes here: text, tables, code, meeting notes, link summaries. Even with the same instruction, if input data is sparse, AI will fill in the gaps with guesses.

In the sales analysis example, the input data would look like this:

YearMonthProduct CategorySales
20191Home Appliances150
20191Furniture75
20191Electronics200
20192Home Appliances165
............
202312Home Appliances190
202312Furniture90
202312Electronics230

More input data is not always better. Providing only what is needed for the task, cleanly scoped, produces more stable results and also reduces token costs.

Output Directives

Output directives specify what form the result should take. Even the same analysis looks completely different depending on whether you want "a 3-sentence summary," "organized in a table," or "in report format." Without output directives, AI tends to produce long explanations, and the format may vary each time.

Output Directive Example
Please format the output as follows:
1) 3-sentence summary
2) Trend table by category (Growing / Declining / Mixed)
3) 3 observations on seasonality
4) 3 suggested next actions

Or if you want visualization as well:

Output Directive Example
Imagine you are visualizing monthly sales by category as a line graph, and describe in writing the key patterns that would be visible in the graph.
Then write a 1-page report that can be used directly in a strategy meeting.

As we noted earlier, output tokens cost significantly more than input tokens in AI pricing, so specifying output directives clearly makes a big difference in cost management.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.