Prompting 101: Write a Useful Prompt

Learn the parts of a clear artificial intelligence prompt: task, context, constraints, and a checkable output.

By Chat Overview Published Updated
Prompting 101
Task
Context
Constraints
Output format
Useful first answer
  • Relevant
  • Complete
  • Checkable

Synopsis

A prompt supplies an artificial intelligence (AI) system with instructions and information. A useful prompt states the task, supplies the necessary context, sets relevant constraints, and describes the required output.

The first answer is a draft. Check it before relying on it. A clear prompt reduces avoidable guesses, but it does not guarantee a correct result.

This Guide assumes no previous prompting experience. Prompting 102 covers improvement and verification after the first response.

Before starting

Define the requirements before opening the chat:

  • The task to perform
  • The information required for that task
  • The applicable limits
  • The required output form
  • The checks to perform afterward

Do not paste passwords, private keys, confidential records, or personal data into a service without first understanding how the service stores and uses the information.

The four parts of a useful prompt

1. State the task

Start with a verb that describes the work.

  • Summarize this report.
  • Compare these two proposals.
  • Explain this error message.
  • Rewrite this paragraph for a general audience.

Avoid openings such as "Help me with this" when the task can be named directly.

2. Supply the context

Include facts that affect the answer. Context may include the audience, source material, software version, existing constraints, or the reason for the work.

Bad:

Explain backups.

Better:

Explain full and incremental backups to a new system administrator.
The servers run FreeBSD and the backup window is four hours.

Do not add background merely to make the prompt longer. Include it when the answer depends on it.

3. Set the constraints

Constraints define what the answer may and may not do. Useful constraints include:

  • Length
  • Allowed sources
  • Software or language version
  • Tone and reading level
  • Required or forbidden actions
  • Time, cost, or compatibility limits

If two constraints conflict, correct the conflict before submitting the prompt.

4. Define the output

State the required presentation.

Return five bullet points. Keep each point under 20 words.
Return a table with the columns: Option, Benefit, Cost, Risk.
Show the corrected command first. Explain the change in one paragraph.

A defined output is easier to compare with the request.

A complete first prompt

The following prompt contains all four parts:

Task:
Summarize the attached incident report.

Context:
The summary is for an operations handover. The reader knows Unix but was
not involved in the incident.

Constraints:
Use only facts stated in the report. Mark missing information as unknown.
Keep the summary under 250 words.

Output:
Use the headings Impact, Cause, Recovery, and Follow-up.

This structure is not mandatory. It is useful when the prompt contains several requirements or will be reused.

Improve a vague prompt

Start with the request:

Tell me about transformers.

The request leaves the kind of transformer, intended audience, depth, and format unspecified. Replace those omissions with instructions:

Explain transformer architectures in machine learning to a software
developer who has not studied neural networks.

Cover tokens, attention, and the difference between training and inference.
Use one simple analogy and no equations. Keep the answer under 500 words.
End with three terms for further study.

The revised version still leaves room for the system to explain the subject, but the result is easier to assess.

Reusable template

Task:
[State the action.]

Context:
[Supply the facts, source material, audience, and relevant environment.]

Constraints:
[State limits, required sources, exclusions, and safety conditions.]

Output:
[Describe the structure, length, and format.]

Checks:
[State the required content and the conditions for marking information as uncertain.]

Remove fields that do not help with the task. A short question does not need a long form.

Check the answer

Read the response against the prompt rather than accepting it because it sounds confident.

Check these points:

Did it perform the requested task? 2. Did it use the supplied context? 3. Did it follow the constraints? 4. Did it return the required format? 5. Which claims need an independent source or test? 6. Did it introduce assumptions that were not in the prompt?

For code, commands, configuration, medical information, legal information, or financial decisions, use an appropriate independent check before acting.

Common failures

The answer is too broad

Narrow the task and identify the reader.

Explain only the backup rotation policy. Assume the reader already knows rsync.

The answer is too long

Set a length and a format.

Return no more than six bullet points. Put optional detail under Notes.

The answer invents missing facts

Separate supplied facts from unknown information.

Use only the attached text. If the text does not answer a question, write Unknown.

The answer ignores a requirement

Move the requirement closer to the task, remove conflicting instructions, and submit a shorter prompt.

Practice exercise

Rewrite this prompt using the four-part structure:

Write something about our new product.

Before submitting it, decide:

  • What is the required subject and form?
  • Who is the intended audience?
  • Which product facts are available?
  • Which claims are prohibited?
  • What is the required length?
  • How will the result be checked?

Next step

Prompting 102 explains how to inspect, correct, compare, and verify the first answer.

Use the specialist Guides when the task involves code , images , system administration , or creative writing .