Published: 2026-07-12
Deep dive

Claude Code + Clay: Automate Lead Gen & Cold Email With One Goal Prompt

Chapters / key moments (click to jump — plays here on the page)

Nate Herk uses Claude Code as the orchestrator and Clay as the data source to run cold outbound end-to-end from a single prompt. A Clay plugin exposes Clay's B2B data (find emails, enrich company/person, phone lookup) as MCP actions, and a /goal prompt then sources 50 HVAC leads, enriches them, and writes personalized subject lines and bodies — verifying its own work with sub-agents before delivering a ready-to-send CSV. The pitch: no new UI to learn, everything driven in natural language.

Source video

"Claude Code + Clay Makes Lead Generation Actually Fun" by Nate HerkWatch on YouTube →

Step-by-Step Breakdown

  1. Understand the split: Claude Code = tool problem, Clay = data problem

    Cold outbound has two hard parts — finding the right businesses with real, verified contact info, and juggling many different tools/tabs. Clay solves the data problem (its own dataset plus negotiated access to other providers, billed as credits); Claude Code solves the tool problem by driving Clay's endpoints for you so you never learn a new UI.

  2. Prep your context files first (the AI-operating-system prereq)

    Before running anything, give Claude Code a project folder with context about you: business profile, case studies, FAQs, proof, your offer, and your website copy. Without this, it can't write cold email that sounds like you and converts. In the demo the fake business is "Tradewind Automations," an AI-automation agency for home-service businesses.

  3. Sign up for Clay

    Go to clay.com, start a free trial, and create an account. You'll grab your API key / authorize the workspace later during the plugin connect step.

  4. Install the Clay plugin from the Claude Code terminal

    Open Claude Code in a terminal (VS Code's integrated terminal, PowerShell, etc.) with claude. You must add the marketplace from the terminal — not the desktop app or VS Code extension. Run /plugin, open the marketplace, choose "add a marketplace," paste the Clay marketplace link, then install "Clay: build with Clay and Claude Code." Once installed you can use the plugin anywhere, including the desktop app.

  5. Reload plugins and authenticate

    Run "reload plugins" when prompted, then just ask in natural language: "I just installed this Clay plugin, can you help me authenticate?" Claude Code loads Clay's own onboarding skill and returns an auth link — choose your workspace and hit authorize.

  6. Verify the connection

    Ask: "Check if you can use Clay and tell me what available actions and tools you have." It confirms the Clay MCP server is connected and lists actions — find emails, enrich a person or company, look up a phone, read/edit a table, validate a workflow. Each enrichment action costs Clay credits.

  7. Fire a /goal prompt with an end condition

    A /goal prompt sets a target and lets Claude keep working until it's met. Herk asks for 50 enriched HVAC / home-service leads aimed at decision-makers, each with a verified email, business pain points, recent signals, and notable achievements — plus a personalized subject line and body whose CTA is getting the recipient to say yes to a 90-second Loom. Instructions: don't stop until all 50 are done, verify accuracy with a dynamic workflow, and deliver a CSV with no blank columns.

  8. Watch the sub-agents fan out and self-verify

    The goal launched six sub-agents by city (Houston, San Antonio, Atlanta, Charlotte, Tampa, Las Vegas), each sourcing and enriching ~25 shops through the Clay plugin. They then aggregate, de-duplicate, check yield, and run verification passes — even a "debate" between agents over whether each subject line and body is actually good.

  9. Review results and real cost

    The heavily-verified run took about an hour and cost 172 Clay credits (~$12); a plainer "just find me 50 leads" run took ~5 minutes. The CSV includes business name, decision-maker, title, verified email + status, phone, website, city, Google rating, review count, pain points, recent signal, notable achievement, personalization hook, subject, and body.

  10. Import to Clay and launch the campaign

    Back in Clay: Import data → CSV → new table. Create a campaign, start from an empty message, and map the email subject and email body variables from your rows (preview shows the merged email per lead). If you have no sending accounts, buy domains right inside Clay — they're warmed for you and capped around 30 sends/day/account. Add follow-up steps 3+ days out.

Commands & Code Shown

claude

claude

Purpose: Launch Claude Code in a terminal (VS Code integrated terminal, PowerShell, or Command Prompt).

When to use: You must install the plugin marketplace from the terminal — the desktop app and VS Code extension can use plugins but can't add the marketplace.

/plugin (add marketplace → install)

/plugin
# → open marketplace
# → "add a marketplace" → paste the Clay marketplace link
# → install "Clay: build with Clay and Claude Code"
# then: reload plugins

Purpose: Add the Clay marketplace and install the plugin that exposes Clay's B2B data as MCP actions.

When to use: One-time setup before Claude Code can source or enrich leads through Clay.

/goal

/goal
# Set an end condition and let Claude Code keep working until it's met.
# Example: "50 enriched HVAC leads, all with verified email + personalized
# subject and body, no blank columns, delivered as a CSV. Do not stop until done."

Purpose: Define a target Claude Code works toward autonomously — launching sub-agents and running verification passes until the condition is satisfied.

When to use: Multi-step, verifiable outcomes (a full lead list, a QA'd dataset) where you want persistence and self-checking rather than a single response.

Common Errors & Fixes Covered

Error: the auth link is broken by terminal line-wrapping

Why it happens: When Claude Code prints the Clay authorization URL, the terminal can wrap it across lines, so clicking it opens a mangled link.

Fix: Copy the whole link manually and paste it into your browser — the full URL works even though the wrapped, clickable version doesn't.

Context files to give Claude Code (from the video)

Not a single file but the folder of context Herk loads so cold-email copy sounds like your business. Adapt to your project — replace with your real material.

project/
  business-profile.md   # who you are, what you sell, ICP
  case-studies.md       # results you can reference in copy
  faqs.md               # common objections and answers
  proof.md              # testimonials / metrics
  offer.md              # your exact offer and CTA
  website-copy.md       # voice / tone reference
  leads/                # CSV output lands here

Gotchas & Caveats

  • Best data ≠ guaranteed clients. Even with Clay's waterfall enrichment, conversion depends on Claude Code having strong context about your business to write copy that lands.
  • It costs real money. The verified 50-lead run used 172 Clay credits (~$12); heavy verification and rewriting is what drove both the cost and the ~1-hour runtime.
  • Long runs are the verification, not the sourcing. A plain "find 50 leads" pull took ~5 minutes. Build reusable skills around the flow and run big batches overnight.
  • Clay's MCP can't yet manage the full campaign. You still finish campaign sending and follow-ups inside Clay's UI (Herk expects broader MCP coverage soon).
  • Deliverability basics still apply. Warm your domains and keep sends around 30/day/account to avoid spam folders — Clay handles this if you buy accounts there.

Key Takeaways

  • Claude Code as orchestrator + Clay as the data layer means no new UI — you drive sourcing, enrichment, and copywriting entirely in natural language.
  • /goal prompts plus sub-agents turn "find 50 leads" into a parallel, self-verifying pipeline that de-dupes, checks yield, and even debates copy quality.
  • Context engineering is the real lever: load your business profile, case studies, offer, and voice before expecting good cold email.
  • The whole loop — source → enrich → personalize → CSV → Clay campaign with warmed domains — runs from one project and one prompt.

Weekly Digest — In Your Inbox

Get the week's top AI agent news, updates, and guides — every Friday.