How to Write Prompts: A 4-Part Framework for Beginners (2026)
Writing a good prompt comes down to saying out loud what is normally left implicit in your head: what the background is, what you want done, what the limits are, and what the result should look like. Those four points map to context, task, requirements, and output format. Fill them in each time you ask, and the result is usually more useful than a quick one-line question.
A model can't see your context and can't guess your preferences. All it gets is the text you type, so the more your prompt reads like a handoff note to a coworker, the closer the result will be to what you wanted.
What goes into each of the four parts?
| Part | Question it answers | What to write |
|---|---|---|
| Context | Why are you doing this, and who is it for? | Your role, the situation, the reader, existing material |
| Task | What exactly should it do? | One clear action: rewrite, summarize, translate, troubleshoot, compare |
| Requirements | What are the boundaries? | Length, tone, what must be included or avoided, what sources it may rely on |
| Output format | What should the result look like? | Table, list, paragraphs, code block, JSON, etc. |
You don't need all four every time. For a simple question, a clear task is enough. For work product, or anything you plan to use directly, it's best to have all four.
Context: say who you are and who it's for
"Write me an email" and "I run operations at a ten-person company and need to email a supplier we've worked with for six months, chasing a shipment that is a week late" give the model very different information. The second tells it what tone to use and whether to bother with pleasantries. In the context, the reader and the situation matter most; your own role comes second.
Task: give one action at a time
"Summarize, translate, and rewrite it as a social media post" makes the results drag each other down. Split it into two or three steps and check each one separately. That is easier to control than one long instruction.
Requirements: write boundaries, not adjectives
"Make it more professional" is vague. "No more than 300 words, no exclamation marks, no figures I didn't provide" is easier to follow and easier to check. If you want it to answer only from your material, say so explicitly: "Answer only from the material below. If it isn't in the material, say you don't know."
Output format: decide how you'll use it first
If it's going into a spreadsheet, ask for a table. If it's going into a program, specify the field names. If it's for your boss, ask for "conclusion first, then three supporting points." If you don't state a format, the model picks one itself, and that is often a wall of text.
How do you turn a bad prompt into a good one?
The examples below are illustrations and do not describe any real scenario.
| Weak version | Rewritten |
|---|---|
| Write me a weekly report | Context: I'm a backend developer writing a weekly report for my direct manager. Task: turn the work log below into this week's report. Requirements: no more than 250 words, cover only completed work and next week's plan, don't invent anything not mentioned. Format: two subheadings, one line per item. Log: ... |
| There's a problem with this code | Context: A Python 3 script that reads a CSV and calculates averages. Task: find why the code below raises a KeyError. Requirements: give the cause first, then the smallest fix. Format: cause in one sentence, fix in a code block. Error message and code: ... |
| Tell me about APIs | Context: I'm in a non-technical role and have never written code. Task: explain what an API is using an everyday analogy. Requirements: no more than 200 words, no jargon, and explain any term you do use. Format: one paragraph plus one example. |
Notice that the rewrites aren't fancier. They just add information the model has no way of knowing on its own.
How do you make results more consistent? Three common techniques
- Give an example. If you want a particular style or format, paste a sample you like and say "follow this format." That is more precise than describing the style.
- Separate the material from the instructions. Use "Material:" or a divider line to set off the text to be processed, so the model doesn't treat sentences in the material as instructions.
- Allow it to say it doesn't know. Adding "If the information is insufficient, ask me first instead of guessing" reduces made-up answers.
Keep in mind that a prompt can't guarantee a correct answer. For facts, numbers, regulations, medical, or financial content, you still need to check the sources yourself.
What if the first attempt doesn't work?
Don't rewrite everything. Add corrections in the same conversation, such as "Too long, cut it in half" or "Drop point two and replace it with something about cost." Treat the corrected results as material for the next version of your prompt. After you've done the same kind of task a few times, you'll have built up a template of your own.
If you use a model in an app over the long term, the fixed context and requirements usually go into a system prompt. For how to write one, see What is a system prompt, and how do you write a useful one?. If the model refuses to answer, first work out whether it's a policy limit or the way you asked; see What to do when Claude refuses to answer.
Checklist before you send
- Does the model know the reader and the purpose?
- Is there only one action in the task?
- Can the limits be checked (word count, scope, banned items) rather than "make it better"?
- Did you specify the output format?
- Did you paste all the material it needs, and is it separate from the instructions?
- For factual content, do you plan to verify it?
Where to practice, and what to do next
The four-part framework works in any conversational AI. If you haven't picked a tool yet, see How to start using AI: web app, mobile app, or API first? and How to use ChatGPT: a beginner's guide to the main features. If you later want to call a model from code, the prompt goes into the messages array of the request; see What is Chat Completions? How to write the messages array.
If you want to practice repeatedly in tools like Claude Code or Codex and don't have an overseas credit card, you can look into AGI Plan. It is a multi-provider LLM aggregation gateway with monthly subscriptions billed in RMB (Chinese yuan). One quota can be switched across several capability groups, and to keep using tools such as Claude Code and Codex you only change one endpoint URL. Some models are available only outside mainland China; check the model list for details. The service also states that it is not an officially authorized channel. AGI Plan is a commercial partner of cdnping; the getting-started steps are at agiplan.dev/startup.
If a service is slow or won't open while you practice, you can check its status with Is it down?, or use the online speed test to see how your connection to each API looks.
Suggested next step: pick one real task you need to do today, write a four-part prompt for it using the table above, revise it once against the checklist, and keep that version as your first template.