How to Write AI Prompts: Complete Guide With Examples

Laptop displaying a structured AI prompt with cards for goal, context, input, constraints, output and quality.

Learning how to write AI prompts is one of the simplest ways to get more useful results from tools such as ChatGPT, Claude, Gemini and other AI assistants.

A weak prompt might produce a generic answer, misunderstand your goal or give you far more information than you need. A well-designed prompt can specify the task, provide the right context, define important constraints and tell the AI exactly what a useful result should look like.

But effective prompting in 2026 is different from the early days of generative AI.

You usually do not need mysterious “magic words,” unnecessarily complicated prompt formulas or pages of instructions. Modern AI models have become substantially better at understanding natural language and following complex requests. Current guidance from OpenAI emphasizes clear goals, context, outcome requirements and iterative refinement; Anthropic similarly recommends direct instructions, useful context and examples where they help; Google’s Gemini documentation recommends precise instructions, constraints, structured prompts and appropriate examples.

The most useful principle is simple:

This guide explains how to write AI prompts step by step, with practical examples for writing, research, coding, business, studying, data analysis, SEO, document analysis and AI image generation.

Last reviewed: September 2026

Editorial note: AI models change quickly. A prompt that works extremely well with one model may behave differently with another. Treat the techniques in this guide as strong starting points, then test them with the model and task you actually use.

What Is an AI Prompt?

An AI prompt is the information or instruction you give an artificial intelligence system to tell it what you want.

A prompt can be as simple as:

Or it can contain detailed instructions, source material, examples and formatting requirements:

Prompts are not limited to text.

Depending on the AI system, a prompt can also include images, audio, video, PDFs, spreadsheets, webpages, code or other files. OpenAI’s current prompting material, for example, defines prompts broadly enough to include text, images, audio and shared files.

If you are new to AI assistants more generally, our Conversational AI guide explains how modern conversational systems process natural-language interactions.

What Is Prompt Engineering?

Prompt engineering is the process of designing, testing and refining instructions so an AI model produces more useful and reliable results.

The term can make prompting sound more technical than it needs to be.

For everyday users, prompt engineering often means improving questions such as:

into something like:

The second prompt gives the model enough information to make useful decisions.

OpenAI’s current guidance describes prompt engineering as designing and optimizing inputs to guide model responses and recommends clear, specific requests followed by iterative refinement when necessary.

Why Learning How to Write AI Prompts Still Matters in 2026

Modern models understand natural language considerably better than earlier generations, so prompt engineering is becoming less about tricking the model and more about communicating the actual task clearly.

OpenAI’s recent model guidance increasingly favors outcome-oriented prompting: describe the desired result, success criteria, important constraints, available evidence and required output rather than micromanaging every reasoning step.

Anthropic makes a similar point. Its current Claude prompting documentation says to be clear and direct, provide context and specify the desired output and constraints. Anthropic even suggests a practical test: if a colleague with little background information would be confused by your instruction, the AI probably lacks enough context too.

Google’s current Gemini guidance likewise recommends precise instructions, explicit constraints, clear output requirements and consistent prompt structure.

This means one of the best ways to improve an AI response is often not adding more words.

It is removing ambiguity.

The Six Parts of a Strong AI Prompt

Six parts of a strong AI prompt goal, context, input, constraints, output and quality criteria

There is no universal prompt formula that works perfectly for every model and task.

However, most effective prompts contain some combination of six useful elements:

Prompt elementQuestion it answersExample
GoalWhat should the AI accomplish?Compare three laptops
ContextWhat background does it need?I am buying one for university
InputWhat material should it work from?These three specifications
ConstraintsWhat limits must it follow?Under $1,000; battery matters most
OutputHow should the result be presented?Comparison table + recommendation
Quality criteriaWhat makes the answer successful?Explain tradeoffs and flag uncertain data

You do not need every element in every prompt.

For a basic question, this may be enough:

For a complicated task, the fuller structure becomes valuable.

For example:

That prompt does much more than simply say:

How to Write AI Prompts Step by Step

How to write AI prompts step by step from goal to refined result

The easiest way to learn how to write AI prompts is to start with the desired outcome.

Suppose you want an article.

The weak version is:

The AI has to guess almost everything:

Who is reading it?

What part of cybersecurity matters?

How long should it be?

Should it be technical?

Should it contain sources?

Is the article for beginners or security professionals?

What is its purpose?

A much stronger version is:

The task is now much harder to misunderstand.

Start With the Outcome, Not a Vague Topic

One of the biggest prompting mistakes is giving the AI a subject without explaining what you want done with it.

Consider:

The AI cannot know whether you want:

a definition, buying guide, market forecast, technical explanation, school essay, social post, business analysis or debate.

A stronger prompt states an action:

Better again:

The subject remains the same.

The goal becomes much clearer.

Give the AI Relevant Context

Context helps an AI understand why you are asking and which answer is useful.

Anthropic explicitly recommends providing context or motivation because it helps the model understand the purpose behind an instruction. Google also recommends supplying contextual information rather than assuming the model already has everything required to solve the task.

Compare:

with:

Context changes the answer dramatically.

The same principle applies to coding:

is weaker than:

For more examples specifically related to programming, see our Best AI for Coding guide.

Tell the AI Who the Audience Is

Audience is often one of the highest-value pieces of context.

Compare:

with:

or:

or:

The factual topic is the same.

The useful response is completely different.

Specify Constraints That Actually Matter

Constraints reduce the AI’s decision space.

Useful constraints include length, budget, technology, geography, timeframe, reading level, prohibited assumptions and required evidence.

For example:

becomes:

The important principle is to specify real constraints, not fill the prompt with arbitrary rules.

Modern models can actually perform worse when overloaded with conflicting or unnecessary instructions. OpenAI’s current model guidance specifically recommends removing legacy prompt complexity where it adds noise and defining the desired outcome instead.

Tell the AI What the Output Should Look Like

Do not assume the model knows your preferred format.

If you need a table, say table.

If you need a short answer, specify a limit.

If you need JSON, define the schema or use the product’s structured-output feature where available.

If you need WordPress headings, say so.

Compare:

with:

Google’s prompting documentation explicitly recommends telling the model the desired response format, such as a table, list or paragraph. OpenAI likewise recommends being specific about length, format, style and outcome.

Show the AI an Example When Format Matters

Sometimes explaining what you want is harder than showing it.

This is known as few-shot prompting.

Suppose you need product titles converted into a very specific format.

Instead of only describing the rule, provide examples:

Examples are especially useful for classification, formatting, tone and repeated workflows.

Anthropic calls examples one of the most reliable ways to steer format, tone and structure and recommends relevant, diverse examples. Google likewise recommends few-shot examples for controlling patterns and output behavior.

You do not need examples for every simple prompt.

Use them when the desired pattern is difficult to describe or the AI repeatedly gets it wrong.

Use Delimiters for Long or Complicated Prompts

When a prompt contains instructions, source material, examples and output requirements, clearly separating them can reduce confusion.

Markdown headings work well:

XML-style tags are another option:

OpenAI recommends clear separators such as Markdown headings or delimiters in complex prompts, while Anthropic specifically recommends XML tags when prompts mix instructions, context, examples and variable inputs. Google supports both Markdown and XML-style structure for complex Gemini prompts.

Ask for Evidence When Facts Matter

If the answer depends on current or verifiable facts, the prompt should say so.

Do not merely write:

Try:

This is particularly important for research.

A strong research prompt defines the evidence standard.

For example:

If research is a major part of your workflow, our Best AI for Research comparison covers dedicated research systems and source-verification strategies.

Do Not Assume “Give Me Sources” Guarantees Accurate Citations

A common prompting mistake is believing this instruction solves factual reliability:

It does not.

A model can provide a real source that does not fully support the claim, misunderstand a paper, use outdated evidence or—in systems without live retrieval—even produce a reference incorrectly.

A better prompt is:

Then open the important sources yourself.

AI should assist verification, not replace it.

How to Write AI Prompts for Research

A research workspace with an AI assistant, source documents, citation checks and a structured research question.

A poor research prompt:

A much stronger prompt:

That prompt gives the AI both a research problem and a research methodology.

How to Write AI Prompts for Content Writing

Structured AI prompt for content writing with audience, tone and outline

A weak writing prompt:

A better prompt:

If writing for search, the prompt should help produce content for readers rather than manipulate rankings.

Google says its systems aim to prioritize helpful, reliable, people-first information. It specifically warns that using generative AI to create many low-value pages for ranking manipulation can violate its scaled-content-abuse policy.

That means this is a poor SEO prompt:

A healthier prompt is:

Google’s 2026 guidance for generative-AI search likewise emphasizes unique, non-commodity material rather than manufacturing pages for every search variation.

How to Write AI Prompts for SEO

AI can help with SEO, but you should use it to improve useful content rather than mechanically manufacture search pages.

For example:

Another useful prompt:

Google’s Search Essentials recommend using words people actually use to find content in prominent locations such as titles, main headings, link text and alt text, while still creating content primarily for users.

How to Write AI Prompts for Coding

Good AI coding prompt with requirements, code context and tests

A weak coding prompt:

A better one:

For larger development projects, a repository-aware coding agent may be more useful than a normal chat interface. See our Best AI for Coding comparison for that distinction.

How to Write AI Prompts for Business

Business prompts become more useful when the model understands the decision, audience and authority boundaries.

Instead of:

try:

For a business analysis:

If you are building broader business workflows around AI, see our guide to using an AI chatbot for business.

How to Write AI Prompts for Emails

Useful email prompts specify the relationship, purpose and tone.

For example:

You can also request alternatives:

How to Write AI Prompts for Summarization

The instruction:

is sometimes enough.

For serious documents, define what information matters:

This reduces the chance of getting a generic summary that emphasizes information you do not care about.

How to Write AI Prompts for Long Documents

Long-context prompting deserves special treatment.

If you paste a large contract, report or collection of research papers, clearly separate the source from your instructions.

For example:

Anthropic’s current guidance for long-context prompts recommends placing large documents prominently and clearly separating documents and metadata; it also reports improved performance in its testing when the actual query follows large source material.

The exact optimal placement can differ across models, so treat this as model-specific guidance rather than a universal law.

How to Write AI Prompts for Studying and Learning

Do not use AI only to give you answers.

You can prompt it to make you actively think.

For example:

For exam preparation:

This turns the AI into a tutor rather than an answer generator.

How to Write AI Prompts for Data Analysis

Data analysis prompts should distinguish observations from conclusions.

For example:

When calculations matter, tools that can actually execute code are generally preferable to asking a language model to mentally calculate everything. Google’s current Gemini prompting guidance similarly recommends using code execution for calculations when available.

How to Write AI Prompts for Image Generation

AI image prompt structure with subject, setting, composition, lighting and style

Image prompts benefit from describing the visual result rather than writing an essay about it.

A useful structure is:

subject + environment + composition + lighting + visual style + important constraints

For example:

For a website illustration:

Avoid relying on long negative lists when a clear positive description can specify the desired composition.

For example, instead of only saying:

say:

How to Write AI Prompts for Brainstorming

A weak brainstorming request:

will usually produce familiar ideas.

Define the problem and evaluation criteria:

Then continue:

Prompting works particularly well as a conversation.

You do not need to put everything into the first message.

How to Ask AI to Improve Its Own Answer

One of the most useful follow-up prompts is simply:

For research:

For writing:

Iteration is explicitly recommended by OpenAI and Google rather than treating the first prompt as something that must be perfect.

Should You Tell AI to “Act as an Expert”?

Role prompting can be useful, but it is often misunderstood.

This:

does not magically make a model more accurate.

A more useful role is specific:

The role helps define the perspective and standards.

Anthropic’s current guidance supports using roles to focus model behavior, while modern OpenAI guidance increasingly emphasizes the outcome and success criteria rather than elaborate personas.

Should You Say “Think Step by Step”?

You will still see old prompt guides recommending:

That advice is no longer universally appropriate.

Different model families reason differently.

Modern reasoning models often perform substantial reasoning internally and increasingly benefit from straightforward, outcome-focused instructions rather than being forced through a human-designed reasoning procedure. OpenAI’s current model guidance recommends describing the expected outcome and allowing capable models to choose an efficient path unless a particular process is genuinely required. Anthropic similarly says general reasoning instructions can be preferable to prescriptive hand-written reasoning steps for its latest models.

For most everyday prompts, instead of requesting the model’s private reasoning process, ask for something useful and verifiable:

That gives you evidence you can inspect without requiring a long internal reasoning transcript.

Zero-Shot vs Few-Shot Prompting

A zero-shot prompt gives the instruction without demonstrating examples:

A few-shot prompt demonstrates the desired pattern first:

Few-shot prompting becomes useful when consistency matters.

Google recommends specific and varied examples for tasks where examples help the model understand the pattern. Anthropic similarly recommends relevant and diverse examples for format and behavior control.

Tell the AI What to Do, Not Only What Not to Do

Consider:

The AI knows many things to avoid but has a less precise description of the desired result.

Try:

Anthropic explicitly recommends positive instructions where practical—for example, specifying the desired prose format instead of only saying what formatting to avoid.

Negative constraints still have a place when the prohibition actually matters:

Use strong prohibitions for true boundaries, not as the entire prompt.

Tell the AI What to Do When Information Is Missing

This is one of the most underrated prompting techniques.

Without guidance, an AI may guess.

Instead:

For document analysis:

Microsoft’s prompt-engineering guidance similarly recommends giving the model an explicit fallback path when information is not available.

How to Prompt AI to Handle Uncertainty

You can explicitly request calibrated uncertainty:

Or:

Or:

These prompts are particularly valuable for research, business decisions and any subject where information is incomplete.

Multimodal Prompting: Images, Screenshots and Files

Multimodal AI prompt using images, screenshots, PDFs and spreadsheets

Modern AI systems increasingly accept more than text.

When uploading a screenshot, do not simply write:

Try:

For an invoice:

The key is the same as text prompting:

tell the model what to inspect and what result you need.

How to Write Prompts for Comparing Options

Weak:

Better:

This prevents the AI from deciding what “better” means on its own.

Our Best AI Chatbot and Best AI for Research articles use this same principle: a tool can be stronger for one workflow and weaker for another.

How to Write Prompts That Produce Current Information

Language models may have knowledge cutoffs or incomplete recent information.

When the question is time-sensitive, specify that current research is required:

For a product:

For regulation:

Prompt wording cannot create live internet access if the selected AI system does not have it. The model must actually have browsing, search or another retrieval capability.

Prompting ChatGPT, Claude and Gemini: Is There a Difference?

The same core principles work across the major AI assistants:

clear goal + relevant context + constraints + useful output requirements + iteration

But there are model-specific differences.

OpenAI’s current guidance emphasizes direct, goal-driven prompts and increasingly recommends defining success criteria rather than carrying forward excessively complicated legacy prompting techniques.

Anthropic’s current Claude guidance places particular emphasis on clear instructions, relevant examples, XML-style structure for complicated prompts and careful handling of long-context documents.

Google’s Gemini documentation recommends clear instructions, constraints, consistent structured prompts and few-shot examples where they improve consistency. For its current Gemini 3 generation, Google specifically recommends direct, well-structured prompting and clear output requirements.

The practical lesson is:

Do not become dependent on one viral “perfect prompt.”

Test your prompt with the specific model you use.

For the official guidance, see:

OpenAI prompting guidance

Anthropic Claude prompting best practices

Google Gemini prompt design strategies

Common AI Prompting Mistakes

Common AI prompting mistakes including vague goals and missing context

Many poor prompts fail for predictable reasons.

The most common problems are vagueness, missing context, conflicting instructions, unnecessary complexity, asking for unsupported current information, failing to define the audience, leaving the output format unspecified and treating the first response as final.

Consider this overloaded prompt:

Several requirements conflict.

A better prompt prioritizes:

A shorter prompt with coherent requirements is usually stronger than a very long contradictory one.

Do “Magic Prompt Words” Work?

You may encounter social-media prompts containing expressions such as:

These are not a reliable substitute for clearly specifying the task.

OpenAI’s model guidance says it is generally unnecessary to rely on all-caps instructions, incentives or similar tricks as the default approach.

A useful prompt explains what success looks like.

It does not need theatrical persuasion.

Prompt Length: Is a Longer Prompt Better?

Not necessarily.

A prompt should contain the information required to complete the task.

Nothing more is automatically better.

For a simple task:

is excellent.

You do not need a 500-word persona.

For a complex market analysis, however, several hundred words of context may be appropriate.

The useful question is:

Would removing this instruction make the task materially more ambiguous?

If not, it may not need to be there.

A Reusable Master AI Prompt Template

Reusable master AI prompt template with goal, context and constraints

For complicated everyday work, this template is a good starting point:

Do not blindly fill every section.

Remove anything your task does not need.

Example: Bad Prompt vs Good Prompt for Research

Weak prompt:

Improved prompt:

The better prompt controls evidence quality and prevents simplistic conclusions.

Example: Bad Prompt vs Good Prompt for Coding

Weak prompt:

Improved prompt:

This gives the AI a measurable success condition.

Example: Bad Prompt vs Good Prompt for Marketing

Weak prompt:

Improved prompt:

The prompt actively prevents deceptive claims.

Example: Bad Prompt vs Good Prompt for AI Images

Weak prompt:

Improved prompt:

The second prompt defines the image rather than leaving the model to decide every visual element.

How to Evaluate Whether a Prompt Is Good

Checklist for evaluating AI prompt results for accuracy and relevance

A prompt is not good because it is long.

It is good if it reliably produces the result you need.

For repeated workflows, test your prompt against multiple realistic cases.

Suppose you are building a customer-support classification prompt.

Do not test only obvious examples.

Test difficult cases:

a message that contains two problems, sarcastic language, incomplete information, misspellings, an unsupported request, a complaint that changes topic halfway through, and an edge case that fits no category.

For professional AI applications, formal evaluations are more reliable than adjusting prompts based on one or two successful examples. Anthropic’s prompting documentation explicitly connects prompt development with defining success criteria and evaluation, while Google describes prompt engineering as an iterative process that should be refined based on observed results.

AI Prompt Security: Be Careful With Sensitive Information

A well-written prompt can still create a privacy problem.

Avoid unnecessarily pasting:

passwords, OTPs, private API keys, banking credentials, confidential customer data, private medical information, undisclosed business secrets or other information you are not authorized to provide to the AI service.

The exact privacy handling depends on the platform, account type and settings.

For more detailed practical guidance, see our How to Use AI Chat Safely article.

Prompt Injection Is Different From Normal Prompt Writing

If you build AI applications, there is another issue to understand: prompt injection.

Prompt injection occurs when malicious or untrusted input attempts to change the intended behavior of an AI system.

This becomes especially important when an AI can:

access files, browse webpages, call APIs, send messages, update records or perform other actions.

OWASP’s current GenAI security work identifies prompt injection among the major security risks for LLM applications and notes that retrieval systems or fine-tuning alone do not completely eliminate the problem.

OWASP GenAI LLM Top 10

This means developers should not treat a clever system prompt as a complete security boundary.

Permissions, validation, data isolation, tool controls and safe application architecture also matter.

How to Prompt AI Agents

Prompting becomes more important when the AI can take actions instead of merely answering questions.

For an ordinary chatbot, a vague prompt may produce a bad answer.

For an agent, a vague prompt could produce a bad action.

Consider:

That is risky.

A safer agent instruction is:

The prompt defines:

the allowed action, prohibited actions, evidence requirement and approval boundary.

For agents with access to external systems, explicit authorization rules matter much more than decorative prompt wording.

How to Use Follow-Up Prompts Effectively

You do not have to restart every time the first response is imperfect.

Useful follow-ups include:

Iterative prompting is not a failure.

It is one of the core ways these systems are designed to be used.

Using Unlimited AI to Practice Better Prompts

Practicing better AI prompts by comparing and refining responses

You can practice these techniques directly using Unlimited AI Chat.

One useful exercise is to give the same prompt to different AI assistants and compare the results.

For example:

Then compare how the assistants handle:

accuracy, structure, completeness, uncertainty and readability.

Different models can respond differently even when given the same prompt, which is why there is no single prompt guaranteed to produce identical quality across every AI system.

If you are deciding which general AI assistant to use, see our Best AI Chatbot comparison.

Frequently Asked Questions About How to Write AI Prompts

What is the best way to write an AI prompt?

Start by clearly stating what you want the AI to accomplish. Add only the context it needs, define important constraints and specify the desired output. If factual information matters, define the evidence standard. Review the first response and refine your request when necessary. This aligns closely with current guidance from OpenAI, Anthropic and Google.

How do beginners write good AI prompts?

Write the prompt as if you were giving instructions to a capable person who does not already know your situation. Explain the task, necessary background and desired result.

For example:

Do AI prompts need to be long?

No.

A simple task deserves a simple prompt.

Longer prompts are useful when the task has significant context, constraints, evidence or output requirements.

Do I need to use special prompt formulas?

No.

Prompt frameworks can help beginners remember important information, but there is no universal magic formula required for good results.

Clarity is more important than memorizing an acronym.

Is prompt engineering still useful with advanced AI?

Yes, but it is changing.

Newer models generally understand natural language and complex instructions better, which reduces the need for many older prompt tricks. The most useful modern prompting focuses increasingly on goals, context, success criteria, evidence and output requirements.

Should I tell AI to act like an expert?

It can help define the perspective, especially when you specify the actual expertise and task. However, saying “act as the world’s greatest expert” does not guarantee factual accuracy.

Should I ask AI to think step by step?

Not necessarily. Modern reasoning models often handle their reasoning internally. It is usually more useful to ask the model to check its answer, show necessary calculations, state assumptions and provide a concise explanation you can verify.

How can I stop AI from hallucinating?

You cannot guarantee that hallucinations will never occur simply by writing a prompt.

You can reduce risk by providing authoritative context, requiring source verification, allowing the model to say information is unavailable, using retrieval/search tools where appropriate and checking important claims yourself.

Can AI prompts include documents?

Yes, when the AI system supports file uploads. Clearly tell the system what information to extract or analyze and whether it should use only the document or can use external knowledge too.

Can I use the same prompt for ChatGPT, Claude and Gemini?

Usually you can start with the same core prompt, but results can differ. Each provider publishes model-specific prompting guidance, so important or repeated workflows should be tested and adjusted for the particular model.

What is few-shot prompting?

Few-shot prompting means providing several examples of the desired input-output behavior before asking the model to handle a new input. It is particularly useful for classification, formatting, style and repeated tasks.

How do I write an AI prompt for research?

Define the research question, scope, date range, acceptable evidence, preferred source types, required comparisons and what the model should do when evidence is contradictory or unavailable.

For serious research, also verify important claims against the original sources.

How do I write an AI prompt for images?

Describe the subject, environment, composition, lighting, style, aspect ratio and important visual constraints. Avoid depending entirely on vague words such as “beautiful” or “professional.”

Final Thoughts

Learning how to write AI prompts is less about discovering a secret command and more about becoming better at defining what you actually want.

A strong prompt answers the questions an AI would otherwise have to guess:

What is the goal?

What context matters?

What information should it use?

What constraints must it respect?

What should the result look like?

What happens if information is missing?

What evidence is required?

For simple tasks, that may take one sentence.

For complex research, coding or business work, it may require a structured prompt with source material and clear success criteria.

And the first prompt does not have to be perfect.

The most effective workflow is often:

clear first request → inspect the response → identify the problem → refine the instruction → verify the result

As AI models become more capable, the best prompt writers will not necessarily be the people who memorize the most complicated prompt templates.

They will be the people who can define a problem clearly, provide relevant evidence, recognize weak output and ask better follow-up questions.


Research and Editorial Transparency

This guide was developed using current official prompting documentation from OpenAI, Anthropic and Google, with AI security guidance from OWASP and search-quality guidance from Google Search Central.

OpenAI currently recommends clear, specific, goal-driven instructions and iterative refinement.

Anthropic recommends clear instructions, appropriate context, examples where useful and structured prompting for complicated inputs.

Google’s Gemini documentation recommends clear instructions, constraints, examples, context, structured prompts and iterative experimentation.

Google Search says AI-assisted content itself is not automatically a problem; using automation primarily to produce large volumes of low-value content for ranking manipulation can violate its spam policies. Google continues to emphasize helpful, reliable, original, people-first content.

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top