Advanced Prompt Engineering for Claude
The 7 techniques that separate 10x users โ with a full end-to-end walkthrough
The Prompting Gap
Most prompts fail for the same reasons: vague asks with no context, no format instructions, no examples of good output. The gap between a weak and strong prompt isn't skill โ it's structure. This lesson gives you the complete toolkit, plus a real walkthrough of a prompt going from bad to excellent.
1. XML Tags โ Claude's Native Language
Claude was trained on XML-tagged data. It gives structured tags special attention and uses them to separate distinct parts of complex prompts cleanly.
<context> I am a product manager at a B2B SaaS company. We sell to mid-market HR teams. Our biggest competitor just released AI-powered performance reviews โ a feature we've been planning but haven't shipped. </context> <task> Analyze this competitive threat and recommend a response strategy. </task> <constraints> - 3-6 month execution timeline - 2 available engineers, no new hires - No features requiring more than 4 weeks of engineering time - Our brand positioning is "human-centered HR" โ avoid AI-first messaging </constraints> <format> 1. Threat assessment (1 paragraph, honest evaluation) 2. Three strategic options with pros/cons table 3. Your recommendation with rationale 4. The one metric that tells us if we're winning in 90 days </format>
<context> <task> <constraints> <format> <example> <document> <data> <persona>2. Extended Thinking โ Make Claude Reason Out Loud
For hard problems, you want Claude to think first, not just react. Trigger deep reasoning with specific phrases:
- "Think step by step before answering."
- "Before responding, reason through this carefully and consider edge cases."
- "Walk me through your reasoning, then give your final recommendation."
Q: Should we charge monthly or annually as our default plan? A: Annual billing is generally better for SaaS โ higher LTV, lower churn, better cash flow. Offer a discount for annual.
Let me reason through this: Annual default pros: 12-month LTV upfront, dramatically lower churn (can't impulse cancel), better cash flow for ops and fundraising, simplifies support (fewer billing questions). Annual default cons: Higher upfront commitment raises trial-to-paid friction. If your ACV is $500+, this matters less. If it's $20/month, an $240 annual commitment can kill conversion. Monthly default pros: Lower barrier to start, easier to upsell mid-year, better for low-price high-volume products. Edge case I should flag: What's your sales-assist vs self-serve ratio? If >50% sales-assisted, annual is almost always correct โ reps can handle objections and the deal economics work better. If fully self-serve with a $15-50/month price point, monthly default with a 2-month free annual incentive often converts better. My recommendation: Default annual IF your ACV is over $200/year or you have any sales-assist. Default monthly if self-serve under $15/month. What's your ACV and sales model?
The second response identified an edge case and asked a clarifying question the first one missed entirely.
thinking parameter with a token budget (e.g., 10,000 tokens) to get structured reasoning in a separate block before the final response.3. Few-Shot Examples โ Show, Don't Tell
Instead of describing what you want, show Claude 2โ5 examples. This is the fastest way to control tone, format, and style โ especially for repeated tasks like summarization, classification, or writing in your voice.
<example> Input: Q3 revenue was $2.1M, up from $1.8M in Q2. Output: Revenue grew 16.7% QoQ to $2.1M โ strong momentum heading into Q4. </example> <example> Input: Churn increased from 3.2% to 4.8% in August. Output: Churn spiked +50% in August to 4.8% โ investigate root cause immediately, this is approaching the threshold where it compounds. </example> <example> Input: NPS score moved from 34 to 41 after the new onboarding. Output: NPS jumped +7 points to 41 post-onboarding revamp โ early signal the investment is working. Track if this holds at 90-day cohort. </example> Now write a metric summary for: DAU dropped from 12,400 to 10,800 in the last 7 days.
4. Role Prompting โ Be Specific
Generic roles give generic results. The more precisely you define the role, the more expert and calibrated the output.
"You are a marketing expert."
"You are a B2B SaaS growth marketer with 12 years of experience, specializing in product-led growth at companies scaling from $1M to $20M ARR. You've run 150+ A/B tests on pricing pages and onboarding flows. You are direct, data-driven, and have no patience for vanity metrics."
The specific role activates more relevant knowledge and filters out generic advice that wouldn't apply to your situation.
5. Output Format Control
Always specify the exact format you want. Claude follows format instructions very precisely โ use this to get output that's immediately usable:
- JSON: "Respond as a JSON object with keys:
title(string),summary(string, max 80 words),action_items(array of strings),priority(high|medium|low)" - Markdown table: "Respond in a markdown table with columns: Option | Pros | Cons | Effort (1โ5) | Recommended"
- Length-constrained doc: "Use H2 headings for each section. Each section max 100 words. End with a TL;DR of exactly 2 sentences."
- Bullet format: "Format as: [emoji] [one-sentence finding]. No sub-bullets. Max 7 bullets total."
6. Negative Constraints
Claude has trained defaults that are helpful for general users but annoying for power users. Explicitly prohibit them:
- "Do not add caveats, disclaimers, or qualifications to your answer."
- "Do not repeat my question back to me."
- "Do not suggest I consult a professional โ just give me the answer."
- "Do not use phrases like 'Certainly!', 'Great question!', or 'Of course!'."
- "Do not give me a list of options โ give me your single best recommendation."
- "Do not pad the response. Say it in as few words as possible."
7. Assistant Prefill
In the API, you can pre-fill Claude's response. Claude continues from exactly where you left off โ perfect for forcing specific output formats or skipping preambles:
// API only โ forces Claude to start mid-sentence
messages: [
{ role: "user", content: "Analyze our Q3 performance." },
{ role: "assistant", content: "## Q3 Performance Analysis
**Revenue:**" }
]
// Claude continues from "Revenue:" โ no preamble, straight to contentEnd-to-End: Prompt Evolution Walkthrough
Here's a real prompt going through 3 iterations from weak to excellent. The task: write a cold email to a VP of Engineering.
Prompt: Write a cold email to a VP of Engineering about our developer tool. Output: "Hi [Name], I hope this email finds you well. I wanted to reach out to introduce our developer tool that helps engineering teams be more productive..." Problem: Generic, boring, no personalization, no clear value prop.
Prompt: You are an experienced B2B SaaS sales rep. Write a cold email to a VP of Engineering at a 200-person fintech company. We sell a code review automation tool that saves senior engineers 4 hours/week on PR reviews. Output: Better โ mentions the specific pain point (PR review time), mentions fintech. But still too long, and opens with "I hope..." Problem: Still using email clichรฉs. Doesn't respect the recipient's time.
<persona> You are a B2B SaaS AE with 8 years of experience selling developer tools. You've closed deals at Stripe, Plaid, and Robinhood. You write emails like a human, not a sales robot. </persona> <context> Product: automated code review tool. Saves senior engineers 4 hours/week on PR reviews. Integration: GitHub, GitLab. Pricing: $25/dev/month. Target: VP Engineering at a 150-200 person fintech startup. </context> <task> Write a cold email that gets a reply. </task> <constraints> - Under 75 words total - No "I hope this finds you well" or similar openers - No feature lists โ one specific value, one specific pain - Call to action: 15-minute call, not a demo - First line must reference something specific about fintech engineering </constraints> Output: "Fintech PR review backlogs are brutal โ compliance requirements mean every line needs scrutiny, but your senior engineers are spending 4+ hours/week just on reviews. We automated that at [similar company]. Senior engineers got those hours back. Worth a 15-minute call to see if it's relevant for your team? [Name]" Much better: specific, short, one pain point, human tone, low-friction CTA.
Hands-On Exercise (~30 min)
Build a Power Prompt Template for your most common recurring task, using the 3-iteration approach:
Run it. Note what's wrong with the output.
Add <context>, <task>, <constraints>. Run it. What improved? What's still wrong?
Specify the exact output format. Add "do not" rules for the remaining problems. Run it. Save the final version โ this is your reusable template.
Structure prompts with <context>, <task>, <format>, <constraints>. Claude gives these special attention from training.
Add 'Think step by step before answering.' Claude reasons through tradeoffs and edge cases before giving a final answer.
Show 2โ5 examples of ideal output. Fastest way to control tone, format, and style for recurring tasks.
Specific domain + years + specialty > generic role. 'B2B SaaS growth marketer, PLG focus, $1M-$20M ARR' >> 'marketing expert'.
List what NOT to do: no caveats, no repeating the question, no hedging, no filler phrases. Kills bad defaults fast.
Almost no prompt is perfect first try. Plan for 3 iterations: write โ identify what's wrong โ add structure โ repeat.