Prompting That Works: Role, Task, Context, Format
Most disappointing answers come from vague requests. Learn the four-part prompt, the two techniques that matter most (examples and step-by-step), and how to iterate instead of restarting.
The idea
A good prompt is a good brief. If you handed the task to a smart new colleague with no context, what would they need? Who they are for this task (role), what exactly to produce (task), what they need to know (context — the document, the audience, the constraints), and what the output should look like (format — bullets, a table, a 100-word paragraph, JSON). Every provider’s official guide says some version of this; the acronym does not matter, the four parts do.
Two techniques move quality more than anything else. Examples: showing two or three samples of the output you want ("few-shot") beats describing it — models imitate patterns extremely well. Step-by-step: for anything with reasoning (planning, analysis, maths, tricky edits), ask the model to think through the problem before answering, or use a model with reasoning built in. And iterate: your second message ("shorter, drop the third point, more formal") is often more valuable than a perfect first prompt. The conversation is the interface.
For developers the same ideas become the system prompt (the standing instructions every request carries) and structured output (asking for JSON that matches a schema so code can consume it). A system prompt is a product spec written for the model: identity, rules, what to do when unsure, and the format contract.
Vocabulary
- System prompt
- Standing instructions that apply to every message in a conversation or app. Consumer apps call these custom instructions, Projects, or Gems.
- Few-shot
- Including examples of the desired output in the prompt.
- Chain of thought
- Asking the model to reason step by step before giving a final answer.
- Structured output
- Forcing the reply into a fixed shape (JSON, a schema) so software can rely on it.
- Temperature
- A dial for randomness. Low = consistent and literal; high = varied and creative.
No-code walkthrough · non-developers
Turn a messy meeting transcript into decisions, owners and deadlines
For: Team lead, project manager, operations, anyone who runs meetings
- 1Copy a meeting transcript or your raw notes (Teams, Meet and Zoom all export transcripts).
- 2Use the four-part prompt below. Note each part: role, task, context (the transcript and who reads the summary), and format (a table with fixed columns).
- 3Read the output against the transcript. Ask: "Which of these decisions are you unsure about? Quote the line you based each one on." This is how you catch invented items.
- 4Iterate: "Merge rows 2 and 4, they are the same action. Add a column for due date, default to ‘not set’ if nobody said one."
- 5Save the final prompt as a reusable template — in ChatGPT as a custom GPT or Project instruction, in Claude as a Project, in Gemini as a Gem. Next week it is one click.
You are an experienced chief of staff who writes crisp meeting summaries. Task: from the transcript below, produce (1) decisions made, (2) action items, (3) open questions. Context: the readers are the attendees plus their managers who were not present. Do not invent items — if something is ambiguous, put it under open questions and quote the relevant line. Format: three sections. Action items as a table with columns Owner | Action | Due date | Source quote. Keep each cell under 15 words. Transcript: [paste]
Check your work: Every row should have a source quote you can find in the transcript. If a row has no quote, it is the model filling gaps — delete it or move it to open questions.
Developer walkthrough · Gemini · Claude · OpenAI
The developer version of the same task: a system prompt that fixes the role, rules and format, and a schema so the reply is guaranteed JSON your code can insert into a tracker. All three providers support schema-constrained output natively.
from anthropic import Anthropic
from pydantic import BaseModel
class ActionItem(BaseModel):
owner: str
action: str
due_date: str | None
source_quote: str
class MeetingSummary(BaseModel):
decisions: list[str]
action_items: list[ActionItem]
open_questions: list[str]
SYSTEM = """You are a chief of staff writing crisp meeting summaries.
Never invent items. If ambiguous, put it in open_questions and quote the line."""
client = Anthropic()
# A tool whose input schema IS the output schema — the model must "call" it,
# so the reply is guaranteed to match the shape.
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=2000,
system=SYSTEM,
tools=[{"name": "record_summary",
"description": "Record the structured meeting summary.",
"input_schema": MeetingSummary.model_json_schema()}],
tool_choice={"type": "tool", "name": "record_summary"},
messages=[{"role": "user", "content": f"Transcript:\n{transcript}"}],
)
data = next(b.input for b in resp.content if b.type == "tool_use")
summary = MeetingSummary.model_validate(data)
for item in summary.action_items:
print(item.owner, "→", item.action, "| due", item.due_date or "not set")- 1Run it on three real transcripts. Count invented action items (no matching quote). Tighten the system prompt until it is zero.
- 2Add two few-shot examples of perfect output to the system prompt and measure again — this is usually the biggest single improvement.
- 3Try the same prompt on the small, mid and large model of one provider. Note quality vs cost; this is the routing decision from the Agent Workflows track.
Practice
Everyone
Take one task you do weekly (status update, customer reply, lesson plan, grant paragraph). Write a four-part prompt for it, run it three weeks in a row, and refine it each time. Save it as a template.
Developers
Build a CLI that takes any text file and a Pydantic schema and returns validated JSON. Add a --model flag and a retry that re-asks when validation fails.
Pitfalls at this stage
- •Restarting the chat when the first answer is off. Steer it instead — "keep everything but make section 2 half the length".
- •Asking for "the best" without saying for whom. Audience is the most under-specified part of most prompts.
- •Long prompts full of "do not" rules. Positive instructions with an example outperform lists of prohibitions.
Free resources
- Anthropic prompt engineering guide ↗Concise, technique-by-technique, with examples.
- OpenAI prompt engineering guide ↗Six strategies with worked prompts.
- Gemini prompting strategies ↗Google’s guide, including multimodal prompts.
- DeepLearning.AI: ChatGPT Prompt Engineering for Developers ↗1.5-hour hands-on short course.