Prompt Engineering Guide: 12 Techniques That Actually Work
Chain-of-thought, few-shot, role prompting and more — with copy-paste templates.
Why prompting still matters
The gap between a mediocre AI response and a genuinely useful one is rarely the model — it's almost always the prompt. Two people using the same version of ChatGPT or Claude can get wildly different quality of output depending on how much context, structure, and constraint they put into the request. Prompt engineering isn't about finding secret magic words; it's a small set of repeatable techniques that reduce ambiguity and give the model a clearer target to aim at.
Below are twelve techniques that show up consistently in documentation from major AI labs and in practical use, organized from simplest to most advanced, with a copy-paste template for each.
1. Be specific about the task, audience, and format
Vague prompts get vague answers. Instead of "write about email marketing," specify who it's for, what it should cover, and how long it should be.
Template: "Write a [length] [content type] about [topic] for [audience]. Focus on [specific angle]. Format as [structure]."
2. Role prompting
Assigning the model a role focuses its tone and knowledge base, even though it doesn't literally "become" an expert — it shifts the style and framing of the output toward what that role would typically produce.
Template: "You are a [role] with expertise in [domain]. [Task]. Write for an audience of [audience]."
3. Few-shot examples
Showing the model one or two examples of the output format you want is often more effective than describing the format in words.
Template: "Here are two examples of the style I want: [example 1] [example 2]. Now write a new one about [topic] in the same style."
4. Chain-of-thought prompting
Asking the model to reason step by step before giving a final answer improves accuracy on tasks involving logic, math, or multi-step analysis, because it forces the model to externalize intermediate steps rather than jumping straight to a guess.
Template: "Think through this step by step before giving your final answer. [Problem]. Show your reasoning, then state the final answer clearly at the end."
5. Constraints and negative instructions
Telling the model what to avoid is as useful as telling it what to do — word limits, banned phrases, tone restrictions, or things to exclude all sharpen the output.
Template: "[Task]. Do not use [phrase/style]. Keep it under [X] words. Avoid [common failure mode]."
6. Output format specification
Explicitly naming the structure — a table, a numbered list, JSON, markdown headings — removes an entire category of back-and-forth revision.
Template: "Return the result as a markdown table with columns: [column names]."
7. Iterative refinement
Treat the first response as a draft, not a final answer. Follow up with targeted edits rather than restarting the whole prompt: "Make the second paragraph shorter," "Add a counter-argument," "Make the tone more casual."
8. Self-critique / reflection prompting
Ask the model to review and improve its own answer before you accept it. This surfaces errors the model wouldn't flag if you simply accepted the first output.
Template: "Review the answer you just gave for factual errors, missing context, or weak reasoning, then provide an improved version."
9. Decomposition for complex tasks
Break a large task into smaller sequential prompts rather than asking for everything at once — an outline, then a draft of each section, then a review pass, tends to outperform a single mega-prompt for long-form content.
10. Providing context and source material
Pasting in relevant background — a style guide, a previous document, product details — grounds the response and reduces hallucination, since the model can lean on what you gave it rather than inventing details.
Template: "Using the following context: [paste context]. Answer this question: [question]. Only use information from the context provided."
11. Persona + audience combination
Combine a role prompt with an explicit description of the reader to tune both expertise level and tone simultaneously — useful for anything meant for a specific, non-general audience.
Template: "As a [role], explain [topic] to [audience type] who has [level of prior knowledge]. Avoid jargon they wouldn't know."
12. Meta-prompting: asking the model to write your prompt
When you're not sure how to phrase a request, ask the model to draft the prompt itself, then refine it before running it for real. This is essentially what the free AI Prompt Generator automates, and the AI Prompt Improver does the same thing for a prompt you've already written but suspect could be tighter.
A quick reference table
| Technique | Best for | |---|---| | Specificity | Any task, always the first fix | | Role prompting | Tone and domain framing | | Few-shot examples | Matching a precise style or format | | Chain-of-thought | Math, logic, multi-step analysis | | Constraints | Cutting fluff, avoiding clichés | | Output format | Structured data, tables, lists | | Iterative refinement | Long-form writing, design | | Self-critique | Catching errors before you do | | Decomposition | Long documents, complex projects | | Context grounding | Reducing hallucination | | Persona + audience | Explaining to a specific reader | | Meta-prompting | When you don't know where to start |
Common mistakes that undo good prompting
- Overloading a single prompt with five unrelated requests instead of splitting them into steps.
- Assuming the model remembers unstated context from a previous, unrelated conversation.
- Skipping format instructions and then being annoyed the output isn't structured the way you needed.
- Never following up — the first response is a starting point, not a final draft, and most models improve substantially after one or two refinement rounds.
How this applies beyond chatbots
These same principles carry over to image prompting (see our Midjourney vs DALL·E comparison for how differently two image models respond to similar prompt structures), to coding assistants like GitHub Copilot and Cursor, and to writing tools generally — our guide on writing with AI without losing your voice leans heavily on constraint-setting and iterative refinement specifically to keep AI-assisted writing sounding like you.
Frequently asked questions
Do these techniques work the same across ChatGPT, Claude, and Gemini? Broadly yes — all are large language models trained with similar underlying methods, so specificity, examples, and structure help across the board, though each model has quirks in exactly how much it needs spelled out.
Is prompt engineering still relevant as models get smarter? Ambiguity is still ambiguity no matter how capable the model is. Better models need less hand-holding for simple tasks, but clear, well-structured prompts continue to outperform vague ones on anything nontrivial.
What's the single highest-impact change I can make to my prompts? Adding specificity about audience, format, and length. It's the simplest fix and it addresses the majority of disappointing AI outputs.
The bottom line
Prompt engineering is less a technical skill than a communication skill — the same clarity that makes instructions useful to a new employee tends to make them useful to an AI model. Start with specificity and output format, add chain-of-thought for anything requiring reasoning, and treat the first response as a draft you refine rather than a final answer you accept.