Prompt Engineering for Claude
The art and science of getting exactly what you want from Claude. Learn the prompting techniques that separate mediocre results from exceptional ones.
Same AI, wildly different results
Two people ask Claude to help with a marketing email. Person A types: "Write a marketing email." Person B types: "You're a senior email marketer at a DTC skincare brand. Write a re-engagement email for customers who haven't purchased in 90 days. Tone: warm but direct. Include a 15% discount code. Keep it under 150 words. Subject line should create urgency without being spammy."
Person A gets a generic email template. Person B gets a polished, ready-to-send email. Same AI. The only difference? The prompt.
The anatomy of a great prompt
Every effective Claude prompt has these building blocks:
1. Role — Who Claude should be ("You are a senior data analyst")
2. Context — Background information ("I'm presenting to the board next Tuesday")
3. Task — What to do specifically ("Summarize these metrics into 3 key takeaways")
4. Format — How to structure output ("Use bullet points with one sentence each")
5. Constraints — Boundaries and rules ("Keep it under 200 words, no jargon")
6. Examples — What good looks like ("Here's a summary I liked from last quarter...")
You don't need all six every time. But the more you include, the better the output:
| Block | Example | Impact |
|---|---|---|
| Role | "You are a senior data analyst" | Sets expertise level and perspective |
| Context | "I'm presenting to the board next Tuesday" | Shapes relevance and tone |
| Task | "Create a 5-slide outline with key metrics" | Defines the deliverable |
| Format | "Use bullet points, max 3 per slide" | Controls structure |
| Constraints | "No jargon — the board isn't technical" | Sets boundaries |
| Examples | "Like this slide from last quarter: [paste]" | Anchors quality |
Technique 1: Be specific, not vague
The single biggest improvement you can make:
✗ Without AI
- ✗Summarize this article
- ✗Help me with my code
- ✗Write a blog post
- ✗Analyze this data
✓ With AI
- ✓Summarize this article in 3 bullet points, each under 20 words, focusing on the business implications
- ✓Find the bug in this Python function that causes it to return None for empty lists instead of raising a ValueError
- ✓Write a 600-word blog post for beginner JavaScript developers about closures, using the analogy of a backpack
- ✓Analyze this CSV of monthly sales data. Identify the top 3 trends, flag any anomalies, and recommend 2 actions
Transform a vague prompt
25 XPTechnique 2: Give Claude a role
Starting with a role isn't just decoration — it fundamentally changes how Claude approaches the task:
You are a veteran startup CTO who has scaled three companies from
seed to Series C. You value pragmatic engineering decisions over
theoretical perfection. You've seen what works and what fails at scale.
Review my system architecture and tell me what will break first
when we go from 1,000 to 100,000 users.
The role sets:
- Expertise level — a CTO thinks differently from a junior developer
- Perspective — focuses on scaling, not academic correctness
- Communication style — direct, battle-tested advice
Technique 3: Use examples (few-shot prompting)
Showing Claude what you want is often more effective than describing it:
Convert these product descriptions into punchy one-liners for social media.
Input: "Our noise-cancelling headphones feature 40-hour battery life,
premium drivers, and adaptive EQ technology."
Output: "40 hours of silence. Your commute just became your sanctuary. 🎧"
Input: "Our ergonomic office chair has lumbar support, breathable mesh,
and 12 adjustable settings."
Output: "Your back called. It wants the chair with 12 ways to say 'thank you.' 🪑"
Now do these:
Input: "Our smart water bottle tracks hydration, glows to remind you
to drink, and keeps water cold for 24 hours."
By providing 2-3 examples, you've defined the tone, length, format, and creative style — all without explicitly stating any rules.
Technique 4: Chain of thought — "think step by step"
For complex reasoning tasks, asking Claude to show its work dramatically improves accuracy:
✗ Without AI
- ✗Is this a good investment? The company has $2M revenue, 40% margins, and is asking for a $20M valuation.
✓ With AI
- ✓I'm evaluating a startup investment. Think through this step by step:\n1. Analyze the financial metrics\n2. Compare to industry benchmarks\n3. Identify red flags and positive signals\n4. Give me your recommendation with reasoning\n\nThe company has $2M revenue, 40% margins, $20M valuation ask.
The step-by-step version forces Claude to reason through each part rather than jumping to a conclusion. This matters most for:
- Mathematical or logical problems
- Multi-factor decisions
- Tasks where the answer depends on intermediate analysis
Technique 5: Structured output
Tell Claude exactly how to format the response:
Analyze this customer feedback and return your analysis in this exact format:
**Sentiment**: [Positive/Negative/Mixed]
**Key themes** (bulleted list, max 5):
- theme 1
- theme 2
**Urgent issues** (numbered, with severity 1-5):
1. [Severity X] Issue description
**Recommended actions** (prioritized):
1. Action — Expected impact — Effort level
This works because Claude follows formatting instructions precisely. You get structured, consistent output every time.
Design a structured output template
50 XPTechnique 6: Iterative refinement
Your first prompt rarely produces the perfect result. The skill is in the follow-ups:
Start broad: "Draft a project proposal for migrating our database to PostgreSQL."
Refine scope: "Good start. Make the timeline more conservative — we have a small team. And add a risk section."
Adjust tone: "Too formal. Make it sound like a confident recommendation, not a request for permission."
Polish details: "The cost estimates are too round. Use specific numbers based on AWS RDS pricing for db.r6g.xlarge instances."
Each follow-up makes the output closer to what you actually need. Don't try to get everything perfect in one prompt — iterate.
There Are No Dumb Questions
How long should a prompt be?
As long as it needs to be. A simple task might need one sentence. A complex task might need a full paragraph of context plus examples. There's no penalty for longer prompts — Claude handles them well. But don't add fluff — every word should carry information.
Should I be polite to Claude?
It doesn't affect output quality. "Please" and "thank you" are fine if that's your style, but they don't make Claude try harder. What matters is clarity, not politeness.
What if Claude's response is way off?
Don't start over — tell Claude what's wrong. "That's not what I meant. I need X instead of Y. Here's why..." Claude adjusts well to correction and often produces a much better result on the second try.
Technique 7: System prompts and custom instructions
When using Claude's API or Projects, you can set a system prompt — persistent instructions that shape every response:
System prompt:
You are a senior technical writer at a developer tools company.
Your writing style: clear, concise, no jargon unless necessary.
Always include code examples for technical concepts.
Format: Use H2 headers, short paragraphs (max 3 sentences), and
bullet points for lists.
Never say "simply" or "just" — nothing is simple to a beginner.
This is incredibly powerful because it:
- Eliminates repetitive instructions
- Ensures consistent output across conversations
- Sets the baseline so your individual prompts can focus on the task
Anti-patterns: what NOT to do
✗ Without AI
- ✗Ask one vague question and expect perfection
- ✗Paste 10,000 words with no instructions
- ✗Say 'make it better' without specifics
- ✗Start a new chat for every follow-up
- ✗Assume Claude knows your context
✓ With AI
- ✓Give context, then iterate on the result
- ✓Tell Claude what to focus on in the document
- ✓Say 'make the tone more conversational and cut the length by 30%'
- ✓Continue the conversation — Claude remembers everything
- ✓Explain who you are, what you need, and why
Knowledge Check
1.What is the most impactful single improvement you can make to a prompt?
2.What is 'few-shot prompting'?
3.When should you use 'think step by step' in a prompt?
4.What should you do when Claude's first response is wrong or off-target?