---
title: How to write AI prompts (with examples)
metaTitle: How to write AI prompts (with examples)
description: Learn how to write AI prompts that get a useful answer first time: a simple Role, Task, Context, Format structure, before-and-after examples and a template.
slug: how-to-write-ai-prompts
authors: [ilai-szpiezak]
published: 2026-11-26
updated: 2026-11-28
primaryQuery: how to write ai prompts
queries: [how to write a prompt, how to write prompts for chatgpt, how to write a good prompt, how to write effective prompts, how to write better ai prompts]
cluster: how to write prompts
section: improve-prompts
heroSrc: /guides/images/how-to-write-ai-prompts/hero.jpg
ogSrc: /guides/images/how-to-write-ai-prompts/og.jpg
ogImageWidth: 1024
ogImageHeight: 537
heroAlt: Short prompt in the ChatGPT composer beside a Pretty Prompt editor showing the same request expanded with role, task, context, format and constraints
ogImageAlt: How to write AI prompts (with examples) — Pretty Prompt Guides; short LinkedIn post idea beside a structured improved prompt
heroCaption: There's no one way to write a good prompt. But as a rule of thumb, you want to give enough context to help the LLM, predict the right output for your query. That's why a good prompt names a role, task, context and format in simple language. The more specific you are, the more specific the answer will be.
cta: install
faqJson: |
  [
    {"q": "What makes a good AI prompt?","a": "Context first: give the model the facts, files and audience it can't guess. Then structure the ask as role, task, context and format, plus optional constraints. Add one example when tone or a pattern matters. Good context beats any prompt trick."},
    {"q": "How long should an AI prompt be?","a": "Long enough to cover role, task, context and format clearly—often one short screen. Use numbers for length (words, bullets, minutes) instead of vague words like 'concise'. If you keep adding paragraphs, split the job or start a new chat."},
    {"q": "Do I need to learn prompt engineering to write good prompts?","a": "You don't need a course or a named framework for everyday work. Learn the four-part structure, attach the right context, write one prompt, test it once and adjust. Prompt engineering matters more when you're building products or running the same prompt at scale."},
    {"q": "Does the same prompt work in ChatGPT, Claude and Gemini?","a": "The same skeleton usually works. ChatGPT can use Custom Instructions for standing preferences. Claude tends to like clear sections or XML-style tags. Gemini often needs explicit format and attachments when context lives in Docs or Drive. Retest once when you switch tools, or compare the same prompt side by side in a playground."},
    {"q": "Why does AI still give a wrong answer when my prompt is good?","a": "The model may be missing facts, inventing details, or the chat may have filled the context window and started to forget earlier turns. Models are also stochastic, so the same query can come back differently. Paste the source files, ask for citations or say 'if unsure, say so', then check anything that goes to a real person. If the thread wandered, start fresh with one consolidated prompt."},
    {"q": "How do I write AI prompts for images?","a": "Name the subject, style, lighting, composition and aspect ratio (square, landscape, portrait, or exact dimensions) in plain language. One short before/after pair beats a paragraph of adjectives. Test in your image tool once, then save the version that worked."}
  ]
related: [how-to-fix-a-prompt-that-isnt-working]
---

How do you write an AI prompt that gets it right first time? What do you actually put in it? And does it change between ChatGPT and Claude or other LLMs? These are all valid questions.

A good AI prompt tells the model four things: who it should act like (role), what you want (task), what it needs to know (context) and what the answer should look like (format). You can also add an example when the style matters or when there's a pattern you want it to follow. 

Make sure you test it and adjust as AI models as stochastic, which means the same query will get different answers each time. 

How do you write a prompt from scratch in simple words? Answer below 👇

(See also: The [Prompt Enhancer](/prompt-enhancer) for the browser or if you're a vibe coder [this prompting guide for Lovable prompts](https://prettypromptai.substack.com/p/prompting-hacks-for-vibe-coding-in-lovable))

## Before you start

- Know the job you want the AI to do: one deliverable per prompt, use verb first.
- Have your context files or documents ready: text, files, URLs, screenshots, or notes from Notion or a simple doc. You need this when you create prompts for AI that use real facts, not guesses. This is THE most important part of everything in this article. Good context work better than any "prompt trick" out there.
- Pick **one** model to test first (within ChatGPT, Claude, or Gemini). You can compare tools or models in Step 5.
- Open the AI where you normally work. If you use Pretty Prompt, you should see the extension next to the text box — [the Chrome extension](https://chromewebstore.google.com/detail/prettyprompt/opjebobgkipcdimgofkboimilnchghpd) is free to install and you can try it with no account.

## What makes a good AI prompt?

To be honest, there's a lot of articles out there on what makes a good AI prompt. In my experience, CONTEXT is the secret sauce. If you provide the right context, you're helping the AI to have the right information to give you the right answer. 

However, from a structure perspective, a solid **prompt structure** has four parts, plus an optional fifth:

1. **Role** — who the model should be.
2. **Task** — one specific deliverable, verb first.
3. **Context** — facts, links, pasted text or attachments.
4. **Format** — length, layout (bullets, table, JSON, etc.).
5. **Constraints** (optional) — what to do and what to skip.

The less the model has to guess, the better it predicts the next token for your use case. When you write a prompt for the first time, you're really shrinking that guesswork. 

It's like giving enough information to a new coworker who knows nothing about your company. If you give them the right documents, they are more likely to do a better job on the first day.

## Step 1: Start with the task

Name one outcome. Start with a verb: summarise, draft, list, compare, rewrite.

**Before (vague):**

```text
help with my email
```

**After (clear):**

```text
Task: Draft a short follow-up email to a client who missed our call. Ask for two new time options this week.
```

Everything else in the prompt supports that line.

## Step 2: Give it a role and the context it can't guess

Add who the model should be, who the audience is, and what success looks like.

- **Role:** job title or expert hat.
- **Audience:** who will read the output.
- **Make it sound like you:** paste 2–3 of your own messages so the model can copy your tone.
- **Context it can't infer:** files, URLs, screenshots, or "use only the attachment".

You want to keep the AI as narrow as possible in the "universe" we're working on. If the model would need to search or assume, put the fact in Context instead.

## Step 3: Say what the answer should look like

Spell out **format**, **length as a number**, and **structure**.

**Before (vague):**

```text
Format: make it professional and not too long
```

**After (clear):**

```text
Format: 120–150 words; two short paragraphs; British spelling; no em dashes.
```

For **constraints**, say what to do, not only what to avoid. "Use plain words" beats "don't be wordy", because the model mirrors positive instructions more reliably.[^promptingguide]

## Step 4: Use a template

Copy this skeleton and fill in the blanks:

```text
Role: You are a [job title / expert] helping a [audience].
Task: [One deliverable, verb first.]
Context: [Facts, links, paste text, attachments, or URLs.]
Format: [Length + structure — bullets, table, JSON, etc.]
Constraints: [What to include or avoid. Optional.]
```

When a prompt version works, save it to your [Prompt Library](/save-prompts) so you don't have to rewrite it from scratch next week. Having a central prompt library really helps, especially when you can pull these prompts across any LLM and model (like with Pretty Prompt!) 

Best thing I've ever done is own my own prompts and skills without having to depend on a single LLM. This means if tomorrow there's a new model that is better for my work, I can bring in all my core tasks (prompts, skills, files) into the new model in a single click. One of the things I love about the tool we've built!

## Step 5: Test it, then build on it

Run the prompt once in your chosen tool. If the shape is right but the tone is off, edit and resend before you start a new thread.

Three habits help you write better AI prompts over time:

1. **Test side by side** when the stakes are high — same prompt, two models, compare the first reply.

(Quick note on this: If you want to test the same prompt side by side across different models, you can try one of the many AI Playgrounds out there. Pretty Prompt has [a free Prompt Playground](/prompt-playground) on the web app, where you can add your own LLM Key, and test privately any prompt across any number of models. 

I find it super powerful for first-time tasks or for image generation.)

2. **Pyramid rule for follow-ups:** every new message needs to add more relevant information. If you use vague phrases like "try again" you waste space in the LLM context window. Once the context window gets full, the AI will compress the chat, or start to "forget" things.
3. **Ask the AI to interview you first:** "Ask me up to five questions before you draft anything." That works well when you're not sure what belongs in Context. It's the equivalent of using the Pretty Prompt Refine feature.

If it still isn't working after a fair test, see [how to fix a prompt that isn't working](/guides/how-to-fix-a-prompt-that-isnt-working) — diagnose what's missing before you pile on more words.

### ChatGPT

When you write prompts for ChatGPT, put standing preferences in **Custom Instructions** (role, tone, format defaults) so you don't repeat them every chat.[^chatgpt-custom] In the message itself, keep Role, Task, Context and Format visible. OpenAI's prompt engineering guide also recommends clear section breaks and examples when you need a strict shape.[^openai]

### Claude

When you write prompts for Claude, use clear section headers or XML-style tags (`<context>`, `<task>`) so each part stays distinct.[^claude] Attach files when Context isn't in the text box, and say "use only the attachment" if web search would get in the way.

### Gemini

State **format** explicitly — short lists and tables work well. Attach images or Docs when facts live outside the text box; Gemini reads structured context best when you point to the file directly.[^gemini] If you switch between reasoning and fast modes, rerun the prompt once before you trust the output.

## Before and after: three real examples

Each pair shows how to write better prompts for an everyday job — not theory.

### (a) LinkedIn article

**Before (vague):**

```text
write me a linkedin article about growing a marketing agency
```

**After (clear):**

```text
Role: You are a B2B content writer who knows LinkedIn’s article format and agency positioning.
Task: Draft a LinkedIn article on how a new marketing agency wins its first ten retainers without discounting.
Context: Audience = agency founders and solo marketers; I run a small performance agency; tone expert but approachable; no client names; UK spelling.
Format: 800–1,000 words; H2 subheads every 150–200 words; short paragraphs; end with one question to drive comments.
Constraints: No buzzword salad; one concrete example per section; no fake stats—mark assumptions as assumptions.
```

### (b) Summarising a report

**Before (vague):**

```text
summarise this report
```

**After (clear):**

```text
Role: You are an analyst briefing a busy founder.
Task: Summarise the PDF in five bullet points.
Context: [paste PDF text or attach file]
Format: Each bullet = one finding + why it matters; max 15 words per bullet.
Constraints: No jargon; flag any number you're unsure about.
```

### (c) Vibe-coding feature request

**Before (vague):**

```text
build me a crm for my marketing agency
```

**After (clear):**

```text
Role: You are a senior full-stack engineer planning a greenfield SaaS MVP with me.
Task: Outline how to build a CRM from scratch for a new marketing agency (contacts, deals, campaigns, tasks).
Context: 3-person agency; must track leads → proposals → signed retainers; integrate email later; prefer Next.js + Postgres; ship in phases, not a year-long build.
Format: Phase 1–3 roadmap (bullets); each phase lists core entities, 5 must-have screens, and what we explicitly defer.
Constraints: No custom auth in v1 if a managed option exists; explain trade-offs; flag where AI “vibe coding” needs human review (data model, permissions).
```

More copyable pairs live in our [prompt examples](/prompt-examples).

## How to write AI prompts for images

Image models listen to concrete nouns, not mood boards in prose. When you write AI prompts for images, cover:

- **Subject** — who or what is in the frame.
- **Style** — photo, illustration, 3D render, etc.
- **Lighting** — soft morning, studio, neon, etc.
- **Composition** — close-up, wide shot, rule of thirds.
- **Aspect ratio** — Square, Landscape, Portrait, or specific dimensions.

**Before (vague):**

```text
cool startup office vibe
```

**After (clear):**

```text
Subject: Small team of three at laptops in a bright co-working space.
Style: Editorial photo, shallow depth of field.
Lighting: Warm late-afternoon sun from the left.
Composition: Wide shot, team slightly off-centre.
Aspect ratio: 16:9.
```

For product UI mockups and campaign assets, see [image generation prompts](/use_case/image-generation).

## Do you need a prompt framework?

Honest answer: most **prompt framework** labels describe the same four parts — role, task, context and format — with extra letters marketing a checklist.

If you like acronyms, pick one that maps cleanly to those four blocks:

- **CO-STAR** (Context, Objective, Style, Tone, Audience, Response) is Singapore’s GovTech recipe for a long brief that needs structure.[^costar]
- **RTF** (Role, Task, Format) is the same skeleton, shorter, when you're in a hurry.

You don't need to memorise a framework to write a good prompt. You need one clear task and a format the model can copy.

## Rules of thumb

These tips help you write effective prompts without turning every chat into an essay:

- **One job per prompt.** "And also design a logo" splits the model's attention. Context windows are finite — the more rubbish you put in a chat, the harder it gets for the LLM to focus.
- **Numbers beat adjectives.** "150 words" beats "quite short".
- **Show, don't describe.** Paste one example of the shape or tone you want.
- **New topic, new chat.** Fresh thread, one consolidated prompt beats ten vague follow-ups.
- **Check the facts.** Ask for sources or paste the source material when accuracy matters.

:::try-app
:::

## Doing it in one click

Pretty Prompt won't decide what you want. It makes what you want explicit — role, task, context and format filled in from the rough idea you already typed.

1. Paste or type your prompt in a supported chat (Chrome extension: free to install and try, no account; web app: free account to start).
2. Click **Improve** on the Pretty Prompt button.
3. Choose **Improved** (closer to your words) or **Refine** if you want follow-up questions that sharpen task and constraints — handy for image prompts and vague briefs.
4. Save the version that worked to your Prompt Library.

You still choose the job and the audience. The [AI prompt enhancer](/prompt-enhancer) just skips rebuilding the skeleton by hand each time.

:::cta
:::

[^promptingguide]: Prompting Guide, “General Tips for Designing Prompts” (“To do or not to do?”), https://www.promptingguide.ai/introduction/tips (checked 28 November 2026).

[^openai]: OpenAI, “Prompt engineering” (Markdown headers, XML, and examples), https://platform.openai.com/docs/guides/prompt-engineering (checked 28 November 2026).

[^chatgpt-custom]: OpenAI Help Center, “ChatGPT Custom Instructions,” https://help.openai.com/en/articles/8096356-custom-instructions-for-chatgpt (checked 28 November 2026).

[^claude]: Anthropic, “Use XML tags to structure your prompts,” https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags (checked 28 November 2026).

[^gemini]: Google, “Prompt design strategies” (response format and multimodal context), https://ai.google.dev/gemini-api/docs/prompting-strategies (checked 28 November 2026).

[^costar]: Government Technology Agency of Singapore (GovTech), “Mastering the art of prompt engineering with Empower,” https://www.tech.gov.sg/technews/mastering-the-art-of-prompt-engineering-with-empower/ (checked 28 November 2026). CO-STAR is defined in GovTech’s Prompt Engineering Playbook.