Anatomy of a Good Prompt
Every effective prompt has key structural components that work together like architectural pillars. Understanding how these parts interact at the model level helps you craft better instructions consistently.
The Five Core Components
A well-structured prompt contains five core blocks:
- Role/Persona - Sets the AI's domain expertise, vocabulary, and perspective.
- Context - Provides background facts, data, target audience, and environment.
- Task - The specific, action-oriented request (the core verb).
- Format - The exact output structure (JSON, Markdown table, bulleted points, word count).
- Constraints - Negative and positive boundaries (what to avoid, style requirements, rules).
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā 1. ROLE: You are an executive speechwriter ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 2. CONTEXT: Company is announcing Q3 earnings (+14% YoY) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 3. TASK: Write opening remarks for the CEO ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 4. FORMAT: 3 short paragraphs with headline subheadings ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 5. CONSTRAINTS: Under 250 words, confident tone ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Why Delimiters and Tagging Matter
When prompts grow long, AI models can confuse user data with system instructions. Modern prompt engineering uses structural delimiters (such as XML tags or Markdown headers) to cleanly divide sections.
<role>You are a senior UX researcher.</role>
<context>
User research interviews show 65% of new users drop off during account creation.
</context>
<task>
Analyze the drop-off issue and propose 3 onboarding design fixes.
</task>
<format>
Numbered list with: (1) Proposed Fix, (2) Expected UX Impact, (3) Implementation Effort.
</format>
<constraints>
Focus on low-friction changes. Do not suggest third-party OAuth integrations.
</constraints>
Using XML tags like <context> or <constraints> prevents the AI's attention mechanism from leaking context into instructions.
Visualizing Prompt Structure in Action
Here is the 5-component framework applied to real-world scenarios across different domains:
Example 1: Travel Planning
Example 2: Business & Marketing
Example 3: Software Development
Click "Analyze" on any example to see how the prompt hits all key components.
Deep Component Breakdown
1. Role/Persona
Directs the LLM to prime specific latent knowledge weights in its parameters:
"You are an expert data scientist..."ā Primes technical statistical vocabulary."Act as a patient elementary school teacher..."ā Primes simple explanations and warm tone.
2. Context
Grounds the prompt and prevents hallucinations by anchoring the query to explicit facts:
- The situation, user profile, constraints, or raw source text.
3. Task
The direct imperative action verb:
- Use active verbs:
"Analyze","Extract","Synthesize","Audit","Draft". - Avoid vague directives like
"Look over"or"Help me with".
4. Format
Dictates the physical token layout:
- Specify JSON schemas, Markdown tables, character limits, or section headers.
5. Constraints
Sets strict guardrails:
- Explicit rules on tone, banned vocabulary, length limits, or compliance requirements.
Exercise: Build a Complete Prompt
Common Prompt Structure Failures
| Failure Pattern | What Goes Wrong | How to Fix |
|---|---|---|
| Missing Role | Generic, low-effort corporate response | Add "You are a [specialist] with expertise in [domain]" |
| Vague Task | Wall of unorganized text | Use explicit action verbs ("Identify 3 key risks") |
| No Format Spec | Paragraphs when you needed code or table | Define exact format: "Output as a Markdown table" |
| Conflicting Constraints | Model ignores rules or produces truncated text | Resolve contradictions (e.g. don't demand "detailed depth" in "30 words") |
Quick Reference Template
Practice: Analyze This Prompt
What's missing from the prompt above? Think about:
- What role would improve the response?
- What context is the AI missing? (Dates, reason, coverage plan)
- What format would be most useful?
- What constraints would help? (Tone, word count limit)
Understanding prompt anatomy is the foundation for everything else in this course.

