How to Structure a Prompt (Template)
The building blocks of a strong prompt — role, context, task, constraints, output format, and examples — with a reusable template.
Direct answer
A strong prompt has six parts: a role, the context the model needs, one clear task, explicit constraints, the exact output format, and an example or two. Give the model a role, supply the context, state a single task, list constraints, define the output format, then show an example. The optimizer assembles these from a rough idea.
Open the Prompt OptimizerWhen to use this
- Your prompts are one line and the output is inconsistent.
- You want a reusable template instead of rewriting from scratch each time.
- You are building a prompt to reuse or share.
Steps
- Set a role: You are a senior technical writer.
- Give context: the audience, the source material, and any constraints.
- State one task in a single sentence.
- List constraints: length, tone, what to avoid.
- Define the exact output format (list, table, JSON, sections).
- Add one example of the input and the ideal output, then optimize.
Example
write release notes
You are a release manager. Context: I will paste a list of merged pull requests. Task: Write user-facing release notes from them. Constraints: Group by Added, Fixed, Changed. One line each. No internal jargon. Output format: Markdown with an H2 per group and bullet points. Example input: "Fix login redirect" -> Fixed: - Login now redirects correctly.
Common mistakes
- Skipping the output format is the top reason outputs vary run to run.
- Cramming several tasks into one prompt; split them or chain the prompts.
- Vague roles like 'be helpful' add nothing; name real expertise and audience.
FAQ
- What are the parts of a good prompt?
- Role, context, a single task, constraints, the exact output format, and one or two examples. Missing the output format and constraints is what makes results inconsistent.
- Do I need all six parts every time?
- No. Simple tasks need fewer. But adding an explicit task, constraints, and output format reliably improves results even for short prompts.
- How is this different from reviewing a prompt?
- This is about building a well-structured prompt. If you already have a prompt and want it critiqued, use the prompt reviewer instead.
Related prompt guides
Related Prompt Optimizer guides
Write a Prompt From a Rough Idea
Turn a one-line idea of what you want into a full, ready-to-paste structured prompt.
Few-Shot Prompting: Add Examples to Your Prompt
Show the model one to three input-output examples so it copies the pattern you want.
Chain-of-Thought Prompting: Ask for Step-by-Step Reasoning
Prompt the model to reason step by step to improve accuracy on multi-step math, logic, and planning tasks.
Role and Persona Prompting (Act As)
Assign the model a role or persona to control tone, depth, and vocabulary in its answers.
Control the AI Output Format (JSON, Tables, Lists)
Get consistent, parseable output by specifying the exact format, fields, and what to exclude.
Desk gear for long writing sessions
A few things that help if you write docs, tickets, and specs on a laptop all day.
Anker 5-in-1 USB-C Hub
One cable turns a laptop into a desk setup. Drives a 4K display, charges at up to 85W, and adds three data ports.
- 4K HDMI output
- 85W max power delivery
- 1x USB-C + 2x USB-A, 5Gbps each
- MacBook Pro, MacBook Air, Dell
Dell 27" S2725QC 4K
The monitor I write and review documents on. 163 PPI keeps small text sharp, and USB-C carries video and power on one cable.
- 3840x2160 IPS, 163 PPI
- 120Hz, 4ms, FreeSync Premium
- 99% sRGB
- USB-C, HDMI, DisplayPort
Apple MacBook Neo 13" (A18 Pro)
The cheapest way into an Apple-silicon machine that runs local models. Fanless, and the Liquid Retina panel holds small text at a full day of reading.
- A18 Pro chip, built for Apple Intelligence
- 8GB unified memory, 256GB SSD
- 13-inch Liquid Retina display
- 1080p FaceTime HD camera
Amazon affiliate links. We earn a commission on qualifying purchases at no extra cost to you.