By the end, you can write prompts that work inside a real app. You will split a prompt into clear parts and keep user data apart from your rules. You will get data back in a shape your code can trust. You will also chain prompts, route requests and cache a long prompt to cut its cost.
There are 14 short notebooks. Each one starts with a problem, then shows the fix.
- Developers who call a model from code and need answers they can parse.
- Technical product managers who write, review or test prompts for a feature.
- Anyone who has typed into a chat box and wants the same skill in code.
Not for you if you have never run a Python cell, or if you want to train or fine-tune a model. This workshop only changes the words you send.
- uv. It installs Python 3.11 and every package for you.
makeandgit.- An Anthropic API key from the Claude Console. To use another provider, see Switch provider.
- Each notebook makes a few small calls. A run stops once it spends $1. Set
SPEND_CAP_USDin.envto change that.
- Clone the repo and set it up.
git clone https://github.com/learnwithparam/practical-prompt-engineering-workshop.git
cd practical-prompt-engineering-workshop
make setupExpect: Created .env. Paste your ANTHROPIC_API_KEY into it., then Ready. Next: make run.
- Open
.envand paste your key afterANTHROPIC_API_KEY=.
Expect: the line reads ANTHROPIC_API_KEY=sk-ant-... with your own key. Git never sees this file.
- Run the offline check. It needs no key.
make checkExpect: check: 0 problems.
- Start JupyterLab.
make runExpect: a link that starts with http://localhost:8888/lab. Open it in your browser.
- Open
01-basic-prompting.ipynband run the cells from the top.
Expect: the first cell prints Ready to plan trips with: and a model name. The next cell prints a trip plan. If the key is missing, it stops with No key found. Run: cp env.example .env then paste your key into it.
- Optional: run it in Docker instead of step 4.
make upExpect: Running at http://localhost:8888. Run make down to stop it.
Every lesson builds a prompt from a few parts. It sends the prompt with llm.chat. The reply holds plain text, or checked data when you pass a schema.
flowchart LR
Cell[Notebook cell] -- prompt, system, schema --> Chat[llm.chat in llm.py]
Env[.env with key and model] --> Chat
Chat -- LiteLLM --> Model[Claude or another provider]
Model --> Reply[Reply: text, data, cached_tokens]
Reply --> Cell
llm.py is the only file that talks to a model. It reads .env, picks the model, sends the request and counts the cost.
A real run from notebook 05. Asking for JSON in words breaks the code, and a schema fixes it.
| # | Notebook | What you build |
|---|---|---|
| 01 | The Basics of Prompting | A Napa Valley trip planner with context, task and format |
| 02 | Being Clear and Direct | Short answers with no fluff, and a forced choice |
| 03 | Roles and Personas | A grumpy student, a logic expert and a strict math teacher |
| 04 | Separate Data from Instructions | A safer email rewriter that keeps user text in tags |
| 05 | Formatting Output | Haikus in tags, then as checked data with schema= |
| 06 | Chain of Thought (Reasoning) | A riddle solver that shows its steps |
| 07 | Teaching by Example (Few-Shot) | A parent bot and an email sorter taught by examples |
| 08 | Avoiding Hallucinations | A question bot that says "I don't know" and quotes its proof |
| 09 | Building Complex Prompts | TravelBot, a game referee, and a cached rule book |
| 10 | Building Workflows (Chaining) | A self-check step and a story editor pipeline |
| 11 | Complex Structured Output | A Green Bites order reader with nested schemas |
| 12 | Routing and Orchestration | A hotel assistant that routes guests to experts |
| 13 | Reflection and Iterative Refinement | A restaurant review that a writer drafts and an editor fixes |
| 14 | Prompt Optimization (Metaprompting) | A helper that rewrites lazy prompts into strong ones |
The notebooks use Claude Haiku (anthropic/claude-haiku-5-5) by default. To use another model, set two lines in .env: the model id and that provider's key. For example:
LITELLM_MODEL=gemini/<model id>
GEMINI_API_KEY=your-keyenv.example lists more providers. Any model id that LiteLLM knows will work for the plain text lessons.
Two lessons need more from the model. Chapters 5 and 11 pass schema=, so the model must support structured output. Chapter 9 marks a block with cache_control. Other providers cache in their own way, so cached_tokens may stay at 0 there.
Take the free course built on these notebooks: Prompt Engineering Crash Course.
