CoachnestCoachnest
Sign InGet Started
Back to course

Prompt Engineering Mastery: From Fundamentals to Production

…
—
Contents
1

What Is Prompt Engineering?

ReadingFree
2

How Large Language Models Actually Work

ReadingFree
3

Tokens, Context Windows, Temperature & Sampling

Reading11m

The Anatomy of a Great Prompt

Reading13m
5

Module 1 Knowledge Check

Quiz8m
6

Zero-Shot, One-Shot & Few-Shot Prompting

Reading12m
7

Role & Persona Prompting

Reading9m
8

Instruction Clarity, Delimiters & Decomposition

Reading11m
9

Controlling the Output Format

Reading10m
10

Module 2 Knowledge Check

Quiz8m
11

Chain-of-Thought Prompting

Reading12m
12

Self-Consistency & Tree-of-Thought

Reading11m
13

ReAct — Reasoning + Acting with Tools

Reading12m
14

Structured Output with JSON Schemas

Reading11m
15

Module 3 Knowledge Check

Quiz8m
16

Retrieval-Augmented Generation (RAG)

Reading13m
17

Prompt Templates, Variables & Chaining

Reading11m
18

Tool / Function Calling Patterns

Reading12m
19

Project — Build a Customer Support Assistant

Reading14m
20

Module 4 Knowledge Check

Quiz8m
21

Evaluating Prompt Quality

Reading12m
22

Prompt Injection & Security

Reading12m
23

Reducing Hallucinations

Reading10m
24

Cost, Latency & Optimization

Reading10m
25

Final Assessment — Prompt Engineering Mastery

Quiz15m
←→navigate lessons
Chapter 1 of 5·Module 1 · Foundations of Prompt Engineering
Lesson 4 of 25Reading13 min

The Anatomy of a Great Prompt

#The Anatomy of a Great Prompt¶

Most production prompts share the same skeleton. Learn the skeleton once, reuse it forever.

The Six Components¶

┌─────────────────────────────────────────────┐ │ 1. Role / persona │ │ 2. Task / instruction │ │ 3. Context / input data │ │ 4. Constraints & rules │ │ 5. Output format specification │ │ 6. (Optional) Examples │ └─────────────────────────────────────────────┘

Weak Prompt ❌¶

"Tell me about this customer feedback."

Vague task, no role, no format, no constraints. The output is unpredictable and unusable by code.

Engineered Prompt ✅¶

text
21 lines
1You are a senior product analyst.            ← role
2
3Classify the customer feedback below and     ← task
4extract any feature requests.
5
6Feedback:                                     ← context
7"""
8The app is great but it crashes when I export
9to PDF, and I really wish it had dark mode.
10"""
11
12Rules:                                        ← constraints
13- Sentiment must be one of: positive, negative, mixed
14- Only list feature requests explicitly stated
15
16Respond as JSON:                              ← output format
17{
18  "sentiment": "...",
19  "bugs": ["..."],
20  "feature_requests": ["..."]
21}

This is testable, parseable, and reliable.

Principles That Always Apply¶

  1. 1Be specific. "Write a summary" → "Write a 3-sentence summary for a non-technical executive."
  2. 2Show, don't just tell. One good example beats a paragraph of description.
  3. 3Positive instructions beat negative ones. "Respond only in JSON" works better than "Don't add explanations."
  4. 4Separate data from instructions using delimiters (""", XML tags). Prevents the model from confusing input with commands — also a security boundary (Module 5).
  5. 5Specify the format explicitly. If code consumes the output, the format is part of the spec, not an afterthought.

A Reusable Template¶

text
15 lines
1You are {ROLE}.
2
3Your task: {ONE_SENTENCE_GOAL}
4
5Input:
6"""
7{DATA}
8"""
9
10Rules:
11- {RULE_1}
12- {RULE_2}
13
14Output format:
15{FORMAT_SPEC}

You will refine this template throughout the course.

Previous

Tokens, Context Windows, Temperature & Sampling

Next

Module 1 Knowledge Check

Use ← → arrow keys to navigate between lessons