Every strong prompt can be broken down into five parts. Not every prompt needs all five — simple tasks can work with just a task instruction — but missing any relevant component forces the model to guess, and its guess often does not match what you needed.
Task — the core instruction; what action the model should take
Context — background the model needs to produce a relevant response
Format — how the output should be structured
Constraints — limits on length, tone, audience, and scope
Examples — demonstrations of what good output looks like
The task is the core instruction. It tells the model what action to take. A strong task includes an action verb, the subject, and any necessary qualification.
"Write about AI."
No action specificity. No format. No scope. The model defaults to a generic overview of unknown length and depth.
"Write a 3-sentence explanation of what AI is for a high school student."
Action verb (write), subject (AI), format (3 sentences), audience (high school student). Every element is specified.
Write — generate text from scratch.
Summarize — condense existing content.
Classify — assign a category or label.
Extract — pull specific information from text.
Translate — convert between languages.
Explain — make a concept understandable.
Fix / Debug — correct errors in code or text.
Context is the background the model needs to produce a relevant, calibrated response. The model only knows what is in the prompt — it cannot infer your situation, your audience, or your purpose.
Without context, the model produces a response calibrated to the average case. With context, it produces a response calibrated to your case.
Format tells the model how to structure its output. Without a format instruction, the model defaults to prose paragraphs of variable length. With a format instruction, you get exactly the structure your use case requires.
Structured data — "Return a JSON object with keys: name, description, score" — essential for any programmatic pipeline
Lists — "Use a numbered list" or "Return bullet points" — useful for scannable, actionable output
Tables — "Write in a markdown table with columns: Feature, Pros, Cons" — useful for comparisons
Code only — "Return only the corrected code, no explanation" — strips prose when you need raw output
Constraints narrow the output space by setting limits the model must respect. Without them, the model defaults to a verbose, neutral register that may not fit your use case.
Length: "In under 100 words." / "In exactly three sentences."
Tone: "Use a professional, formal tone." / "Keep it conversational."
Audience: "Assume the reader has no prior knowledge of statistics."
Scope: "Focus only on Python 3. Do not mention Python 2."
Without length constraints, models tend to over-explain. Without tone constraints, they default to a generic professional voice.
Without audience constraints, they pitch at an assumed middle level that may not match your reader.
Without scope constraints, they cover adjacent topics you didn't ask for.
Examples are the most powerful component. Showing the model what you want — before asking for it — is more reliable than describing it in words. This technique is called few-shot prompting.
A prompt that says "classify this review as positive or negative" may produce varying output formats: sometimes "Positive", sometimes "The sentiment is positive", sometimes a full explanation. A prompt that shows three labeled examples first will produce the exact label format almost every time. Demonstration is clearer than description.
Task: Classify the following customer review as Positive, Neutral, or Negative.
Context: These are reviews from a mobile app. Users are often brief.
Format: Return only the label — one word.
Constraint: Do not explain your reasoning.
Examples:
Review: "Love it! Works great." → Positive
Review: "App crashes every morning." → Negative
Review: "Does what it says, nothing more." → Neutral
Now classify: "Not bad, updated version fixed most issues."
This prompt has all five components. Each one eliminates a class of ambiguity that would otherwise lead to inconsistent output.
Ask the AI if you need help understanding the five components of a good prompt, how to write strong task instructions, why context matters, how to specify output format, or when to use examples in a prompt.