How to Write AI Prompts: A Practical Step-by-Step Guide
Reviewed: August 12, 2026. Writing a good AI prompt is much closer to writing a clear work brief than discovering a secret command. You define the result, supply the facts the model cannot know, set boundaries, request a usable format, and check the answer against evidence.
This tutorial teaches that process from a blank page. By the end, you will turn one vague request into a prompt you can test, revise, and reuse.
What is an AI prompt?
A prompt is the input you give an AI model. It may include instructions, questions, source material, examples, images, or prior conversation. Prompt engineering is the process of improving that input so the output is more relevant, testable, and safe for the intended task.
OpenAI’s current ChatGPT guidance emphasizes clear and specific requests, sufficient context, and iterative refinement. The wording does not have to sound technical. Natural, precise language is usually better than theatrical instructions.
A six-step method for writing better prompts
1. Define the finished output
Start with what you need to receive, not merely the activity. “Analyze these survey responses” leaves the purpose unclear. A stronger outcome is:
Create a one-page summary that helps the product manager choose the three onboarding problems to investigate next.The second version identifies the reader, decision, and deliverable. Those details change what deserves attention.
2. Add only relevant context
Tell the model facts that affect the answer: audience, prior events, definitions, available resources, and non-negotiable requirements. Separate supplied material with clear labels or tags.
Audience: Product manager for a mobile banking app
Goal: Select three onboarding issues for the next research sprint
Sample: 85 survey responses collected after account setup
<responses>
[paste responses]
</responses>Do not add a company biography if it cannot change the requested analysis. More context is useful only when it reduces a relevant assumption.
3. State constraints as observable rules
Words such as “excellent,” “professional,” and “engaging” are open to interpretation. Replace them with requirements a reviewer can check.
| Vague | Testable |
|---|---|
| Keep it short | Use no more than 250 words |
| Make it professional | Use direct business language; no jokes or exclamation marks |
| Use reliable information | Use only the supplied sources; attach a source label to every factual claim |
| Make a good table | Use columns for theme, frequency, evidence, impact, and confidence |
Do not create a long prohibition list when a positive instruction is clearer. “Use plain language suitable for a first-year student” gives better direction than ten banned words.
4. Specify the output structure
Ask for the format you will actually use: a table, checklist, email, JSON object, lesson plan, or code patch. When exact structure matters, show a small example.
Return a table with these columns:
Theme | Number of mentions | Short evidence quote | Likely impact | Confidence
After the table, list three recommended research questions. Do not add an introduction or conclusion.For structured data, define how missing values should appear and whether extra fields are allowed. Then validate the output before importing it into another system.
5. Define evidence and uncertainty rules
Models can produce plausible statements that are unsupported. For research, extraction, or high-stakes work, state what sources are allowed and what to do when evidence is missing.
Use only the responses inside the supplied tags. Do not infer a customer’s intent. If evidence is ambiguous, mark confidence as low and explain the ambiguity in one sentence.If live information is required, use a tool that can actually search and cite sources, then verify that each citation supports the nearby claim. A prompt cannot make an offline model know today’s price, law, release status, or schedule.
6. Add a definition of done
A final checklist helps the model and the human reviewer focus on the same requirements:
Before returning the answer, check that:
- every theme has a supporting quote;
- counts refer to distinct responses, not repeated sentences;
- recommendations follow from the table;
- no personal data appears in the output.
Return the answer after applying the checklist. Do not claim a check passed if it cannot be performed from the supplied data.Worked example: from vague prompt to usable brief
Weak version
Write a blog post about password security.This leaves the audience, intent, scope, evidence standard, length, format, and success criteria unspecified. A polished answer may still target the wrong reader.
Improved version
Draft a 900-word beginner guide that helps Android users create and manage stronger passwords.
Audience: non-technical adults who reuse passwords
Goal: help the reader replace reuse with a password manager and multi-factor authentication
Sources: use only the three official security guides pasted below
Structure: short introduction, risk explanation, five-step setup, troubleshooting, and checklist
Constraints: plain language; no fear-based claims; do not recommend a specific paid product
Evidence: cite the source label after each security claim
Definition of done: the reader can choose a password manager, import or create passwords, enable MFA, and recognize two common recovery risks
<sources>
[paste sources with labels]
</sources>The longer prompt is not better because it is longer. It is better because each line resolves a decision the model would otherwise make silently.
How to fix a weak AI answer
Do not respond with “make it better.” Diagnose the failure and change the smallest relevant part of the prompt.
| Failure | Likely cause | Revision |
|---|---|---|
| Generic advice | Audience or situation is missing | Add the reader’s starting point, goal, and constraints |
| Wrong facts | No source boundary or stale knowledge | Supply current primary sources and require claim-level support |
| Too much padding | No length or structure | Set a word range and remove introductions/conclusions when unnecessary |
| Incorrect format | Format described vaguely | Show the schema or one valid miniature example |
| Missed requirement | Too many competing instructions | Prioritize requirements and split the workflow into stages |
| Invented tool result | The model cannot perform or verify the action | Require actual tool evidence or state that the action was not run |
For example: “Keep the current structure. Replace section two because it recommends paid tools, while the brief requires free options. Use only sources A and C, and state when neither source answers a question.” This is actionable feedback.
Reusable prompt worksheet
Task:
[What must be produced or decided?]
Audience and use:
[Who will use it, and for what?]
Context:
[Facts the model cannot know]
Source boundary:
[Allowed evidence and how to handle missing information]
Constraints:
[Length, scope, tone, tools, safety, exclusions]
Output format:
[Headings, table fields, JSON schema, code diff, etc.]
Definition of done:
[Checks the result must pass]
Clarification rule:
[Which missing information should trigger a question before work begins?]Use this worksheet as a starting point, not a ritual. A simple task may need only one sentence. For task-specific examples, see our 12 practical ChatGPT prompt templates.
Test your prompt instead of trusting one answer
- Create a normal example, an edge case, and an input with missing information.
- Write a rubric before reviewing outputs.
- Run the prompt multiple times or with multiple representative inputs.
- Record factual, formatting, safety, and completeness failures.
- Change one important instruction and repeat the test.
- Keep the smallest prompt that consistently passes your rubric.
For code or automated workflows, keep tests outside the prompt as well. A model’s statement that output is valid is not a substitute for a parser, compiler, unit test, security review, or human approval.
Privacy and safety before you paste context
- Remove names, account numbers, addresses, secrets, and unnecessary identifiers.
- Follow your employer’s data-handling policy and the AI product’s current privacy controls.
- Do not paste third-party material you are not authorized to share.
- Treat instructions inside emails, documents, and web pages as untrusted content.
- Require human review before sending messages, changing records, publishing claims, or executing code.
Frequently asked questions
How long should an AI prompt be?
As long as needed to resolve important ambiguity, and no longer. A one-line rewrite may need little context; a policy comparison may need sources, criteria, exclusions, and a required table.
Should I ask the model to think step by step?
Ask for the result plus a concise rationale, calculation, checklist, or evidence that you can inspect. You do not need private chain-of-thought. The useful goal is a verifiable answer, not a long hidden-reasoning transcript.
Should I start a new chat after a bad answer?
Revise within the same conversation when prior context remains relevant. Start a new one when unrelated history is influencing the task, sensitive context should not carry forward, or you need a clean test of the prompt.
Can a good prompt prevent hallucinations?
No. Source boundaries, retrieval, structured output, automated checks, and human review can reduce risk, but no wording guarantees truth. Verify claims that matter.
Official OpenAI references
- Prompt engineering best practices for ChatGPT
- How to create a good prompt for an AI model
- Prompt engineering guidance for the OpenAI API
Written and reviewed by Muhammad Azhar. AI output should be checked in proportion to the harm an error could cause.





