claude-mastery-course

# πŸ’‘ Module 03 β€” Prompt Engineering [![Module](https://img.shields.io/badge/03-Prompting-FF7A4D?style=for-the-badge&labelColor=2a1f1a)](#) [![Time](https://img.shields.io/badge/⏱️_25_min-FF7A4D?style=for-the-badge&labelColor=2a1f1a)](#) [![Level](https://img.shields.io/badge/🌱_Beginner-6BCF7F?style=for-the-badge&labelColor=2a1f1a)](#) [![Star](https://img.shields.io/badge/⭐_Most_important-FFD23F?style=for-the-badge&labelColor=2a1f1a)](#) ***Goal:** move from "vibes-based" prompting to a repeatable system that produces great output every time.*

3.1 The Mental Model

A prompt is a brief to a brilliant but contextless collaborator. Claude has read most of the public internet β€” but it doesn’t know:

πŸ€” Who you are πŸ› οΈ What you’ve tried 🎯 What β€œgood” means πŸ“¦ What format you want
Your role Past attempts Your style Length
Your audience What failed Your standards Structure
Your industry Constraints learned Your taste Tone

Your job as the prompter is to close that gap fast. The single biggest improvement most people can make: stop writing one-line prompts and start writing 3–10 line briefs.


3.2 The Anatomy of a Great Prompt

Almost every excellent prompt contains some mix of these six ingredients. Memorize them.

                          🎯 Great Prompt
                                β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό           β–Ό           β–Ό           β–Ό           β–Ό
   🎭 ROLE     πŸ“‹ CONTEXT    🎯 TASK    πŸ“ CONSTRAINTS  πŸ“¦ FORMAT  🌟 EXAMPLES
   who Claude  background   the ask    boundaries     shape      show, don't tell
   is
Ingredient What it does Mini-example
🎭 Role Sets perspective β€œYou are a senior product manager at a fintech startup.”
πŸ“‹ Context Background info β€œWe’re launching a new card next month, target = young professionals.”
🎯 Task The actual ask β€œDraft a 3-tier pricing page.”
πŸ“ Constraints Boundaries β€œMax 200 words per tier. No marketing fluff.”
πŸ“¦ Format Output shape β€œReturn as a markdown table with: Tier | Price | Top 3 features.”
🌟 Examples Show, don’t tell β€œMatch how Stripe writes β€” clean, technical, confident.”

[!TIP] Not every prompt needs all six. But if you find Claude’s output disappointing, look at this list and ask: which ingredient did I leave out?


3.3 Beginner vs. Pro β€” visualized

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                     β”‚
β”‚  ❌  BEGINNER:  "write me a cover letter for a PM job"              β”‚
β”‚                                                                     β”‚
β”‚      β–Ό  produces β–Ό                                                  β”‚
β”‚                                                                     β”‚
β”‚      🀷  Generic Mad Libs template you can't actually send          β”‚
β”‚                                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                     β”‚
β”‚  βœ…  PRO:                                                           β”‚
β”‚                                                                     β”‚
β”‚  🎭   You are an executive writing coach...                         β”‚
β”‚                                                                     β”‚
β”‚  πŸ“‹   <resume>...</resume>                                          β”‚
β”‚       <job_description>...</job_description>                        β”‚
β”‚       <context>I met the hiring manager at a conference...</context>β”‚
β”‚                                                                     β”‚
β”‚  🎯   Write a cover letter that:                                    β”‚
β”‚  πŸ“    - Under 300 words                                            β”‚
β”‚  πŸ“    - Opens with a specific hook (not "I'm writing to apply...") β”‚
β”‚  πŸ“    - Explicitly connects 2-3 resume bullets to the JD           β”‚
β”‚  πŸ“    - References the conference meeting naturally                β”‚
β”‚  πŸ“    - Sounds like a confident peer, not a desperate applicant    β”‚
β”‚                                                                     β”‚
β”‚  πŸ“¦   Then in a section called "What I changed and why",            β”‚
β”‚       explain your top 3 stylistic choices.                         β”‚
β”‚                                                                     β”‚
β”‚      β–Ό  produces β–Ό                                                  β”‚
β”‚                                                                     β”‚
β”‚      ✨  Output you can actually send                               β”‚
β”‚                                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

3.4 The 10 Core Techniques

# Technique One-liner
1 🎯 Be specific about the audience β€œExplain X to a smart 12-year-old who loves video games”
2 πŸ“‹ Show an example of β€œgood” Paste a sample. Claude matches tone & structure brilliantly
3 πŸ‘£ Break complex tasks into steps Step 1: brainstorm. Step 2: outline. Step 3: draft
4 🧠 Ask Claude to think step-by-step Big quality boost on hard reasoning
5 🏷️ Use XML tags for structure Wrap inputs in <context>, <draft>, <task>
6 ✨ Few-shot examples 2–3 input/output pairs, then ask for the next one
7 🚫 Tell Claude what NOT to do β€œno apologies, no disclaimers, no summary”
8 πŸ™‹ Have Claude ask YOU first β€œAsk me 3 clarifying questions before starting”
9 🎯 Put role at the END For long prompts, role last keeps it fresh
10 πŸ”§ Iterate, don’t restart β€œTighten paragraph 2” beats redoing the whole prompt

1. Be specific about the audience

❌ β€œExplain quantum computing.” βœ… β€œExplain quantum computing to a smart 12-year-old who loves video games. Use 1–2 analogies.”

2. Give an example of β€œgood”

When you have it, paste a sample. Claude is extraordinarily good at matching tone and structure when you show rather than describe.

Here's a tweet I wrote that I'm proud of:
"[paste tweet]"

Now write 5 more in the same voice on the topic of [X].

3. Break complex tasks into steps

Instead of one giant prompt, walk Claude through a process:

We're going to write a blog post about [topic]. Let's do it in stages:

Step 1: Brainstorm 10 angles. I'll pick one.
Step 2: Build an outline with H2s and key points.
Step 3: Write the intro only. I'll review.
Step 4: Write the body section by section.

Start with Step 1.

This is called prompt chaining and it produces dramatically better long-form work.

4. Use chain-of-thought (β€œthink step by step”)

For reasoning, math, or complex analysis, ask Claude to show its work before the answer:

Before giving your final answer, work through the problem step by step.
Then give the answer in a clearly labeled "Final answer:" line.

5. Use XML tags to structure long prompts

Claude was specifically trained to pay attention to XML-style tags. For prompts with multiple inputs, this is gold:

<context>
Our company sells handmade leather goods, founded in 2018, based in Portland.
</context>

<draft>
[paste your draft]
</draft>

<task>
Edit the draft above for clarity. Preserve the brand voice described in <context>.
Return only the edited version.
</task>

6. Use few-shot examples

Convert customer messages into structured tickets.

Input: "My order hasn't arrived and it's been 2 weeks!"
Output: {"category": "shipping", "priority": "high", "sentiment": "negative"}

Input: "Loving the new feature, when's the next update?"
Output: {"category": "feedback", "priority": "low", "sentiment": "positive"}

Input: "Site is down, can't log in."
Output:

7. Tell Claude what not to do

8. Ask Claude to ask you questions first

Before you start, ask me 3 clarifying questions that would
most change your approach.

This single trick will save you hours of bad output.

9. Set the role at the end, not the beginning

Counterintuitive but it works for long prompts. Putting the role/instruction at the end keeps it fresh in Claude’s β€œworking memory”:

[long context...]
[example data...]

Given everything above, act as a forensic accountant and identify
the three most suspicious entries.

10. Iterate, don’t restart

If output is 80% right, ask for surgical edits β€” don’t redo the whole prompt:


3.5 The Prompt Quality Decision Tree

🚨 Bad output? Walk down this list β€” first match wins.

If… Then…
❓ Task is ambiguous Add: β€œAsk me 3 clarifying questions first”
🎨 Wrong tone or format Add: an example or a format spec
🧩 Complex multi-step task Break into a chain of smaller prompts
🧠 Reasoning is shallow Add: β€œThink step-by-step before answering”
πŸ“‹ Details are missing Add: role + context + constraints
🀷 Still bad? Try a different model (Sonnet β†’ Opus)

3.6 Three High-Value Prompt Patterns

πŸ…°οΈ Pattern A β€” The β€œExplain it to me”

Explain [concept] using:
- A 1-sentence ELI5
- A concrete real-world analogy
- The technical definition
- One common misconception people have

Keep the whole thing under 250 words.

πŸ…±οΈ Pattern B β€” The β€œCritique my work”

You're an experienced [role]. Below is my [draft/code/plan].

<work>
[paste]
</work>

Give me:
1. Three things working well (be specific, not generic)
2. Three things to improve, ranked by impact
3. One bold suggestion I probably haven't considered

Be direct. I'd rather be helped than flattered.

πŸ…²οΈ Pattern C β€” The β€œDecision helper”

I'm deciding between [Option A] and [Option B]. Context:
- [your situation]
- [constraints]
- [what success looks like]

Don't just list pros/cons. Tell me:
1. Which option you'd pick and why
2. The one scenario where you'd flip your answer
3. What I should learn or test before deciding

Push back on my framing if you think I'm asking the wrong question.

3.7 Common Mistakes & Fixes

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ❌  MISTAKE                     β”‚  βœ…  FIX                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  One-line prompts                β”‚  Add role + context + format     β”‚
β”‚  Yes/no on complex topics        β”‚  Ask for tradeoffs + conditions  β”‚
β”‚  Stuffing 10 tasks in one prompt β”‚  Split into a chain              β”‚
β”‚  Vague feedback ("make it nice") β”‚  Be specific: "shorter,formal"   β”‚
β”‚  Re-explaining context every turnβ”‚  Use a Project (Module 04)       β”‚
β”‚  Accepting first answer          β”‚  Ask "what would 50% better be?" β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

3.8 The Prompt Engineering Mindset

The best prompters share three habits β€” they all lead to the same place:

Habit Why it works
πŸ§ͺ Run experiments, not requests Every prompt is a hypothesis to test
πŸ“š Keep a personal prompt library Your best prompts are an asset; save them
πŸ” Study the model’s failures Bad outputs teach you what’s missing

β†’ All three roads lead to 🎯 consistently great output.

When Claude misfires, ask β€œwhat was missing in my prompt?” β€” not β€œwhy is the AI dumb?”


βœ… Module 3 Checkpoint

You should now be able to:

[!IMPORTANT] πŸ‹οΈ Exercise: Take a prompt you used last week and rewrite it using everything from this module. Compare the outputs side-by-side.

πŸ‘‰ Next up: Module 04 β€” Claude.ai Features β€” Projects, Artifacts, Files, Memory, and Connectors.


πŸ“š Further reading


← Previous 🏠 Home Next β†’
Module 02 β€” Getting Started Course README Module 04 β€” Claude.ai Features