How to Write AI Prompts That Work: A Practical 2026 Guide
A good AI prompt describes the job clearly enough that another person could follow it without guessing. State the task, context, constraints, audience, and output format, then test the result on representative cases.
Build a prompt from six parts
Start with the outcome. “Summarize this report for a finance director” gives the model a measurable job; a flattering character description does not. A practical prompt can include:
- Purpose: Define the assistant’s role and audience.
- Task: State the action in a direct sentence.
- Context: Add facts, documents, data, or code the model should use.
- Constraints: Set length, tone, exclusions, safety rules, or deadlines.
- Output: Name headings, fields, table columns, or a JSON schema.
- Checks: Explain how to handle missing information and review the result.
The order can change. Current OpenAI advice separates identity, instructions, examples, and context with Markdown or XML. Google recommends placing important behavior and format rules in the system instruction or at the start of the user prompt. For long context, Google recommends placing the data first and the question at the end. Anthropic recommends placing long documents near the top, above the query, instructions, and examples.
Application prompts should pass changing values through typed arguments or schemas. Keep prompt builders near the feature they serve, and store fixtures for repeatable tests.
Instruction layers and reusable context
Put durable behavior in the highest-priority layer your tool supports. In OpenAI’s Responses API, the instructions parameter has priority over that request’s task text; developer messages also take priority over user messages. Anthropic supports a system field. ChatGPT offers Custom Instructions in its interface.
Use the durable layer for writing style, tool permissions, output rules, or data handling. Keep the current assignment in the user message. A permanent rule can conflict with a later task, so avoid placing every preference in one global block.
ChatGPT Custom Instructions apply to future chats across web, desktop, iOS, and Android. OpenAI lists limits of 1,500 characters for Free and Go users and 5,000 for Plus, Pro, Enterprise, Business, and Education users. Treat this feature as a preference layer, not a substitute for task context.
Projects suit recurring work with shared chats, files, and instructions. Project instructions apply inside that project and override global Custom Instructions. Claude Projects include chat histories, knowledge bases, and project instructions. Free Claude accounts can create up to five projects. Paid Claude plans add retrieval augmented project knowledge as content approaches context limits.
| Product | Price | Best for | Limits |
|---|---|---|---|
| ChatGPT Projects | $0 | Recurring personal work | Five files per Free project |
| Claude Projects | $0 | Focused document work | Up to five projects |
| Claude Pro | $20 monthly | Larger project knowledge | Paid plan limits vary |
| Gemini Skills | Included across Google AI tiers | Reusable workflows | Skills replace Gems |
Google announced Skills on September 30, 2026 as the replacement for Gems. Skills can be called with a slash command, combined, and paired with reference files. Existing Gems data is scheduled to migrate automatically, with removal dates differing by account type.
Examples, delimiters, and JSON
Examples show what “good” means for tone, classification, scope, and formatting. Google recommends specific, varied examples and warns that too many can cause pattern overfitting. Anthropic recommends three to five examples for current Claude models. Keep tags, spacing, and output structure consistent.
<example>
<request>Refund request after the stated period.</request>
<output>Escalate as a policy exception.</output>
</example>
XML tags can separate instructions, documents, examples, and variable data. Markdown headings and lists can create the same hierarchy with less markup. Choose one style per prompt and mark reference content as data to analyze, not instructions to follow.
For structured results, define fields, types, permitted values, and the response for unknown values. Prompt-only JSON asks a model to imitate a format and may produce extra text or invalid syntax. A schema based feature, such as OpenAI Structured Outputs or Gemini structured output, lets the service enforce a declared shape more reliably. Validate the returned object in application code in either case.
Reasoning and model differences
Generic “think step by step” wording should be tested rather than added by habit. A Wharton Generative AI Labs report tested 198 GPQA Diamond questions with 25 trials per condition. It found small average gains for o3-mini and o4-mini, a decrease for Gemini Flash 2.5, and 20% to 80% longer response times for reasoning models. Non-reasoning results varied: Gemini Flash 2.0 improved 13.5% on average and Sonnet 3.5 improved 11.7%, while GPT-4o-mini’s 4.4% increase was not statistically significant.
Ask reasoning models for goals, constraints, tool permissions, stop conditions, and validation. Request a short rationale or checklist when readers need an explanation. Google says Gemini 2.5 and 3 series models produce internal thinking text, so asking for hidden reasoning in the final answer is generally unnecessary.
The OpenAI GPT-5 prompting guide is archived guidance for that model family. It discusses reasoning_effort, tool exploration, and instruction conflicts. Current general OpenAI documentation recommends different prompting approaches for reasoning and GPT models, pinning production snapshots, and maintaining evaluation suites. Apply model-specific advice only after testing the exact model and task.
Five reusable templates
Replace bracketed fields and add examples when format matters.
Writing
<role>You edit for [audience].</role>
<task>Rewrite the draft as a [format] about [topic].</task>
<context>[draft, verified facts, house style]</context>
<constraints>Use [tone]. Keep [length]. Mark unsupported claims [NEEDS SOURCE].</constraints>
<output>Return a headline, introduction, and [number] sections.</output>
Coding
<role>You are a [language] engineer in an existing repository.</role>
<task>Implement [feature] without unrelated changes.</task>
<context>[files, versions, error, acceptance criteria]</context>
<constraints>Follow local conventions. Explain any new dependency. Ask before destructive changes.</constraints>
<output>Return a plan, changed files, tests, and unresolved risks.</output>
Research
<task>Compare [subjects] for [decision].</task>
<context>[documents, date range, definitions]</context>
<constraints>Separate facts from interpretation. Include dates and numbers. Mark unavailable points.</constraints>
<output>Use a comparison table, then recommend against [criteria].</output>
Marketing
<role>You write for [audience] in [brand voice].</role>
<task>Create [asset] for [offer].</task>
<context>[approved claims, customer problem, channel, call to action]</context>
<constraints>Use approved claims only. Avoid guarantees. Stay within [length].</constraints>
<output>Return [number] labeled variants.</output>
Business
<task>Turn meeting notes into an action plan.</task>
<context>[notes, owners, dates, dependencies]</context>
<constraints>Do not invent owners or deadlines. Mark gaps UNASSIGNED. Separate decisions, questions, and risks.</constraints>
<output>Return JSON with decisions, actions, risks, and questions.</output>
Prompt evaluation
Define success before changing the prompt. An evaluation set should mirror the real task distribution and include normal cases, ambiguity, missing fields, long requests, edge cases, and known failures.
A practical cycle is:
- Define correctness, format, tone, safety, latency, and cost targets.
- Save a baseline with model version, settings, date, and outputs.
- Change one major variable, such as an example, delimiter, instruction, or schema.
- Score both versions with exact match, code tests, similarity, or a rubric.
- Group failures by missing context, conflicting rules, format drift, unsupported assumptions, or tool misuse.
- Keep failed cases in a regression set and retain a rollback path.
Anthropic lists exact match for categorical labels, cosine similarity for consistency, ROUGE-L for summaries, and five-point model grading for tone. A separate model can grade subjective qualities, while human review remains appropriate for high-impact decisions. OpenAI recommends pinning production model snapshots and maintaining tests when prompts or models change.
A Wharton report on GPT-4o and GPT-4o-mini found that politeness and forceful wording could shift individual questions by up to 60 percentage points, while effects balanced across the full dataset. The authors also found that 100 repeated trials exposed inconsistency hidden by one attempt. Treat a single successful response as a draft signal, not an acceptance test.
Recommendations by reader type
Casual ChatGPT user: Put stable preferences in Custom Instructions. Write each request with task, audience, context, constraints, and format. Use a Project for recurring work with files.
Writer or marketer: Maintain separate editing, brand, approval, and claims templates. Add two or three representative examples and inspect factual claims before publication.
Developer: Keep repository rules in developer instructions, current work in user request, and schemas in application code. Store fixtures and evaluation checks beside the prompt builder.
Researcher: Put documents in marked context blocks, define the date range, require uncertainty labels, and test direct answers against reasoning wording on a fixed sample.
Team: Use a shared Project for files and instructions, assign one owner for changes, and preserve a regression set before editing shared rules.
Gemini user: Convert repeated Gems workflows to narrow Skills, invoke them with slash commands, and evaluate each Skill before combining it with another.
Frequently asked questions
What is the best structure for an AI prompt?
Start with the task, then add audience, relevant context, constraints, and output format. Put durable rules in a system or developer instruction when supported. Add representative examples for tone or formatting. Finish with checks for missing information, unsupported claims, and required fields.
Should every AI prompt say think step by step?
No. The Wharton report found small gains and higher time costs for reasoning models, with mixed results for other models. Ask for goals, constraints, validation, or a short rationale instead. Compare direct wording with reasoning wording on the exact model, task, accuracy target, and latency budget.
How many few shot examples should a prompt include?
Use enough examples to show the pattern and important edge cases. Anthropic recommends three to five examples for current Claude models. Google says the right number varies and warns that too many examples can cause overfitting. Keep tags, spacing, and output structure consistent.
Should I use a JSON schema or prompt only JSON?
Use a schema feature when the service supports it and the application depends on valid fields and types. Prompt-only JSON can add commentary or omit fields. Define required properties, allowed values, and unknown-value behavior, then validate every response in application code.
How do I test whether a prompt works?
Create a fixed evaluation set covering normal cases, ambiguity, missing fields, long requests, and known failures. Record the model and settings, run a baseline, change one prompt element, and score both versions. Keep failed cases in the regression set. Save the results.
What happened to Gemini Gems?
Google announced Skills on September 30, 2026 as the replacement for Gems. Skills save reusable instructions, can be called with a slash command, can combine with other Skills, and can include reference files. Google said existing data will migrate automatically, with removal dates varying by account type.
Sources
- OpenAI prompt engineering guide
- Archived OpenAI GPT-5 prompting guide
- Google Gemini prompting strategies
- Anthropic Claude prompting practices
- Wharton chain of thought report
- Wharton prompt engineering report
- OpenAI Custom Instructions
- OpenAI Projects
- Claude Projects
- Claude pricing
- Google Gemini Skills announcement
- Anthropic evaluation development