2.1 — Prompt Engineering
Phase 1 introduced prompting basics — be specific, give context, describe done. This section goes deeper: five techniques that separate consistent results from lucky ones.
Five Advanced Techniques
Section titled “Five Advanced Techniques”Constraint Setting
Section titled “Constraint Setting”Telling the AI what NOT to do is often more powerful than what to do.
“Do not add features I didn’t ask for. Do not refactor existing code. Only change what’s needed for this bug fix.”
Constraints prevent the AI from being “helpful” in ways you didn’t ask for — adding features, restructuring code, or rewriting things that were working fine.
Role Framing
Section titled “Role Framing”Give the AI a role to anchor its behavior and perspective.
“You are a senior frontend developer reviewing my code for accessibility issues.”
Role framing shapes how the AI interprets your request. The same question asked of “a beginner tutor” vs. “a senior engineer” produces very different answers.
Chain of Thought
Section titled “Chain of Thought”Ask the AI to reason step by step before answering.
“Before writing any code, explain your approach. What files will you change and why?”
This catches misunderstandings before they turn into 200 lines of wrong code. If the plan is off, you correct it in one sentence — not after a full implementation.
Few-Shot Examples
Section titled “Few-Shot Examples”Show the AI examples of what you want before asking it to produce.
“Here are three commit messages I like: [examples]. Write the next one in the same style.”
Few-shot works for style, format, tone, and structure. The AI pattern-matches to your examples far more reliably than it follows abstract descriptions.
Decomposition
Section titled “Decomposition”Break large tasks into smaller, verifiable steps instead of one giant prompt.
| Weak | Strong |
|---|---|
| ”Build me a full e-commerce site" | "First, create the product listing page. Just that. We’ll add cart functionality next.” |
Every task you can verify independently is a checkpoint. If something breaks, you know exactly where — not somewhere in 500 lines of AI output.
Key Insight
Section titled “Key Insight”The quality of your output is directly proportional to the quality of your input. Garbage prompt = garbage result. This is a skill, not a talent.
Prompt engineering is not about magic words. It is about giving the AI the right information, the right role, the right constraints, and the right examples — then verifying before building on the result.
Recommended Resource
Section titled “Recommended Resource”Amanda Askell (Anthropic prompt engineering lead) — her guidance in the Anthropic documentation is the authoritative reference for prompting Claude effectively. She leads the team that literally defines how Claude should be talked to.
Next: 2.2 — Context Engineering | Phase overview: Phase 2