Module · 8 lessons

Prompt Engineering

Write prompts that get reliable, well-shaped answers — prompt anatomy, sharpening techniques, few-shot, structured outputs, and evaluation.

At a glance

Level
Intermediate
Lessons
8 lessons
Time to complete
1–2 weeks
Cost
Free forever · no sign-up

Welcome to Prompt Engineering, the second module of the Generative AI & LLM Engineering course. In the last module you learned to call a language model. Now you’ll learn to get it to do what you actually want — reliably, in the right format, at the right level of detail. This is the single highest-leverage skill in all of LLM work: the difference between a vague prompt and a well-built one is the difference between a toy and a tool.

You’ll start with the anatomy of a strong prompt — the handful of elements that turn a wish into an instruction — and the bad → better → best habit of sharpening. From there you’ll add few-shot examples and roles, then learn to get structured JSON output you can trust instead of free-form prose. You’ll apply all of it to real data tasks — extraction, classification, and summarization — and finish by learning to evaluate prompts objectively and reduce hallucinations and unsafe output. The capstone ties it together into a reusable prompt toolkit.

Every technique is demonstrated with real, runnable calls against the inexpensive claude-haiku-4-5 model, so you can see exactly how each change to a prompt changes the answer. By the end you’ll write prompts deliberately — knowing why each line is there.

Start with Lesson 1, where you’ll dissect what actually makes a prompt work.

Lessons in this module

1 The Anatomy of a Strong Prompt Learn the handful of elements that turn a vague request into a precise instruction — role, task, context, audience, format, and constraints. 2 Sharpening Techniques Six concrete techniques that turn a decent prompt into a precise one — specificity, positive instructions, format control, delimiters, ordering, and decomposition — each shown with real before-and-after model output. 3 Few-Shot Prompting and Roles When describing a task isn't enough, show the model examples — and give it a role. Learn few-shot prompting and persona prompting on real model output. 4 Structured Outputs You Can Trust Stop parsing free-form text. Define the exact shape you want and get guaranteed-valid JSON back from the model, then load it into a Python dict and use the fields. 5 Prompting for Data Tasks Use prompts to do real data work — extract structured fields, classify text into a fixed label set, and write constrained summaries, then run the same prompt over a batch. 6 Evaluating and Improving Prompts Stop eyeballing prompts. Build a tiny labelled test set, score two prompt versions automatically, and use an LLM as a judge for open-ended output. 7 Reducing Hallucinations and Unsafe Output Stop a model from inventing facts by grounding it in supplied context, demanding evidence, constraining its scope, and defending against prompt injection. 8 Guided Project: A Reusable Prompt Toolkit Bake the anatomy and techniques from this module into clean, parameterized functions — a small prompt-toolkit module you can reuse instead of writing one-off prompts.
Achievement

Complete all 8 lessons to finish the Prompt Engineering module.

Start module