📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Prompt Engineering Anatomy of a Great Prompt

Anatomy of a Great Prompt

6 min read Quiz at the end
Every great prompt has Role, Task, Context, Format, and Constraints — learn to use all five components.

Anatomy of a Great Prompt

Five essential components of an effective prompt:

ComponentPurposeExample
RoleSet persona/expertiseYou are a senior Python developer...
TaskClear action to performReview the following code for bugs...
ContextBackground informationThis runs on Python 3.12 with FastAPI...
FormatOutput structureRespond as a numbered list...
ConstraintsLimits and requirementsKeep under 200 words. No jargon.
You are a senior Python developer.
Review the following FastAPI route for security issues.
Context: This is a public API endpoint handling user login.
Format: List each issue with Severity (High/Med/Low) and a fix.
Constraint: Focus on security only, not code style.

```python
@app.post('/login')
def login(username: str, password: str):
    user = db.query(f"SELECT * FROM users WHERE name='{username}'")
```
Topic Quiz · 1 questions

Test your understanding before moving on

1. Which prompt component controls the output structure?
💡 The Format component specifies how the output should be structured (JSON, bullet list, table, etc).