How to Structure a Text Prompt
The five parts of a good prompt (role, context, task, format, and constraints), with ready-to-copy examples you can adapt to your own case.
Rodrigo Faustino ·
- Shelf
- Text prompts
- Call number
- TXT-001
- Level
- Beginner
- Reading
- 7 min
- Published
- Labs
- Prompt anatomy, Before and after
A good prompt tells the AI who it should be, what’s going on, what to do, how to deliver it, and what to avoid. That makes five parts: role, context, task, format, and constraints. You don’t need all of them every time, but knowing they exist improves the quality of the answer right from your first request.
Why AI Needs More Than One Sentence
Think about asking a favor of a coworker who just joined the company. If all you say is “help me with the meeting,” they’ll have questions: which meeting, help with what, by when? Most of the time, the AI doesn’t ask those questions. It fills in the gaps with its most likely guess, and the most likely guess tends to be generic.
The documentation from Anthropic, the company that makes Claude, suggests a simple test: show your prompt to someone who knows nothing about the subject. If that person would be confused, the AI will be too.
The Five Parts, One at a Time
Role. This tells the AI what point of view to answer from. “You are a high school math teacher” pulls in different vocabulary, tone, and examples than “you are a research mathematician.” One sentence is enough.
Context. This is what you know and the AI doesn’t: who will read it, why you’re asking, what you’ve already tried. Explaining the reason behind an instruction helps the AI get even the details you didn’t ask about right.
Task. The request itself, with a clear verb: summarize, compare, create, review, explain. One task per prompt works better than three tasks mixed together.
Format. How the answer should arrive: a numbered list, a table, short paragraphs, a ready-to-send email. If you’re going to paste the result somewhere else, say where.
Constraints. Length, what to avoid, and what’s required. Say what to do rather than what not to do: “write in paragraphs” works better than “don’t use lists.”
Try Building a Prompt
In the lab below, switch each part on and off and watch the prompt change. Then click “Edit texts” and swap the example for your own case.
Assembled prompt
- Role The point of view the AI answers from.
- Context What you know and the AI doesn't: audience, reason, situation.
- Task The request itself, with a clear verb.
- Format How the answer should arrive: list, table, email...
- Limits Length, what to avoid, and what is required.
The lab could not load. The summary above still applies.
Open this lab on its own page →Notice that the task alone fits on one line. The other parts are what make the answer useful to you.
In Practice
Here’s a common request written two ways. First, the way almost everyone does it:
Summarize this meeting.
Now with all five parts:
You are an assistant to a sales manager.
Context: below are my notes from a 40-minute meeting with the team.
I'm going to send the summary to the people who missed it.
Task: summarize the meeting.
Format: two sections, "Decisions" and "Action Items." Under "Action
Items," say who does what and by when.
Constraints: 10 lines at most. If anything in the notes is ambiguous,
mark it with (confirm).
<notes>
paste your notes here
</notes>
See what changes in the result. The answers below were written to show the typical difference, not generated by a model.
Illustrative data Answers written to show the difference, not generated by a model.
Before
Prompt
Answer
After
Prompt
Answer
What changed
- Gained a role: the AI knows who it's working for.
- Gained context: the AI knows the summary is for people who missed the meeting.
- Asked for a format: decisions separated from tasks, with owners and deadlines.
- Set limits: maximum length and what to do with doubts.
The lab could not load. The summary above still applies.
Open this lab on its own page →Look at the end of the strong prompt: the notes sit between tags, <notes> and </notes>. Separating your text from the instructions keeps the AI from confusing one with the other, especially when the text is long.
A Template to Copy
Keep this skeleton and fill it in as needed. Delete any lines you don’t need.
You are [role].
Context: [who will read it, what it's for, what I already know].
Task: [verb + what to do].
Format: [list, table, paragraphs, email...].
Constraints: [length, what to avoid, what's required].
Common Mistakes and How to Avoid Them
The most frequent mistake is stopping at the task. “Write a post about healthy eating” produces text that could be on any website. Add the audience and the goal, and the text becomes yours.
The second is asking only for what not to do. AI understands a positive instruction better. Instead of “don’t be too formal,” say “write like a conversation between coworkers.”
The third is not giving an example when the format matters. If you want the answers in an exact pattern, show a finished example. Anthropic’s documentation recommends three to five varied examples when the format is critical.
Finally, remember that the first answer is rarely the last one. Read it, say what’s missing, and ask again. A good prompt is the start of a conversation, not a magic spell.
Keep Reading
References
- Anthropic. Prompting best practices. Consultado em Nov 28, 2026.
- Anthropic. Prompt engineering overview. Consultado em Nov 28, 2026.