Anatomy of a Great Prompt

Reviewed & published by Brayan K

Great prompts are built from a handful of parts : a role , a task , context , a format , constraints , and examples . Learn these six and you can assemble a strong prompt for almost anything.

Learn Anatomy of a Great Prompt in our free Prompt Engineering course — a beginner-friendly interactive lesson with worked examples, a practice exercise and…

Part of the free Prompt Engineering course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.

You won’t need all six every time. The trick is to include the parts that remove the guesswork for your particular request — the more ambiguous the job, the more parts you add.

What You'll Learn in This Lesson

1 The six building blocks

Most strong prompts mix some of these ingredients. Use the ones your task needs:

Part

Example

🎭 Role

“Act as a friendly nutrition coach.”

🎯 Task

“Plan three quick weekday lunches.”

🧰 Context

“I’m vegetarian and short on time.”

📐 Format

“Give it as a 3-row table.”

🚧 Constraints

“Under 15 minutes, no nuts.”

📎 Examples

“Match the style of this sample.”

Think of it like stacking layers. Each layer you add removes one more thing the AI would otherwise have to guess.

2 Watch a prompt come together

Same goal — a lunch idea — but the strong version layers in the parts:

No role, no constraints, no format. You’ll get a generic list.

📋 Fill-in-the-blank prompt skeleton

Try it for real

A prompt is not one lump of text — it is six labelled pieces stuck together, and you can hold each one separately. Build the whole thing here, then delete FORMAT and CONSTRAINTS and read the difference. Nothing is hidden: the second prompt still asks the question, it just stops saying how long the answer should be and what the model may use.

Common Mistakes (and the fix)

Frequently Asked Questions

⏱ Test Yourself — Timed Quiz

10 quick questions, 12 seconds each. Instant feedback — beat the clock!

🎉 Lesson Complete

Practice quiz

What are the building blocks of a great prompt covered here?

  • Role, task, context, format, constraints, examples
  • Only the task
  • Color, font, size
  • Username and password

Answer: Role, task, context, format, constraints, examples. A strong prompt often combines role, task, context, format, constraints, and examples.

The 'task' part of a prompt is…

  • Who the AI should pretend to be
  • The clear action you want the AI to do
  • The word count
  • The list of examples

Answer: The clear action you want the AI to do. The task states the action: summarize, write, explain, compare, and so on.

Giving a 'role' means…

  • Telling the AI who to act as, like a teacher or chef
  • Setting the temperature
  • Choosing the font
  • Pasting an error

Answer: Telling the AI who to act as, like a teacher or chef. A role, such as 'act as a nutritionist', shapes the perspective and tone.

Why include a 'format' instruction?

  • It slows the AI down
  • So the answer comes back in the shape you want, like a table or 5 bullets
  • It is required by law
  • It hides the answer

Answer: So the answer comes back in the shape you want, like a table or 5 bullets. Specifying format gives you a tidy, ready-to-use result.

'Constraints' in a prompt are…

  • The limits and rules, like 'under 100 words' or 'no jargon'
  • The AI's mood
  • The login time
  • A type of token

Answer: The limits and rules, like 'under 100 words' or 'no jargon'. Constraints set boundaries the answer must respect.

Adding 'context' to a prompt means…

  • Adding background the AI needs to do the task well
  • Making it longer for no reason
  • Choosing a color
  • Repeating the task twice

Answer: Adding background the AI needs to do the task well. Context is the relevant background: audience, situation, goal, and details.

Including an 'example' helps because…

  • It shows the AI the style or pattern you want
  • It confuses the model
  • It is decorative only
  • It removes the task

Answer: It shows the AI the style or pattern you want. An example demonstrates the desired style or structure to copy.

Do you need all six parts in every prompt?

  • Yes, always all six
  • No — use the ones that reduce ambiguity for your task
  • Never use more than one
  • Only role and password

Answer: No — use the ones that reduce ambiguity for your task. Use the parts that remove guesswork; simple tasks need fewer.

Which prompt is best structured?

  • fix this
  • Act as an editor. Rewrite this paragraph to be clearer, under 80 words, in plain English, like the example below.
  • make it good
  • do the thing

Answer: Act as an editor. Rewrite this paragraph to be clearer, under 80 words, in plain English, like the example below.. It has a role, task, constraints, format, and an example reference.

The biggest payoff of structuring prompts is…

  • Longer answers
  • Fewer rounds of back-and-forth and more on-target results
  • Brighter colors
  • Faster typing

Answer: Fewer rounds of back-and-forth and more on-target results. Structure removes ambiguity, so you reach a good answer faster.

Continue this course