Skip to main content

Beginner-Friendly Topic

Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!

Lesson 1 of 13

Basic Prompt Structure

A structured prompt is easier to write, easier to improve, and produces more consistent results. Learning a reusable structure gives you a starting point for any prompt.

10 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

The Core Prompt Structure

A well-structured prompt has five components:

Role: who the AI should act as
Task: what the AI should do
Context: relevant background information
Requirements: constraints, format, audience
Output Format: how the response should look

You do not need all five in every prompt. Start with Task and Context. Add the others when they make the prompt clearer.

Diagram
Loading diagram…

Basic Prompt Structure Diagram

Structure Diagram

Structure Diagram
# The Prompt Structure: Role + Task + Context + Requirements + Output

role = "You are a technical writer with experience in beginner tutorials."

task = "Write an introduction to Python for someone with no programming experience."

context = "The reader is a marketing professional who wants to learn Python for data analysis."

requirements = [
    "Keep it under 150 words",
    "Use a friendly, encouraging tone",
    "Avoid technical jargon unless it is explained",
]

output_format = "Two short paragraphs followed by 3 bullet points of what they will learn."

# Assembled prompt:
structured_prompt = f"""
{role}

{task}

Context: {context}

Requirements:
- {chr(10).join('- ' + r for r in requirements)}

Output format: {output_format}
"""

print("Structured prompts are easier to write, read, and improve.")
print("You can build a template and fill in the sections for each task.")

Key Takeaways

  • A structured prompt has five components: Role, Task, Context, Requirements, Output Format
  • You do not need all five in every prompt
  • Start with Task and Context, then add the other components when needed
  • A consistent structure makes prompts easier to write and improve
  • You can turn this structure into a reusable template for common tasks

Key Takeaways

  • A structured prompt is easier to write, easier to improve, and produces more consistent results.
  • A structured prompt has five components: Role, Task, Context, Requirements, Output Format
  • You do not need all five in every prompt
  • Start with Task and Context, then add the other components when needed

Finished this lesson?

0 of 13 in Module 4
Sign in to save progress
PreviousStart of module
Next lessonRole Instructions

Topics in This Module

0/13 done