12 Prompt Engineering Examples (Before and After, By Category)
Twelve real before-and-after prompt examples across writing, coding, analysis, and business tasks — showing exactly what changes and why the result improves.
The fastest way to understand prompt engineering isn't a list of rules — it's seeing the exact edit that turns a one-line request into a structured prompt, and understanding why that specific change improves the output. Below are twelve before-and-after pairs across six categories, each with the reasoning spelled out so you can apply the same thinking to a request none of these cover exactly.
Every example follows the same underlying pattern — role, context, task, constraints, output format — covered in full in how to write better prompts for AI. These are that pattern applied to twelve real situations.
Writing
Product description
Before: “write a product description for running shoes”
After: You are a senior e-commerce copywriter for premium athletic brands. Write a product description for a trail running shoe priced at $180, targeted at runners with 5+ years of experience who care about durability on uneven terrain. Output format: a 3-word headline, a 60-word overview, and a 4-item bulleted feature list. Constraints: no hype words, no exclamation points, include one specific technical detail (drop height, stack height, or lug depth).
Why it works: Role sets the register, audience narrows the pitch, format prevents a wall of prose, and the exclusion (no hype words) blocks the generic AI-copy default.
Cold outreach email
Before: “write a cold email to a VP of engineering”
After: You are an SDR at a developer-tools startup. Write a cold email to a VP of Engineering at a 200-person Series B company, pitching a code review tool that cuts review time by making comments actionable. Structure: a one-line hook referencing a real pain point, two sentences of proof, one specific ask. Constraints: under 90 words total, no 'I hope this finds you well,' no more than one exclamation point in the whole email.
Why it works: Specifying the ask and cutting stock phrases forces something that reads like a person wrote it, not a template.
Coding
Code review
Before: “review this function for bugs”
After: You are a senior engineer reviewing a pull request. For the function I paste below, produce: (1) a one-sentence summary of what it does, (2) bugs with exact line references, (3) edge cases that could fail, (4) readability notes marked [nit] or [important]. Constraints: don't rewrite the whole function, only suggest line-level changes. Skip anything a linter would already catch.
Why it works: Numbered output sections make the review scannable, and the exclusions (no full rewrite, skip lint-level noise) keep the review focused on what actually needs a human.
Debugging brief for an agent
Before: “fix the bug where the export button doesnt work”
After: You are debugging a production issue. Bug: clicking 'Export CSV' on the reports page does nothing. Repro: log in, open /reports, pick any date range, click Export CSV — no download, no error. Expected: a CSV of the filtered rows downloads. Scope: src/app/reports/ and its API route only. Definition of done: export works for two different date ranges, root cause documented in the summary.
Why it works: Agentic tools execute before you review, so repro steps, scope, and a definition of done replace back-and-forth clarification the agent can't ask for mid-run.
Analysis
Comparing two options
Before: “whats the difference between saml and oidc”
After: You are an identity engineer explaining authentication to a backend developer evaluating both for a B2B SaaS product. Compare SAML 2.0 and OIDC on: protocol complexity, integration time, mobile support, revocation model, and ecosystem maturity. Output format: a table with SAML and OIDC as columns, then a 3-bullet recommendation. Constraints: under 300 words, cite specific spec names where relevant.
Why it works: A table forces side-by-side comparison instead of two separate paragraphs you have to cross-reference yourself, and the word limit prevents an unfocused survey.
Summarizing a document
Before: “summarize this contract”
After: You are a contracts reviewer preparing notes for a non-lawyer founder. Summarize the contract I paste below in three sections: (1) key obligations per party as bullets, (2) dates and deadlines as a table, (3) clauses that need a lawyer's attention, each with one sentence on why. Constraints: quote exact clause numbers, don't paraphrase liability language, under 300 words.
Why it works: Splitting the summary into three purpose-built sections beats one long paragraph, because each section answers a different question the founder actually has.
Business
Meeting notes to action items
Before: “turn these notes into action items”
After: You are a project coordinator. Convert the meeting notes I paste below into action items. Output format: a table with columns Owner, Task, Due Date (infer 'end of week' if not stated), and Status (default 'Not started'). Constraints: only include items with a clear owner named in the notes; flag anything ambiguous in a separate 'needs clarification' list instead of guessing.
Why it works: The instruction to flag ambiguity instead of guessing prevents the model from inventing owners or deadlines that weren't actually in the notes.
Job posting
Before: “write a job posting for a backend engineer”
After: You are a hiring manager writing a posting that filters well. Role: Senior Backend Engineer (Python/FastAPI/Postgres), 10-person B2B SaaS, remote US time zones. Structure: a 2-sentence hook about the real work, 5 responsibility bullets tied to actual projects, requirements split into must-have (max 4) and nice-to-have (max 3), salary stated plainly. Constraints: no 'rockstar/ninja' language, no unmeasurable requirements like 'passion'.
Why it works: Splitting requirements into must-have and nice-to-have, capped in number, stops the posting from scaring off qualified candidates with an unrealistic wishlist.
Creative
Short story opening
Before: “write the opening of a mystery story”
After: You are a mystery novelist in the style of tight, plain-prose crime fiction (think Tana French, not cozy mystery). Write a 200-word opening for a story about a small-town librarian who finds a decades-old missing-persons file mixed into new returns. Constraints: no prologue framing, start in scene, end on a concrete detail that raises a question rather than a cliffhanger line.
Why it works: Naming a comparable style anchors tone precisely, and the ending constraint avoids the generic 'and then everything changed' cliffhanger AI defaults to.
Image generation prompt
Before: “a cozy cabin in the woods”
After: Photorealistic winter scene: a small timber cabin at the edge of a snow-covered pine forest at blue hour, warm light glowing from two windows, thin chimney smoke. Composition: wide shot, cabin in the right third, footprints leading to the door as a leading line. Lighting: soft dusk light, warm interior glow against cold blue snow. Avoid: HDR over-processing, lens flare, oversaturation.
Why it works: Image models fill every unspecified dimension with a generic default — composition, lighting, and explicit exclusions are what separate a specific image from a generic one.
Research
Buying decision
Before: “best project management tool for a small team”
After: You are a software analyst advising an 8-person services business choosing its first PM tool. Compare the leading options on: price per seat, ease of setup without an admin, reporting depth, and integrations with Slack and email. Output: a table of the top 4, then a 2-bullet recommendation. Constraints: only tools with a plan under $20/seat/month, cite each vendor's actual pricing page.
Why it works: The price ceiling and citation requirement stop the answer from drifting into enterprise tools or unverifiable claims about pricing.
Explaining a concept
Before: “explain quantum computing”
After: You are a science writer for a general-audience newsletter. Write a 250-word explainer on quantum computing: what it does differently from classical computing, one analogy that's accurate (not just simple), where the field actually stands today versus the hype, and one development worth watching. Tone: clear, no breathless futurism. Output: four short paragraphs matching those four beats.
Why it works: Naming the four required beats prevents the classic failure mode of AI explainers: a vague overview that never actually distinguishes the topic from its hype cycle.
Try it on your own prompt
Reading examples helps, but applying the pattern to your own request is what actually sticks. Type a rough version of something you'd normally ask an AI, and see the structured version:
Frequently asked questions
What is a good prompt engineering example?
A good example shows a specific before-and-after: a vague, one-line request and the structured version that replaces it, with a visible role, context, task, constraints, and output format. The value is in seeing the exact edit, not a general description of the technique — that's what makes an example useful instead of just theoretical.
Do prompt engineering examples work the same across ChatGPT, Claude, and Gemini?
Yes, the underlying structure transfers. All the examples on this page work in any of the three with no changes needed. What differs slightly is how literally each model follows format instructions — Claude tends to follow them most exactly, which is worth knowing if an example's output doesn't match your expectations on a different model.
Can I use these examples as templates?
Use them as patterns, not fill-in-the-blank templates. Copying the structure (role, context, task, constraints, format) and replacing the specifics with your own situation works far better than reusing the exact wording, because the value is in matching the structure to your actual request, not memorizing phrasing.
What's the difference between these examples and a prompt template library?
A template library gives you a fixed prompt to fill in blanks on, which only works when your task matches the template exactly. These examples show the reasoning behind each edit so you can apply the same thinking to a request no template covers — the pattern generalizes, a fixed template doesn't.
Stop rewriting prompts. Try the one-click enhancer.
Try the PromptAI demoWorks where you do: the AI prompt enhancer everywhere, ChatGPT prompt enhancer in the browser, or the prompt enhancer for Claude Code in your terminal.