Meta-Prompting: How to Use AI to Write Better Prompts
The most useful prompt engineering technique of the last two years is also one of the least discussed: using AI to write your prompts for you. This practice, called meta-prompting, flips the usual workflow on its head. Instead of struggling to phrase the perfect instructions yourself, you describe your goal in plain language, hand it to a capable model, and ask the model to produce a structured, detailed prompt that you can then run. Done well, the AI-generated prompt is sharper, more complete, and more explicit than anything you would have written by hand — and you can iterate on it just like any other prompt.
This guide explains what meta-prompting is, why it works, when to use it, and how to build a reliable meta-prompting workflow. You'll get copy-paste templates, real examples, and a checklist for avoiding the most common mistakes. By the end, you'll have a repeatable process for turning vague goals into production-quality prompts.
What Is Meta-Prompting?
Meta-prompting is the practice of using one prompt to generate, refine, or evaluate another prompt. The "meta" prefix points to the recursion: you're prompting the model about prompting. There are three main flavors:
- Generation meta-prompts: You describe a task and ask the model to write a prompt that performs that task. The output is a prompt, not the final answer.
- Refinement meta-prompts: You provide an existing prompt and ask the model to improve it — make it clearer, add constraints, fix ambiguity, add examples.
- Evaluation meta-prompts: You provide a prompt and a set of test cases, and ask the model to score the prompt's outputs and suggest improvements.
All three are useful, but generation is where most people start and where the biggest gains appear. A model like GPT-4, Claude, or Gemini will routinely produce a prompt with sections you hadn't thought of — edge case handling, output format specification, tone guidance, and example outputs — because it has seen thousands of well-structured prompts during training. You're effectively borrowing the collective best practices encoded in the model's weights.
Why Meta-Prompting Works
There are a few reasons meta-prompting produces better prompts than most humans write from scratch:
- The model has seen more prompts than you have. During pre-training and instruction tuning, modern models are exposed to enormous quantities of structured text, including well-written prompts, API documentation, task specifications, and code. When you ask for a prompt, the model draws on this distribution and tends to produce something that follows established conventions.
- It forces you to articulate the goal. Writing the meta-prompt requires you to state what you actually want, which is often the hardest part. Once the goal is clear, the model can fill in details you would have skipped.
- It separates goal from implementation. You focus on the outcome (what the prompt should achieve); the model focuses on the mechanism (how to phrase the prompt, what constraints to add, what format to specify). This separation mirrors how experienced prompt engineers work.
- It's iterable. If the generated prompt isn't quite right, you can ask the model to revise specific parts, add examples, or tighten constraints — without starting over.
When to Use Meta-Prompting
Meta-prompting isn't the right tool for every situation. Use it when:
- You have a complex task — multiple steps, several constraints, a specific output format. Hand-writing these prompts is error-prone.
- You're starting from scratch — no existing prompt to iterate on. Generating a first draft saves time and surfaces requirements you'd otherwise miss.
- You want consistency across a team — generating a prompt from a spec produces a more standardized structure than every team member writing their own.
- You're new to a domain — you know the goal but not the conventions (legal phrasing, medical disclaimers, code comments). The model fills in domain-appropriate structure.
Don't use meta-prompting when:
- The task is trivial. "Translate this sentence to French" doesn't need a generated prompt.
- You already have a working, well-tested prompt. Generating a new one is likely to be worse, not better, than your battle-tested version.
- Confidentiality is a concern. If the goal description contains sensitive data, avoid pasting it into a meta-prompt. Describe the task abstractly instead.
A Simple Meta-Prompting Workflow
Here's the workflow I recommend. It has four steps: describe, generate, test, refine. You can run the whole thing in a single chat session.
Step 1: Describe the Goal in Plain Language
Write a short description of what you want the final prompt to accomplish. Don't worry about phrasing it as a "prompt" — just describe the task as if explaining it to a colleague. Include:
- The task itself (summarize, classify, write, extract, etc.)
- The input the prompt will receive (a document, a user question, a chunk of code)
- The output you want (format, length, structure, tone)
- Any constraints (word count, required sections, things to avoid)
Example goal description:
I need a prompt that takes a customer support email and classifies it into one of five categories: billing, technical, account, product feedback, or other. The prompt should also extract the customer's sentiment (positive, neutral, negative) and any specific order or account numbers mentioned. Output should be JSON with fields category, sentiment, and order_numbers (an array, possibly empty). If no order number is mentioned, the array should be empty. Keep it concise — this will run on every inbound email.
That's it. No fancy formatting, no role-playing, no "you are an expert classifier." Just the goal.
Step 2: Generate the Prompt
Feed your description to the model with a meta-prompt that asks it to produce a complete, ready-to-use prompt. Here's a template:
You are a prompt engineering expert. I will describe a task, and you will write a complete, production-ready prompt that performs that task when given to a language model.
Write the prompt so it can be copied and pasted directly into another chat. Include:
- A clear role or instruction for the model
- A description of the input the prompt will receive
- The exact output format expected
- Any constraints, edge cases, or rules the model must follow
- One or two short examples (input → expected output) if examples would help
Do not include commentary. Output only the prompt itself.
Task description:
[paste your goal description here]
The output will be a structured prompt you can test immediately.
Step 3: Test the Generated Prompt
Copy the generated prompt into a fresh chat and feed it a real input (or a representative test input). Check:
- Does it produce output in the right format?
- Does it handle obvious edge cases (empty input, missing fields, ambiguous cases)?
- Is it concise enough to leave room for the actual content, or has it become a bloated wall of instructions?
Step 4: Refine
If the prompt isn't right, go back to the meta-prompting chat and ask for revisions. Be specific about what failed:
The prompt you wrote works, but it sometimes classifies emails as "other" when they're clearly technical. Add a clearer definition of each category with examples of emails that belong to each one. Keep the JSON output format the same.
You can iterate this way three or four times and usually arrive at a prompt that's noticeably better than a hand-written first draft. Once you're happy, save the prompt somewhere — version it if you can — and move on.
A Real Example: Classifying Support Emails
Let's run the workflow end-to-end for the support email classification task I described above. Here's the meta-prompt:
You are a prompt engineering expert. I will describe a task, and you will write a complete, production-ready prompt that performs that task when given to a language model.
Write the prompt so it can be copied and pasted directly into another chat. Include:
- A clear role or instruction for the model
- A description of the input the prompt will receive
- The exact output format expected
- Any constraints, edge cases, or rules the model must follow
- One or two short examples (input → expected output) if examples would help
Do not include commentary. Output only the prompt itself.
Task description:
I need a prompt that takes a customer support email and classifies it into one of five categories: billing, technical, account, product feedback, or other. The prompt should also extract the customer's sentiment (positive, neutral, negative) and any specific order or account numbers mentioned. Output should be JSON with fields category, sentiment, and order_numbers (an array, possibly empty). If no order number is mentioned, the array should be empty. Keep it concise — this will run on every inbound email.
Here's the kind of prompt a capable model produces:
You are a customer support triage system. Given an inbound support email, classify it and extract metadata.
Input: A single customer support email (plain text).
Task:
1. Classify the email into one of these categories:
- billing: questions or disputes about charges, invoices, refunds, or payments
- technical: bugs, errors, performance issues, or how-to questions about product functionality
- account: login issues, password resets, account access, profile changes, account deletion
- product feedback: feature requests, suggestions, praise, or complaints about product behavior that aren't bugs
- other: anything that doesn't fit the above categories
2. Determine the customer's sentiment: positive, neutral, or negative. Use the tone and wording of the email, not just the topic. A billing question can be positive if the customer is polite.
3. Extract any order numbers or account numbers mentioned in the email. Order numbers typically look like #12345, ORD-67890, or similar. Account numbers may be quoted directly. If none are mentioned, return an empty array.
Output format: Return only a JSON object with these fields:
{
"category": "billing | technical | account | product feedback | other",
"sentiment": "positive | neutral | negative",
"order_numbers": ["#12345", "ORD-67890"]
}
Do not include any text before or after the JSON. Do not wrap it in code fences in the final output (though you may use them for readability here).
Examples:
Email: "My order #12345 arrived damaged. I'd like a refund or a replacement. This is really frustrating!"
Output: {"category": "billing", "sentiment": "negative", "order_numbers": ["#12345"]}
Email: "I love the new dark mode! It would be even better if you added a keyboard shortcut to toggle it."
Output: {"category": "product feedback", "sentiment": "positive", "order_numbers": []}
That prompt is better than what most people write by hand. It defines each category with examples, handles the empty-array edge case, specifies the JSON format exactly, and includes two worked examples covering different categories and sentiments. Generating it took one meta-prompt and about thirty seconds.
Refinement Meta-Prompts
Once you have a working prompt, meta-prompting is still useful for improvement. Here are three refinement templates I use regularly.
Make a prompt more explicit
Here is a prompt I'm using:
[paste prompt]
The output is sometimes too vague. Rewrite the prompt to be more specific about what's expected. Add concrete definitions for any ambiguous terms, and add an example that demonstrates the desired level of specificity. Keep the prompt under 400 words. Output only the revised prompt.
Add edge case handling
Here is a prompt I'm using:
[paste prompt]
I've noticed it fails in these cases:
- [case 1]
- [case 2]
- [case 3]
Add explicit handling for each case to the prompt. Don't change the overall structure — just add the rules and examples needed to handle these edge cases. Output the full revised prompt.
Tighten output format
Here is a prompt I'm using:
[paste prompt]
The output format is inconsistent — sometimes the model adds a preamble, sometimes it uses different field names. Rewrite the prompt so the output strictly follows this format:
[specify format]
Add an instruction that the model must return only the formatted output with no additional text. Output the full revised prompt.
Evaluation Meta-Prompts
The third flavor, evaluation, is less common but powerful for prompts you run at scale. You provide a prompt and a batch of test inputs, ask the model to run the prompt on each input, and then have it score the outputs against criteria you specify. Here's a template:
You are a prompt evaluator. I will give you a prompt and a set of test inputs. For each input:
1. Run the prompt mentally on the input (i.e., produce the output the prompt would produce).
2. Score the output on a scale of 1-5 for:
- Correctness: Does it accurately achieve the prompt's stated goal?
- Format adherence: Does it follow the specified output format exactly?
- Edge case handling: Does it handle ambiguity, missing data, or unusual inputs gracefully?
3. Give a one-sentence justification for each score.
4. Suggest one revision to the prompt that would improve the lowest-scoring dimension.
Prompt:
[paste prompt]
Test inputs:
1. [input 1]
2. [input 2]
3. [input 3]
4. [input 4]
5. [input 5]
Return a table with columns: Input | Correctness | Format | Edge Cases | Justification | Suggested Revision.
This works best with strong reasoning models (Claude Sonnet/Opus, GPT-4, Gemini Pro). Weaker models sometimes produce shallow critiques, but even those can surface issues you missed.
Common Mistakes
Meta-prompting has its own failure modes. Watch for these:
- Treating the generated prompt as final. The first output is a draft, not a finished product. Always test it before shipping.
- Not giving enough context in the goal description. Vague goals produce vague prompts. The more concrete you are about input, output, and constraints, the better the result.
- Generating prompts that are too long. Some models, when asked for a "complete" prompt, produce a 1500-word instruction document. That's usually overkill and crowds out the actual input. Ask for concision explicitly, or trim the result.
- Copying the generated prompt without understanding it. Read the prompt carefully before using it. If there's a rule you don't understand, ask the model to explain it, or remove it. You're responsible for what the prompt does.
- Iterating forever. Two or three refinement rounds is usually enough. After that, diminishing returns set in — ship the prompt and refine it later based on real usage.
Tools That Support Meta-Prompting
You can run the workflow above in any chat interface — ChatGPT, Claude, Gemini, or open-source models via API. A few specialized tools go further:
- PromptWright — includes a prompt builder that guides you through describing a task and produces structured, testable prompts you can version and deploy. If you're doing this more than once a month, a dedicated tool saves significant time. Try PromptWright free →
- OpenAI's Playground — useful for testing generated prompts against the same model that will run them in production.
- LangSmith and Langfuse — evaluation and observability platforms that let you run a prompt against many test cases and track scores over time. Pair well with the evaluation meta-prompt template above.
A Note on Model Choice
Meta-prompting quality depends heavily on the model you use to generate the prompt. Use the strongest model you have access to for generation, even if the final prompt will run on a cheaper model. A prompt written by GPT-4 or Claude Opus will usually be more complete and better structured than one written by a smaller model. You can then deploy that prompt on a cheaper model for inference, saving cost without sacrificing prompt quality.
Putting It All Together
Meta-prompting is a force multiplier. It doesn't replace understanding your task or knowing what good output looks like — but it dramatically reduces the friction of turning that understanding into a working prompt. The workflow is simple: describe the goal, generate a prompt, test it, refine it. Use it for complex tasks, for first drafts, and for prompts you need to standardize across a team. Skip it for trivial tasks or when you already have a tested prompt in hand.
If you want to operationalize this without copy-pasting templates by hand, PromptWright has the meta-prompting workflow built in — you describe the task, it generates a structured prompt, and you can version, test, and deploy it in one place. Sign up free at promptwright.net/signup and try it on your next prompt.
Enjoyed This Article?
Get more prompt engineering tips delivered weekly. Free, no spam.
Ready to build better prompts?
Try PromptWright free — structured prompt editor with multi-model testing.
Get Started Free →