The 5 Components of an Effective Prompt
By Learnia Team
The 5 Components of an Effective Prompt
This article is written in English. Our training modules are available in French.
Some prompts work brilliantly. Others fail completely. The difference often comes down to structure. Here's the anatomy of prompts that consistently get great results.
The 5 Components Overview
Every effective prompt contains some or all of these elements:
┌─────────────────────────────────────┐
│ 1. ROLE Who the AI should be │
│ 2. CONTEXT Background situation │
│ 3. TASK What to do │
│ 4. CONSTRAINTS Boundaries & limits │
│ 5. FORMAT How to present output │
└─────────────────────────────────────┘
Not every prompt needs all five—but understanding each helps you know what to include.
Component 1: Role
What it does: Sets the AI's expertise and perspective
Without Role
"Review this code"
→ Generic review, unclear depth
With Role
"As a senior security engineer..."
→ Security-focused analysis
Role Examples
"You are an experienced copywriter specializing in B2B SaaS"
"Act as a patient teacher for complete beginners"
"You're a skeptical investor evaluating pitches"
When to include: When expertise or perspective matters
Component 2: Context
What it does: Provides background the AI needs to give relevant answers
Without Context
"Write an email to decline"
→ Decline what? To whom? Why?
With Context
"A vendor sent us a proposal for $50K/year software.
We've decided to go with a competitor. The vendor contact
(Marie) has been professional and responsive."
→ Now the AI can write an appropriate decline
Context Types
Situation: "Our startup has 20 employees and limited budget"
Audience: "The reader is a technical expert, no need for basics"
History: "This is a follow-up to our meeting last Tuesday"
Constraints: "We're bound by EU data regulations"
When to include: When the AI needs background to be relevant
Component 3: Task
What it does: States exactly what you want the AI to do
Vague Task
"Help with this document"
→ Help how? Summarize? Edit? Analyze?
Clear Task
"Summarize this document into 5 key points for an executive audience"
→ Specific, actionable instruction
Task Clarity Tips
Use action verbs: Write, Analyze, Extract, Compare, Create
Be specific: "5 key points" not "some points"
Define success: "suitable for a 5-minute presentation"
Always include: This is the core of every prompt
Component 4: Constraints
What it does: Sets boundaries and limitations
Types of Constraints
Length:
"In 100 words or less"
"Between 300-500 words"
"Maximum 3 paragraphs"
Tone:
"Professional but approachable"
"Formal, suitable for legal context"
"Casual, as if explaining to a friend"
Content:
"Focus only on financial aspects"
"Exclude technical jargon"
"Don't mention competitor names"
Behavior:
"If you're unsure, say so"
"Only use information from the provided document"
"Ask clarifying questions if needed"
When to include: When default behavior isn't what you want
Component 5: Format
What it does: Specifies how the output should be structured
Format Options
Lists:
"Present as a numbered list"
"Use bullet points with bold headers"
Tables:
"Format as a comparison table with columns for Pros/Cons"
Structured:
"Use this structure:
## Summary
## Key Findings
## Recommendations"
Code:
"Return as valid JSON with keys: name, value, category"
When to include: When you need specific output structure
Putting It All Together
Weak Prompt (Task Only)
"Write about productivity"
Problems: No direction, too vague, unpredictable output
Strong Prompt (All 5 Components)
[ROLE]
You are a productivity coach who specializes in helping
remote workers.
[CONTEXT]
I work from home and struggle with distractions. I have
a dedicated office but often get pulled away by household
tasks and notifications.
[TASK]
Create a morning routine that helps me start work focused
and maintain concentration.
[CONSTRAINTS]
- Routine should take 30 minutes or less
- No suggestions requiring special equipment
- Practical for someone who's not a morning person
[FORMAT]
Present as a numbered timeline (e.g., 7:00 - Wake up, etc.)
with a brief explanation for each step.
This prompt leaves no ambiguity about what's needed.
The Minimum Viable Prompt
You don't always need all 5 components. Here's when to use each:
| If your task is... | You need... | |-------------------|-------------| | Simple & common | Task only | | Expertise-specific | Task + Role | | Situation-dependent | Task + Context | | Format-sensitive | Task + Format | | Complex | All 5 components |
Quick Reference
ROLE → "You are a [profession] with [experience]..."
CONTEXT → "The situation is... The audience is..."
TASK → "Create/Analyze/Write/Compare [specific thing]"
CONSTRAINTS → "Keep it under X, use Y tone, avoid Z"
FORMAT → "Present as [structure] with [elements]"
Key Takeaways
- →5 components: Role, Context, Task, Constraints, Format
- →Task is essential—always include it
- →Add components based on complexity and needs
- →More structure = more predictable, better results
- →Start simple, add components if output isn't right
Ready to Master Prompt Structure?
This article covered the what and why of prompt anatomy. But applying these components effectively takes practice and technique.
In our Module 1 — Fundamentals of Prompt Engineering, you'll learn:
- →Deep dive into each component with examples
- →Zero-shot, one-shot, and few-shot techniques
- →Business-oriented prompt templates
- →Hands-on exercises with feedback
Module 1 — LLM Anatomy & Prompt Structure
Understand how LLMs work and construct clear, reusable prompts.