How to Write Your First Prompt

Writing your first prompt doesn't have to be a guessing game. Learn the simple, structured recipe to get reliable, high-quality answers from any AI model.

On this page
Laptop on a clean desk
AI-generated illustration

Why prompts matter more than the tool you pick

Whether you are using OpenAI's models or Anthropic's Claude, the quality of the output you receive is directly tied to the quality of your input. This input is called a "prompt." Many beginners treat AI like a search engine, typing in short, vague keywords. However, modern large language models perform best when treated like a capable, newly hired colleague who has plenty of general knowledge but lacks context about your specific goals and workflows [1]. If you are just starting out, you might also want to read our What Is Generative AI? guide to understand how these tools work.

By learning how to structure your instructions, you can dramatically improve the accuracy, tone, and formatting of the AI's responses, saving you time and reducing frustrating, incorrect answers.

The recipe

A highly effective prompt does not need to be overly complex, but it should contain a few essential ingredients. When drafting a prompt, aim to include the following components:

  • Role or Persona: Tell the AI who it is acting as (e.g., "You are a helpful coding assistant specializing in Python" [1]).
  • Clear Task: State exactly what you want the AI to do. Be direct and specific [1].
  • Context and Constraints: Provide background information and set boundaries (e.g., length limits, tone, or specific things to avoid [2]).
  • Output Format: Explicitly define how the final response should look, such as a bulleted list, a paragraph of a specific length, or structured JSON [3].

Put together

Let's look at how these ingredients combine into a single, cohesive prompt. Instead of writing a vague request, we can structure our prompt to give the AI clear guardrails.

Use-case
Drafting a professional product description
Best-for
E-commerce store owners and copywriters

Hypothetical Example Prompt:

You are an experienced e-commerce copywriter.

Task: Write a product description for a new reusable stainless steel water bottle.

Context: The target audience is environmentally conscious commuters. The bottle keeps drinks cold for 24 hours.

Constraints: Use a 3 to 5 sentence paragraph to describe this product. Do not use fluffy or vague marketing jargon.

Output Format: A single paragraph followed by a bulleted list of 3 key features.

The same request, three ways

To understand how prompt structure changes the quality of the output, compare these three levels of prompting for the same task:

Prompt Style Example Prompt Expected Result Quality
Less Effective (Vague) "Write a poem about OpenAI." [2] Generates a generic, highly predictable poem that may not fit your specific needs.
Better (Specific) "Write a short inspiring poem about OpenAI, focusing on the recent DALL-E product launch..." [2] Produces a targeted, relevant poem with the correct thematic focus.
Best (Structured with Examples) "Write an inspiring poem about OpenAI in the style of [Famous Poet]. Here is an example of the style: [Insert Example]" Providing examples is one of the most reliable ways to steer the model's output format and tone [1].

Three beginner power moves

If you want to quickly level up your prompting skills, implement these three proven techniques:

1. Use Examples (Few-Shot Prompting)

Showing is always better than telling. Providing 3 to 5 high-quality examples of your desired input and output format is one of the most reliable ways to steer an AI's tone, structure, and accuracy [1]. Wrap your examples in clear labels or XML tags so the model can easily distinguish them from your main instructions [1].

2. Structure with XML Tags

When your prompt contains a mix of instructions, background documents, and user inputs, use XML tags (like <documents>, <document_content>, or <source>) to keep things organized [1]. This prevents the AI from getting confused about where your instructions end and your data begins.

3. Tell the AI What to Do Instead of What Not to Do

Negative constraints (e.g., "Don't do this") are often difficult for language models to follow consistently. Instead of just telling the AI what to avoid, explicitly guide it on the correct alternative action [2]. For example, instead of saying "Do not ask for a password," say "If the user asks about logging in, refer them to the help article at www.samplewebsite.com/help/faq" [2].

Mistakes that cost the most

Avoid these common pitfalls to ensure your prompts remain reliable and accurate:

  • Using "Fluffy" or Imprecise Descriptions: Phrases like "make it fairly short" or "not too much more" are highly subjective. Instead, use precise constraints like "Use a 3 to 5 sentence paragraph" [2].
  • Encouraging Guessing (Hallucinations): AI models are trained to predict the next word, which means they can confidently generate false information (hallucinations) when they don't know the answer [4]. To combat this, you can explicitly instruct the model to state "I don't know" rather than guessing [4].
  • Hiding the Query at the Top: If you are pasting a long document or article for the AI to analyze, place the long text at the top of your prompt and put your specific questions or instructions at the very bottom [1]. This simple layout change can improve response quality by up to 30% in complex tasks [1].

Exercises

Practice your skills by rewriting the following weak prompts using the rules we've discussed:

  1. Weak Prompt: "Summarize this article."
    How to improve: Specify the length (e.g., "Summarize this article in 3 bullet points"), define the target audience, and place the article text above the instruction using XML tags [1].
  2. Weak Prompt: "Write an email. Don't make it sound robotic."
    How to improve: Define the role (e.g., "You are a friendly customer support agent"), state the goal of the email, and provide a positive tone instruction (e.g., "Use a warm, conversational tone and short sentences").

Check your understanding

Before moving on, review this quick checklist to ensure your prompt is ready to send:

  • Did I clearly state the role or persona for the AI?
  • Are my instructions written as clear, sequential steps?
  • Did I place long reference documents at the top and my questions at the bottom?
  • Have I provided 3 to 5 diverse examples of the output format I want?
  • Did I tell the AI to say "I don't know" if it lacks the necessary information?

Quick answers

What is the "Golden Rule" of prompting?

Show your prompt to a colleague with minimal context on the task. If they would find the instructions confusing or vague, the AI model will likely be confused as well [1].

Why does the AI make up facts (hallucinate)?

Language models learn by predicting the next word in a sequence and are often evaluated on accuracy metrics that reward guessing over admitting uncertainty [4]. You can reduce this by explicitly telling the model to abstain or say "I don't know" when uncertain [4].

Should I use XML tags in my prompts?

Yes. Wrapping different parts of your prompt (like instructions, examples, or input documents) in XML tags (e.g., <doc>...</doc>) helps the model parse complex prompts without misinterpretation [1].

Next on the path

Now that you know how to write a basic prompt, you are ready to explore how to use these tools for everyday tasks. Check out our guide on AI for Spreadsheets: 5 Beginner Prompts to see how to apply your new prompting skills to data analysis, or learn how to verify your results with our guide on How to Fact-Check an AI Answer.

Sources and research notes

Research checked 2026-09-24. Source comparison; this is a research synthesis. Findings attributed to other reviewers remain their work.

  1. Prompting best practices
  2. Best practices for prompt engineering with the OpenAI API | OpenAI Help Center
  3. Why language models hallucinate | OpenAI

What the evidence does not establish

  • The 30% performance improvement from placing queries at the end is based on Anthropic's internal tests and may vary depending on the specific model and complexity of the input documents.