← All posts

How I Built an AI Lead Generation Engine With Claude Code and Clay

TL;DR: I built a lead generation engine using Claude Code and Clay, without writing a line of code. The system sourced companies matching a specific profile, found the right person at each one (not just any contact, the person who could actually act), verified every email, and wrote short personalized outreach based on what each person had posted on LinkedIn that same day, not a funding round from months ago. Everything was staged for my review before anything went out. This is the exact workflow, and a template you can copy into your own Claude Code setup.

The old way of lead generation was the problem

Most cold outreach fails for a simple reason: it is not actually about the person receiving it. A list gets bought or scraped, a template gets written once, and the same paragraph goes out to five hundred people with a first name swapped in. The reply rate reflects that. Everyone can tell.

The alternative used to be manual research: open LinkedIn, read the person’s profile, find something to mention, write the email, repeat five hundred times. That works, but it does not scale, and most people give up around lead forty.

The fix was not a better template. It was building a system that did the actual research, person by person, and handed me a finished draft for every single one, in my own voice, based on something true and current.

The six-step workflow

Step 1: Define the target profile in plain language. I described the company profile I wanted (industry, size, location, funding stage) and the type of contact who should receive the outreach. Claude Code turned that into structured search filters and ran them against Clay’s company and people data.

Step 2: Get specific about who the actual contact should be. While defining the target profile, I named the exact decision maker or role that needed to be found at each company, whether that was a founder, a department head, or whoever owned the relevant budget. The more specific that definition, the sharper the results Clay returned.

Step 3: Enrich and verify, then drop what does not resolve. Every contact got run through Clay’s enrichment to find a verified email. When Clay could not resolve one, I did not fall back to a guess. I flagged it for manual follow-up and moved on, because a bounced email damages a domain’s sending reputation for everyone after it.

Step 4: Pull the most recent signal, not the last press release. This was the part that actually made the outreach land. General web research kept surfacing funding announcements from eight months ago, which reads as stale the moment someone opens the email. What worked was pulling each contact’s actual LinkedIn activity, both their personal profile and their company page, filtered to the last two weeks. Neither a browser session nor Clay’s own research feature could reliably do this, since LinkedIn blocks unauthenticated browsing and generic AI research tools return old podcast mentions with no dates attached. A dedicated scraping actor solved it in seconds, and most contacts had posted something within the last day.

Step 5: Write from that signal, in a fixed voice. Each email opened with something specific from that recent post, ran under a hundred words, and followed a fixed set of style rules: no hedging, no filler, a direct and time-bound call to action. The rules lived in a separate file so every draft matched them without me repeating myself.

Step 6: Export the batch and run the campaign from Clay. The finished batch went into a CSV with the contact, the subject line, the body, and the exact source (a link to the actual post) for every claim. That CSV imports directly into Clay, where sending, sequencing, and reply tracking for the whole campaign happen from one workspace.

The stack, for those who want specifics

Claude Code running the workflow end to end. Clay’s MCP connection for company search, people search, and contact enrichment. An Apify actor built for scraping LinkedIn posts, called directly from the same Claude Code session, to pull dated, recent activity instead of general web search results. A single markdown file holding my writing rules, referenced before every draft. Output as a CSV, ready to import into whatever outbound tool or CRM you already run.

Why this matters

The AI was never the hard part. Any model can write a passable cold email. What made this work was the layer of rules sitting on top of it: who counts as a valid contact, how fresh a signal has to be before it is worth using, what tone is and is not allowed, and the fact that every claim in the outreach traces back to a verifiable source. Get those rules right once, write them down, and the system holds to them for lead five hundred the same way it did for lead one.

The template

Here is a starting template for your own Claude Code setup. Copy it into a markdown file in your project, fill in the sections in brackets, and point Claude Code at it alongside your Clay connection.

# Lead Generation Playbook

## Goal
[What you are trying to source, and what the outreach is asking for.
Example: "Source 30 companies matching my target profile and identify
the right contact at each one for a first conversation."]

## Target company profile
- Industry / sector: [ ]
- Location: [ ]
- Company size (employees): [ ]
- Other signals to prioritize: [funding stage, recent hiring, headcount growth, etc.]

## Contact rules (do not skip this)
Only these contact types are valid: [e.g. "Founder, Co-Founder, or a
Growth-team member"]. Do not fall back to HR, generic sales, or
junior/entry-level titles as a substitute, even if that is the only
contact Clay returns. If no valid contact exists at a company, exclude
that company and find a replacement rather than compromise this rule.

## Sourcing and enrichment
1. Search Clay for companies matching the target profile above.
2. Search Clay for contacts at each matching company, filtered to the
   valid contact types only.
3. Enrich every contact to find a verified email through Clay directly.
4. If an email does not resolve, flag it for manual follow-up. Do not
   guess or fall back to a lower-confidence contact.
5. Log every excluded company and the reason, so future runs do not
   repeat the same dead ends.

## Personalization research
For each contact, pull their most recent LinkedIn activity (personal
profile and company page) using a LinkedIn post-scraping tool, filtered
to the last 10-15 days. Use the single most recent, most relevant post
as the hook for the outreach. Never use a funding announcement or press
mention older than a few weeks as the primary hook.

## Voice and style rules
[Paste your own writing rules here, or reference a separate voice file.
At minimum, decide: sentence length and tone, words or phrases to avoid,
how the message should open, and what the call to action should look
like.]

## Output rules
- Every email stays under [100] words.
- Every draft includes its source (a link to the post or signal it is
  based on) so the claim can be checked before sending.
- Export all drafts to a CSV, then import that CSV directly into Clay
  to run sending, sequencing, and reply tracking for the whole campaign.

Frequently asked questions

What is Clay, and how does it work with Claude Code? Clay is a data platform for finding and enriching companies and contacts. Connected through Claude Code as an MCP tool, Claude can search Clay’s data and enrich results directly inside a working session, rather than you doing that research manually in Clay’s own interface.

Do I need to know how to code to set this up? No. The entire workflow in this article ran through plain-language instructions to Claude Code. The only account you need beyond Claude itself is a Clay workspace and, for the LinkedIn research step, an Apify account.

How is this different from a normal cold email tool? Most outbound tools personalize with merge fields: first name, company name, maybe a job title. This workflow personalizes with an actual current fact about the recipient, verified against a real source, and drafted in a fixed voice rather than a generic template.

What does a setup like this cost? A Claude subscription, a Clay plan (Clay is usage-based, so cost scales with how many companies and contacts you enrich), and a small pay-per-use cost on Apify for the LinkedIn research, typically a few cents per contact.

Can this replace my CRM or sales sequencer? No, and it is not meant to. This workflow handles sourcing, research, and drafting. Sending, sequencing, and pipeline tracking still belong in whatever CRM or outbound tool you already run. The output here is designed to feed straight into one.


Jigar Rana is a tech enthusiast and AI-first operator based in Toronto. If you want to talk about AI-first ways of working, book a call or connect on LinkedIn.