Beginner

Prompt Engineering Fundamentals

Learn Anthropic's documented prompt engineering techniques — clear instructions, multishot examples, chain-of-thought, and XML structuring — by writing and testing prompts directly against the Claude API.

~2.5h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: Python 3.9+, an Anthropic API key from console.anthropic.com, and basic familiarity with running Python scripts.

Prompt engineering is the fastest, cheapest way to improve an LLM's output — faster and cheaper than fine-tuning, and it works across model updates without retraining. In this project you'll write a small Python test harness, then apply four of Anthropic's core documented techniques to the same task (categorizing customer feedback) and observe the difference each one makes: being clear and direct, using multishot examples, encouraging step-by-step reasoning, and using XML tags to structure input and output.

Everything here follows Anthropic's official prompt engineering documentation rather than generic prompting folklore — Anthropic's docs are explicit that tricks aimed at bypassing model behavior tend to stop working as models evolve, so the techniques below are the straightforward, durable ones.

🔨

Set up the API and your test harness

🔨

Technique 1: Be clear, explicit, and direct

🔨

Technique 2: Multishot examples

🔨

Technique 3: Chain-of-thought with XML tags

🎯
Secret Mission

Secret Mission: Build an evaluatable prompt suite

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock