Study AI Mastery

Master AI. Shape Your Future. Learn to leverage ChatGPT, Claude AI, and the world's most powerful AI platforms—from complete beginner to expert level.

Platform

  • Start Here
  • New to AI? Start Here
  • For Parents & Educators
  • For Students
  • For Schools
  • Learning Paths
  • Platform Comparison
  • Free Resources
  • Pricing
  • Developer API
  • Alternatives
  • Best AI for…

Company

  • About Us
  • Contact
  • FAQ
  • What's New
  • Privacy Policy
  • Terms of Service
  • Refunds

© 2026 Study AI Mastery. All rights reserved.

Study AI Mastery is operated by Our Rose LLC. Charges appear on your card statement as OUR ROSE LLC.

Learning PathsPrompt Engineering ProfessionalThe Science of PromptingAnatomy of a Perfect Prompt
INTERMEDIATE
Lesson 2 of 3
FREE

Anatomy of a Perfect Prompt

Learn the components that make up an effective prompt — context, instructions, format, and constraints.

22 min with the exercise
~6 min read
intermediate level
Module progress0 / 3 complete

Anatomy of a Perfect Prompt

You have probably written a prompt, read the answer, and thought "that's not what I meant." Then you spent three more messages explaining what you did mean. The information you added in those follow-ups was always in your head. The model just didn't have it.

A strong prompt front-loads that information. It is not longer for the sake of being longer. It simply contains the parts a capable stranger would need to do the job right the first time. This lesson names those parts, shows what each one does, and builds a single prompt up piece by piece so you can watch the output improve.

No prompt guarantees a perfect answer. But the right parts get you closer on the first try and show you what to adjust.

The six parts

PartThe question it answersExample
Role and contextWho is helping, and what's the situation?"You are helping a small bakery owner who is new to email marketing."
TaskWhat exactly should be produced?"Write a welcome email for new subscribers."
InputWhat material should it work from?The shop's hours, specialties, a customer note
ConstraintsWhat are the limits and rules?"Under 150 words. No discount codes."
Output formatWhat shape should the answer take?"Give a subject line, then the body."
ExamplesWhat does good look like?A past email you liked

Not every prompt needs all six. A quick question needs one or two. But when an answer disappoints you, one of these parts is almost always the one that's missing, so the table doubles as a checklist.

Role and context

A role tells the model which kind of expertise and voice to draw on. "You are an experienced bookkeeper" pulls the answer toward careful, practical language. The role alone is weak, though. Context is what makes it useful: who you are, who the output is for, and what's going on.

"You are a marketing expert" adds little. "You are helping a two-person bakery that just started collecting email addresses at the register" changes almost everything about the answer.

Task

The task is the verb and the thing: write, summarize, compare, rewrite, list, explain. Make it one clear job. "Help me with my newsletter" is not a task. "Write the first email new subscribers receive" is.

If you find yourself writing "and also," you may have two tasks. Consider splitting them into separate prompts.

Input

The input is the raw material: notes, a draft, data, a customer message. Models work far better from your real material than from their general knowledge, because your material contains the specifics that make the answer yours.

Mark where the input starts and ends so the model doesn't confuse your instructions with your material. Simple labels or quote marks are enough.

Constraints

Constraints are the rules: length, tone, reading level, things to avoid, things that must be included. They are where most of the "that's not what I meant" moments come from. You knew it had to fit on a postcard. You knew not to mention prices. You just didn't say so.

Good constraints are specific and checkable. "Keep it short" is vague. "Under 100 words" is checkable.

Output format

Tell the model the shape you need: a list, a table, three options, a subject line plus body, plain text with no headings. If the output is going somewhere specific, like a text message, a spreadsheet or a slide, say so. It saves you reformatting everything by hand.

Examples

An example shows what you mean faster than any description. If you have a past email, post or summary that hit the mark, include it and say what to copy from it (the tone, the length, the structure) and what not to copy (the topic). This is powerful enough that it gets its own paid lesson later in the course.

Building one prompt, part by part

Here is the same request built up in stages. Watch how each addition removes a guess the model would otherwise have to make.

Stage 1: task only.

Write a welcome email.

You get a generic welcome that could be from a bank, a gym or a software company. The model had nothing to aim at.

Stage 2: add role and context.

You are helping the owner of [SHOP NAME], a small neighborhood bakery
that just started collecting email addresses at the register. Most
subscribers are regulars who already know the shop.

Write a welcome email for new subscribers.

Now it sounds like a bakery. But it invents details, maybe a loyalty program you don't have, because it doesn't know what's true about your shop.

Stage 3: add the input.

You are helping the owner of [SHOP NAME], a small neighborhood bakery
that just started collecting email addresses at the register. Most
subscribers are regulars who already know the shop.

Write a welcome email for new subscribers.

Facts about the shop:
- Hours: [HOURS]
- Known for: [SPECIALTIES]
- Emails will go out [HOW OFTEN] with new items and holiday orders

The details are now real. It's still too long and a little salesy.

Stage 4: add constraints and output format.

You are helping the owner of [SHOP NAME], a small neighborhood bakery
that just started collecting email addresses at the register. Most
subscribers are regulars who already know the shop.

Write a welcome email for new subscribers.

Facts about the shop:
- Hours: [HOURS]
- Known for: [SPECIALTIES]
- Emails will go out [HOW OFTEN] with new items and holiday orders

Rules:
- Under 120 words
- Warm and plain, like the owner talking at the counter
- No discount codes and no exclamation points
- Only use the facts above; don't invent programs or offers

Format: a subject line, then the email body. Nothing else.

This is usually where the output becomes usable. The line "only use the facts above" matters: it tells the model not to fill gaps with made-up details. You should still read the result, because instructions reduce invented details but don't eliminate them.

Stage 5: add an example (optional).

Here is a past message from the owner that has the right voice.
Match the tone and sentence length, not the topic:

"[PASTE A SHORT MESSAGE THE OWNER WROTE]"

If the tone still isn't right after Stage 4, an example like this is usually the fix.

Order and layout

A few habits make any prompt easier for the model to follow:

  • Put context first and the specific task after it, or state the task first and then give details. Either works; what matters is that the task is stated plainly somewhere, not buried in a paragraph.
  • Use short labeled sections ("Facts:", "Rules:", "Format:") instead of one long block of text.
  • Keep your material clearly separated from your instructions.

Try this

Give yourself 10 to 15 minutes.

  1. Pick a real writing task you have this week: an email, a post, a summary, a set of instructions.
  2. Write the one-line version (Stage 1) and run it. Save the output.
  3. Add parts one at a time, running the prompt after each: role and context, then input, then constraints and format.
  4. After each run, write one sentence about what improved. If nothing did, that part may not matter for this task.
  5. If the tone is still off, add a short example of writing you like.
  6. Keep the final version, with [BRACKETS] in place of details that will change next time.

What to remember

  • A strong prompt answers six questions: who and what situation, what task, from what input, under what rules, in what shape, and like what example.
  • Most disappointing answers are missing one of these parts. Use the table as a checklist.
  • Your own material beats the model's general knowledge. Give it the real facts.
  • Specific, checkable constraints ("under 120 words") work better than vague ones ("short").
  • Telling the model to use only the facts you gave reduces invented details, but you still read and check the result.

Code Examples

Perfect Prompt Template

[ROLE]
Act as a [specific expert] with [X years] experience in [domain].

[CONTEXT]
Background: [Situation and relevant details]
Current state: [Where things stand now]
Goal: [What success looks like]

[TASK]
Please [specific action verb] [specific deliverable].

[FORMAT]
Structure your response as:
- [Format requirement 1]
- [Format requirement 2]

[CONSTRAINTS]
- Must: [requirement]
- Must not: [restriction]
- Length: [word/section count]

[EXAMPLE]
Here's an example of what I'm looking for:
[provide example]
Up Next · Lesson 3 of 3

Common Prompt Patterns

Learn reusable prompt patterns — RISEN, mega-prompts, and template systems.

22 min

In this module

The Science of Prompting

1.
Prompt Engineering as a Discipline
22 min
2.
Anatomy of a Perfect Prompt
22 min
3.
Common Prompt Patterns
22 min

Resources

No resources available for this lesson yet.

AI Study Buddy

Ask me anything about this lesson!

I'm here to help you understand the concepts better.

Practice Quizzes

Test your understanding of this lesson

Generate AI Quiz:

AI will generate 5 questions tailored to this lesson

Available Quizzes:

Anatomy of a Perfect Prompt — Knowledge Check
beginner

Test your understanding of Anatomy of a Perfect Prompt

5 questions
70% to pass