---
name: learned-claude-code-prompting-framework
description: Use when writing prompts for Claude Code or agentic tasks to raise first-pass output quality. Provides a 4-part prompt structure (role, context, negative, verification) plus a self-verification pattern.
---
# Claude Code Prompting Framework (Role + Context + Negative + Verify)

When crafting a prompt for Claude Code or any agent task, always include these four levers. From Nate Herk's 'Claude Code for Normal People' course.

## 1. Role
Tell the agent who it is and what it does.
- Example: "You are a master content strategist and data analyst."

## 2. Context & Background
Give both general background AND task-specific context. Generic prompts get generic output — the private, non-public context (your business, priorities, metrics, avatar, history) is what makes output unique.
- Weak: "Help me write this email to my boss."
- Strong: "Help me write this email to my boss. Tread lightly — I've gotten in trouble twice this month. I'm asking for more time off. He's understanding but I feel guilty asking, so keep the tone respectful and light."
- For work tasks, drop in real files/data: product details, calendar, copy that worked, copy that flopped.
- Analogy: treat the AI like a summer intern — onboard it before expecting good work.

## 3. Negative Prompt (what NOT to do)
Explicitly state guardrails. Like a curious student, the agent will try things unless told not to.
- Example: "Do NOT invent statistics. Do NOT change the tone to sound corporate. Do NOT touch files outside the /brand-assets folder."

## 4. Verification — MAKE THE AI PROVE ITS WORK
The biggest quality lever. Ask yourself: "If a human handed me this, what would I do to approve it?" Then instruct Claude to do exactly that.
- Build a website form? "Open the site and test the form submission 100 times, including bad emails without an @domain. Fix any bug you find, then re-test. Report what you ran and why you're confident."
- Data task? "Take screenshots to verify the numbers match the source before finalizing."
- Self-verification raises first-pass quality from ~60% to ~80%, cutting the number of manual feedback loops you have to run.

## Choosing agent vs simple workflow (before you even prompt)
- Deterministic if/then task (same input → same output, e.g. 'every 9am pull Stripe revenue, post to Slack') = simple workflow/script. Cheap, reliable, no AI needed.
- Messy input needing reasoning/generation (e.g. 'read customer emails, understand intent, draft tailored replies') = use an AI agent.
- Default to the simplest thing that gets the job done.

## Cost awareness
Output tokens cost ~5x input tokens. Use cheaper models (Haiku) for fast/simple jobs, balanced (Sonnet) for most, expensive (Opus) only when deep reasoning is required.

Source: https://www.youtube.com/watch?v=jdbOVepEtUE