Claude Prompt Examples

5 real-world prompt rewrites — coding, summarization, data extraction, writing, and classification. Each shows exactly what changed and why.

Code Review — target query: "review my python code"

Code Review Prompt Example

Before — weak
Review my Python code and tell me if there are any issues.
After — optimized for Claude
You are a senior Python engineer. Review the code below for: 1. Correctness — logic errors, off-by-one errors, incorrect assumptions 2. Performance — O(n²) loops that could use sets/dicts, unnecessary re-computation 3. Style — PEP 8 compliance, function length, naming conventions For each issue: quote the affected line, explain the problem, provide the fix. Tag severity: Critical (breaks functionality) / Major (degrades performance) / Minor (style). If the code is clean, say explicitly: "No issues found."

What changed:

  • Defined expert role
  • Listed 3 specific dimensions to check
  • Required line citation + fix
  • Severity tagging makes output actionable
  • Added explicit "no issues" fallback
Summarization — target query: "summarize this text"

Summarization Prompt Example

Before — weak
Summarize this document for me.
After — optimized for Claude
Summarize the document below for a VP of Engineering who hasn't read it. Format: - **TL;DR** (1 sentence, under 25 words) - **Key decisions made** (bullet list, max 5 items) - **Open questions / blockers** (bullet list, or "None" if absent) - **Recommended next step** (1 sentence) Do not include background context the executive already knows. Focus on what's new and what requires action.

What changed:

  • Defined the audience (VP of Engineering)
  • Specified exact output structure
  • Word/count limit on TL;DR prevents rambling
  • "Focus on what's new" cuts filler
  • Explicit fallback for empty sections
Data Extraction — target query: "extract data from this email"

Data Extraction Prompt Example

Before — weak
Extract the key information from this email.
After — optimized for Claude
Extract the following fields from the email below and return a JSON object. Schema: { "sender_name": string, "sender_email": string, "meeting_date": string (ISO 8601, e.g. "2026-05-14"), "meeting_time": string (24h format, e.g. "14:30"), "timezone": string (IANA tz name, e.g. "America/New_York"), "action_items": string[] (each item max 80 chars), "urgency": "high" | "medium" | "low" } Rules: Return null for any field not found. Never invent values. Output only the JSON object — no preamble, no explanation.

What changed:

  • Exact JSON schema with types
  • ISO 8601 / 24h format prevents ambiguity
  • Explicit null rule prevents hallucination
  • "Output only JSON" removes unwanted prose
Writing — target query: "write a blog post about AI agents"

Writing Prompt Example

Before — weak
Write a blog post about AI agents for developers.
After — optimized for Claude
Write a 700-word blog post for senior software engineers (5+ years experience) explaining how to build a production-ready AI agent using Claude's tool-use API. Structure: 1. Hook — one concrete failure mode of naive LLM apps (no tool use) 2. What tool use changes — 3 sentences max 3. Step-by-step implementation — code snippets in Python, each under 20 lines 4. Production gotchas — max 4 bullet points (rate limits, error handling, cost control, hallucination mitigation) 5. CTA — link to Claude API docs Tone: technical, direct, no hype. Assume reader has used the OpenAI API before.

What changed:

  • Audience defined precisely (senior engineers, OpenAI-familiar)
  • Word count specified
  • 5-part structure with constraints per section
  • Tone brief eliminates buzzwords
  • CTA is part of the spec, not an afterthought
Classification — target query: "categorize this customer feedback"

Classification Prompt Example

Before — weak
Categorize this customer support ticket.
After — optimized for Claude
Classify the customer support ticket below into exactly one primary category and one sub-category from the lists below. Primary categories: Billing | Technical Issue | Feature Request | Account Access | General Inquiry Sub-categories: Bug | Performance | UX | Pricing | Refund | Integration | Documentation | Other Also score urgency 1–5 (5 = service outage / revenue at risk, 1 = general question). Output only this JSON (no preamble): {"primary": "...", "sub": "...", "urgency": N, "one_line_summary": "..."}

What changed:

  • Closed vocabulary prevents invented categories
  • Primary + sub-category gives more signal
  • Numeric urgency scale is machine-parseable
  • one_line_summary extracts key context in one field
  • "No preamble" JSON-only output

Why These Techniques Work on Claude

Claude responds particularly well to:

  • Explicit output schemas — JSON with typed fields produces structured, machine-parseable output every time
  • Numbered instructions — Claude follows numbered lists more reliably than paragraphs
  • Hard constraints — "never invent values", "output only the JSON", "no preamble" — Claude respects these
  • Role framing — "You are a senior Python engineer" anchors tone, vocabulary, and depth without over-specifying
  • Explicit fallbacks — "If no issues found, say: No issues found" prevents the model from inventing problems to sound useful
→ Auto-improve my prompt free

Frequently Asked Questions

What makes a good Claude prompt?
A strong Claude prompt has four elements: (1) a clear role or persona ("You are a senior Python engineer"), (2) a specific task with explicit scope, (3) an output format specification (JSON, markdown, plain text, word count), and (4) at least one constraint that prevents common failure modes ("do not add preamble", "never invent citations"). Claude responds especially well to structured prompts with explicit instructions — vague one-liners produce inconsistent results.
How is prompting Claude different from prompting ChatGPT?
Claude and ChatGPT respond to the same core techniques (role framing, few-shot examples, output format spec), but Claude handles longer context better (200K token context window) and is more willing to follow strict constraints like "output only raw JSON, no markdown fences". Claude also responds well to explicit ethical framing — if you explain *why* a task matters, it tends to produce more thoughtful responses. ChatGPT is sometimes more tolerant of ambiguous prompts; Claude rewards clarity.
What are the best Claude prompts for coding?
The highest-performing coding prompts for Claude include: (1) Code review with severity tags — "Review for correctness, performance, and style. Tag each issue Critical/Major/Minor and suggest the fix." (2) Test generation — "Write pytest unit tests covering the happy path, 3 edge cases, and error paths. Use descriptive names." (3) Refactor with constraints — "Refactor to reduce cyclomatic complexity below 5. Preserve all public API signatures." Claude excels at following explicit, measurable constraints.
Can I use Claude prompts with the Claude API?
Yes. All prompts on this page work with the Claude API (claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5). Shorter, constraint-heavy prompts work best with Haiku (cheapest). Complex reasoning tasks and long-context work benefit from Sonnet or Opus. Use the Prompt Improver tool on this site to auto-optimize any draft prompt before putting it in production.
How do I improve my Claude prompts automatically?
Paste your draft prompt into the Prompt Improver tool on this site. It sends your prompt to Claude with a meta-instruction to diagnose every weakness (vague task, missing output format, ambiguous constraints) and produce an improved version with a changelog. Each call costs ~$0.002 in API credits. No account or subscription required — BYO Anthropic API key.

Stop guessing. Auto-improve your Claude prompts in 10 seconds.

Paste any prompt → get an expert rewrite + changelog. Free, BYO API key.

→ Improve My Prompt
🔥 Tonight: Claude Code Power Prompts · £5 £3 first 10Get PDF →