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
4

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

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 2 of 5·Module 2 · Core Prompting Techniques
Lesson 8 of 25Reading11 min

Instruction Clarity, Delimiters & Decomposition

#Instruction Clarity, Delimiters & Decomposition¶

Ambiguity is the #1 cause of bad outputs. This lesson is about removing it.

1. Separate Instructions From Data¶

Always fence user/input data with delimiters. This prevents the model from interpreting data as instructions and is a real security boundary (prompt injection — Module 5).

text
5 lines
1Summarise the text between the triple quotes in one sentence.
2
3"""
4{user_text}
5"""

Good delimiters: triple quotes """, XML-style tags <doc>...</doc>, or Markdown fences. XML tags are especially robust because the model rarely confuses them with content.

text
5 lines
1<article>
2{article}
3</article>
4
5<task>Extract every named person as a JSON array.</task>

2. Be Specific and Measurable¶

VagueSpecific
"Make it short""Maximum 50 words"
"Be professional""Formal tone, no contractions, no emojis"
"List the key points""List exactly 3 bullet points, each ≤ 12 words"

3. Prefer Positive Instructions¶

Models follow "do X" better than "don't do Y".

  • ❌ "Don't be verbose."
  • ✅ "Respond in at most 3 sentences."

4. Decompose Complex Tasks¶

If a task has multiple steps, enumerate them. The model is far more reliable following an explicit procedure than inferring one.

text
5 lines
1Do the following, in order:
21. Identify the programming language of the snippet.
32. List any bugs you find.
43. Provide a corrected version.
54. Output as JSON with keys: language, bugs, fixed_code.

For very complex workflows, split into multiple prompts/chained calls — one job per call is more reliable than one mega-prompt (you'll formalise this as prompt chaining in Module 4).

5. Tell It What To Do When Unsure¶

text
2 lines
1If the answer is not present in the provided text,
2respond exactly with: "NOT_FOUND". Do not guess.

This single line dramatically reduces hallucination in extraction tasks.

Checklist: Is the task one sentence? Is data fenced? Are constraints measurable? Is there a fallback for "unknown"? If yes to all — ship it.

Previous

Role & Persona Prompting

Next

Controlling the Output Format

Use ← → arrow keys to navigate between lessons