Lesson 2 of 9 · about 15 minutes
How Prompts Shape AI Answers: Role, Task, Context, Constraints, Format, Examples
You'll be able to
- Understand what role, task, context, constraints, format and examples each do to an answer
- Tell a vague prompt from a specific one and predict how each will fail
- Explain why vendors recommend long documents first and the question last
- Recognize why a precise correction works better than 'are you sure?'
An AI model has no idea who you are, what county you live in, what you already know or what you plan to do with its answer. Every gap in a prompt gets filled with a guess. Anthropic's own prompting guide puts it well: treat the model like a capable new employee with no context on your norms. Nobody would hand a new hire a sticky note that says "look into the budget" and expect a useful result. Models get that sticky note all day long.
The parts of a strong prompt
| Part | What it does | Example line |
|---|---|---|
| Role | Sets the expertise and the attitude | "You are a skeptical public finance analyst." |
| Task | Says exactly what to produce | "List every line item over $50,000 that is new this year." |
| Context | Explains who it's for and why | "This is for a one-page briefing for residents who have never read a budget." |
| Constraints | Sets the rules and the escape hatch | "Use only the attached document. If it does not say, write NOT IN DOCUMENT." |
| Format | Shapes the output so you can check it | "A table: item, amount, page number, quoted line." |
| Examples | Shows instead of tells | "Like this: Radio replacement, $62,400, p. 41, 'Replace 31 handheld units.'" |
Not every prompt needs all six. A quick definition needs a task and maybe a format. A research answer someone plans to rely on benefits from all of them. The constraint and format lines matter most for research, because they decide whether the answer can be checked at all.
Context does more work than people expect. Anthropic's guide gives the example of a rule about ellipses: a bare "never use ellipses" works less well than explaining that the text will be read aloud by a speech engine that cannot pronounce them. A reason lets the model apply the rule to cases you didn't list.
Before and after
Before
Summarize the attached audit.
What you get: four tidy paragraphs, half of them about the audit's methodology section, no page numbers, and one sentence that blends two separate findings into a single claim nobody made.
After
[audit PDF attached]
You are an experienced local government analyst. I am a parent
preparing for a school board meeting, and I need to understand the
attached 2025 financial audit of the invented Brask Valley School
District.
Task: List each finding the auditor labels as a "material weakness"
or "significant deficiency."
For each one give:
- the finding number as the auditor wrote it
- one plain-English sentence on what went wrong
- any dollar amount the audit attaches to it
- the page number
- the district's written response, quoted, under 40 words
Rules:
- Use only the attached audit.
- Quote exact wording for dollar amounts and finding labels.
- If the audit does not give a dollar amount, write "none stated."
- Do not add opinions, background or advice.
Format: a table, then a one-line count of findings by type.
What you get: a table anyone can check line by line against the PDF in fifteen minutes.
Notice the document comes first and the question last. Anthropic's guide recommends that order for long inputs (roughly 20,000 tokens and up, about 15,000 words) and says queries at the end improved response quality by up to 30 percent in its tests. Treat the number as a vendor's own best case. The order costs nothing either way.
The same guide recommends asking the model to quote the relevant passages first, then answer. That matters for checking. A quote can be searched for in the PDF in two seconds. A paraphrase cannot.
More before and after
Meeting transcript
Before: What happened at the meeting?
After:
[transcript pasted]
From the transcript above of the Pell Creek City Council meeting of
September 8, 2026, list every motion. For each: who moved, who
seconded, the vote count by name if stated, and the timestamp.
Then list any statement by a council member that includes a dollar
figure, quoted exactly with timestamp. If a speaker label is
missing or unclear, write "speaker unclear" and do not guess.
Background research
Before: Tell me everything about road bonds.
After:
I'm a resident trying to understand a county road bond election in
Idaho. Explain in plain language: what a general obligation bond
is, who repays it, what voter approval threshold applies, and what
documents a county must publish before the vote. For every rule,
name the statute or agency rule and give a link to the official
text. If you are not sure of a citation, say so instead of
guessing.
The answer is only a list of places to look. Every statute link still has to be opened and the section read, because models cite sections that do not say what they claim.
Examples in a prompt
When a specific format matters (a timeline, a quote log, a fact table), one finished sample row does more than a paragraph of description. Anthropic recommends examples that are relevant, varied and wrapped in tags such as <example> so the model can tell them apart from instructions, and suggests three to five for best results. For research work, one or two rows usually do it.
Models sometimes copy example data into the answer. If a sample row says "Radio replacement, $62,400," that exact item can turn up in the real output as if the budget contained it. Invented sample content makes the copy easy to spot. Ask anyone who has found a fake line item in a handout the night before a hearing.
Iterating instead of starting over
The first answer is rarely the final one. A follow-up that names exactly what is wrong keeps what worked and fixes what didn't. A vague one gives the model nothing to aim at.
| Weak follow-up | Strong follow-up |
|---|---|
| That's not right. | "Row 3 says $1.2 million, but page 18 says $1.02 million. Recheck every amount against the page you cited and list any you change." |
| Make it better. | "Cut to 120 words. Put the dollar figure first. Drop the sentence about the history of the district." |
| Are you sure? | "Quote the exact sentence from the document that supports your claim about overtime. If there isn't one, say so." |
"Are you sure?" is the worst of the three. Models tend to apologize and change a correct answer as readily as a wrong one. Asking for the quote tests the claim. Asking for reassurance tests nothing.
Long, muddled conversations cause their own errors. Old material in the context window can bleed into new answers, especially after a switch to a different document. A clean chat with a good prompt beats a 90-message thread.
Reporting angle
Staff at agencies and campaigns are writing prompts now. Ask a county, city or school district for its AI use policy and any saved prompt libraries or chat logs used to draft public documents. The Idaho FOIA / Public Records Letter Generator drafts the request under Idaho Code Title 74, Chapter 1. Ask whether prompts told the model what to do when unsure, and whether staff pasted private data into a public tool. Compare the prompt to the published result, sentence by sentence.
Research angle
- Anthropic: Prompting best practices: the vendor guide, useful as a yardstick for how a staff prompt was written.
- Anthropic: Prompt engineering overview: what prompts can and cannot do.
- Idaho FOIA / Public Records Letter Generator: drafts a request under Idaho Code Title 74, Chapter 1.
Common mix-ups
- Claim: Magic phrases and threats make models work harder. What the evidence shows: Vendor guides stress clear, specific instructions with context. Clarity does the work; incantations are folklore.
- Claim: Longer prompts are always better. What the evidence shows: Specific beats long. A tight prompt with a clear format and an escape hatch beats a page of vague wishes.
- Claim: A role line makes the model an expert. What the evidence shows: A role shapes tone and focus. It adds no knowledge the model lacks and checks no facts.
Check yourself
1. Which prompt is most likely to get a useful answer?
It names a role, a precise task, the source to use, a threshold, a format and what to do when unsure. The others leave the model to guess what is wanted.
2. When you paste a long document into a prompt, where should your question go?
Anthropic's prompting guide says to put long documents at the top and the query at the end, and reports quality gains of up to 30 percent in its tests with complex inputs.
3. What is the purpose of the constraint 'If the document does not say, write NOT IN DOCUMENT'?
Models fill gaps by default. A named escape hatch makes 'I don't know' an acceptable output and makes gaps easy to spot.
4. A model's answer is too long and includes opinions nobody asked for. Which follow-up is most likely to fix it?
Iterating with a precise correction keeps what worked and fixes what didn't. 'Try again' gives the model nothing to aim at.
5. Why give the model one or two examples of the output you want?
A worked example is the clearest spec for format. Invented content in examples is safest, and the answer still needs a check that none of it was copied in.
Terms in this lesson
- Prompt
- The instructions and material you give an AI tool in one message.
- Constraint
- A rule in the prompt that limits the answer, such as length, sources allowed or what to do when unsure.
- Few-shot example
- A sample of the output you want, included in the prompt to show the format.
- Iteration
- Improving an answer by replying with specific corrections instead of starting over.
- Context window
- The amount of text a model can consider at once, including your prompt, files and the conversation so far.
Sources
- Anthropic: Prompting best practices (Claude docs) checked 2026-10
- Anthropic: Prompt engineering overview checked 2026-10