How to Check a Lead List Before Anyone Sees a Row

Catch wrong rules in a lead list before a client sees it: read ten rows by hand, keep checks apart from the code, and run every check before it ships.

This is a guide to checking a lead list before it goes to a client, a sales team or a sending tool.

We’ll go through one example step by step: a list of US freight brokerages that Claude Code builds for Haulwick, a tool that helps brokerages sign up new carriers (the trucking companies that move the loads).

Say the build checks 12,000 companies and keeps 3,000. The checks in this guide find three wrong rules:

  • one let 140 insurance and customs brokers onto the list
  • one removed 45 brokerages with 201 to 250 employees, although the written rules for the list included them
  • one kept contacts whose job in the people data was out of date

After the fixes, three rounds of ten rows in a row come back clean, and the list goes out.

This guide is for founders, GTM (go-to-market) engineers and anyone who builds lead lists with AI. Step 1 matters most. If your list is already built and you have one hour, do step 1 and step 3.

How the checks work

There are two kinds of checks.

Reading rows by hand. You pick ten rows, open the sources and decide yourself whether each row is right. This finds the errors nobody expected, because you’re not looking for a known problem.

Small scripts that run on every build. They compare the list with your written rules and stop the export when something doesn’t match. They make sure an error you fixed doesn’t come back. Claude Code writes them for you from the prompts below.

Steps 1 and 2 are the hand check and what to do when it finds something. Step 3 checks the people and their emails. Steps 4 to 7 make the scripts trustworthy, and step 8 runs everything before the export.

1. Read ten rows by hand

Rules only catch the problems you already know about. So before the list goes anywhere, read it yourself.

Most AI-built lists store how sure the model was about each company, for example as a confidence number from 0 to 1. Use it to pick the ten.

Pick ten rows on purpose:

  • two rows the model was least sure about
  • two rows the model was most sure about
  • three random rows on the list
  • two rows a rule changed since the last round
  • one excluded row, to check that its reason is right

The least sure rows show where the evidence is weakest. The most sure rows show whether the evidence holds up when you read it yourself. Rows a rule just changed are where new errors come from.

For each row, open the sources yourself. Look at the company’s website and the person’s LinkedIn profile. Is this a freight brokerage? Is it inside the size range? Is this person in this job today? Would you send this email? Write your answer next to the row.

If a row is wrong, fix the rule that let it through. Step 2 shows how. Then rebuild the list and pick ten new rows. The list is ready when three rounds of ten in a row come back clean.

New rows every round, because rules fixed on the same ten rows pass those rows every time. Three rounds, because one clean round can be luck. A name in capital letters or an old spelling of a job title doesn’t make a row wrong.

Here’s how that looks for Haulwick. Round 1 finds an insurance broker on the list, and step 2 fixes the rule behind it. Round 2 is clean. Round 3 finds a “head of carrier sales” who left the brokerage in the spring. The people data still listed the old job.

That fix is a new rule: every contact’s current job gets confirmed with a fresh profile lookup before the export. A new rule resets the count, so rounds 4, 5 and 6 start from zero. They come back clean, and the list goes out.

Let Claude Code pick the ten. Paste this:

Build checks/sample.py. Read list.csv (columns: id, status, confidence)
and changed_ids.txt (rows a rule changed since the last round).
Pick 10 rows: the 2 kept rows with the lowest confidence, the 2 with the
highest, 3 random kept rows, 2 random rows from changed_ids.txt and
1 random excluded row. Never pick a row listed in seen.txt, and add the
10 picked ids to seen.txt. Write them to sample.csv with an empty
column "my_answer" and a column with the website link.

A score can’t replace this. Say the Haulwick list has a buyer on 97% of rows and a verified email on 91%. Neither number can see the row where the “owner” is a dispatcher, or the company that sells insurance to trucking fleets. A row can be complete, verified and wrong.

2. Fix the rule and every row it let through

A wrong row is almost never alone. The rule that let it in also let in every row like it. So before you change anything, count how many rows share the pattern.

In round 1, one of the ten reads “Commercial insurance broker for trucking fleets”. The rule let it in because the description contains “broker”. Removing only that row leaves all the others the same rule let in.

  1. Name the pattern. The old rule matched “broker” anywhere in the text.
  2. Write the new rule and test it on real rows, at least one that should match and one that shouldn’t.
  3. Count the rows that leave and the rows that join under the new rule. Read ten of each before you trust the count.
  4. Rebuild the whole list, run every script and pick ten new rows.
import re

FREIGHT_BROKER = re.compile(
    r"\b(freight|truckload|ltl|load)\s+brokers?(age)?\b"      # "truckload brokerage"
    r"|\bbrok(er|ers|ering)\s+(freight|loads|truckloads)\b",  # "we broker loads"
    re.I,
)

assert FREIGHT_BROKER.search("Asset-light truckload brokerage serving the Midwest")
assert FREIGHT_BROKER.search("We broker loads for food shippers in Texas")
assert not FREIGHT_BROKER.search("Commercial insurance broker for trucking fleets")

The first version of the new rule had only the first pattern (freight, truckload or load brokerage). It sent 158 rows out. One of the ten you read was a real brokerage that writes “we broker loads for food shippers”.

So the first fix was wrong too, in the other direction. The second pattern and the second test came from that row. The final rule sends 140 rows out, nearly all of them insurance or customs brokers. No rows join, because the new rule is narrower than the old one.

When an AI model judged the row, the rule is the prompt. Add the false match to the prompt’s list of companies that don’t fit, for example “insurance or customs brokers”. Then run the new prompt on every row the old one accepted, and read ten of the rows that change.

Paste this to have Claude Code do the counting:

The rule in pipeline/filters.py that matches "broker" let insurance
brokers onto the list. Write the new rule as a regex with tests: the
two descriptions in tests/should_match.txt must match, the one in
tests/should_not_match.txt must not. Then count the rows that leave
and the rows that join under the new rule, and print 10 random rows
from each group with name and the first 100 characters of the
description. Don't change the list yet.

3. Check every contact before you buy or send emails

Company checks don’t cover the people. Most complaints about a list come from the contacts: the wrong person, an old job, an email that bounces. These rules follow how Eric Nowoslawski builds lists, and each one is a short script.

Before you buy a single email:

  • Every company with all its buyers. Pull every person with a buying title at every kept company, never one person per company. Haulwick’s titles are owner, president, VP of operations and director of carrier sales. The check fails if the export has a limit of one contact per company anywhere.
  • Customers, open deals and opt-outs removed, matched on the website domain against your CRM. You don’t pay for emails of people you must not contact.
  • Each person once. Remove duplicate people first, so you never pay twice for one email.

Before the file goes out:

  • Titles match your list. Flag titles that contain your keywords but aren’t buyers, like “Assistant to the CEO”, “Sales Coordinator” or “Intern”.
  • The job is current. If the email domain differs from the company’s domain, the person may have changed jobs. Flag the row for a fresh profile lookup. This is the rule round 3 added.
  • Only valid emails. An email verifier, a tool like MillionVerifier that asks the mail server whether the mailbox exists without sending an email, returns valid, invalid, unknown or catch-all. Keep only valid. Drop every “unknown”, because the verifier couldn’t confirm the mailbox.
  • Catch-alls only after a second check. A catch-all mail server accepts any address, so a normal check can’t confirm the mailbox. Send to those only after a tool built for this, like LeadMagic or BounceBan, clears them.
  • No email twice. One row per email address across the whole file.

Paste this into Claude Code:

Build checks/contacts.py. Read export.csv, companies.csv,
crm_do_not_contact.csv and titles.yaml (buying titles and excluded
titles). Fail and print the rows if:
1. a kept company has a buying title in people_raw.csv but fewer
   contacts in export.csv than in people_raw.csv
2. a contact's company domain is in crm_do_not_contact.csv
3. a title matches an excluded title or no buying title
4. the email domain differs from the company domain (list as "job check")
5. verifier_result is anything but valid, or catch_all without
   catchall_check == valid
6. an email address appears twice
Print rows checked and problems for each rule.

4. Keep the checks away from the code they check

When Claude Code builds a list, it writes the pipeline: the script that collects, removes duplicates, classifies and exports. The checks have to stay outside that work. A check is only worth something if the only way to make it pass is to fix the list.

So split the work into three files or folders:

  • The spec: your written rules for the list, in one short file: the market definition, the titles, the signal and every cutoff. You write it before the build.
  • The pipeline: written by Claude Code from the spec.
  • The checks: a separate folder, written from the spec in a separate Claude Code session that never opens the pipeline code.

Why a separate session: checks written next to the pipeline code tend to copy its logic. You want checks that follow the spec, so the two can disagree when the code is wrong.

Write two lines into the project’s CLAUDE.md, the instruction file Claude Code reads at the start of every session. The agent never edits anything in checks/ during a build. When a check fails, it prints the failing rows and stops.

Then add a deny rule for edits to checks/ in the project’s Claude Code permissions. A deny rule is a permission setting that blocks an action. The edit tool is then blocked there, so the first line doesn’t depend on the agent remembering it.

5. Take the expected numbers from the spec, never from the pipeline

A check compares what the list should contain with what it does contain. If it works out what the list should contain the same way the pipeline does, it agrees with the pipeline every time, mistakes included.

The common version: the check imports the pipeline’s own filter.

# wrong: the pipeline's own function checks the pipeline
from pipeline.filters import in_size_range
expected = sum(in_size_range(r["employees"]) for r in companies)

Say the pipeline’s filter says 11 to 200 employees, while the spec says 11 to 250. The pipeline drops every brokerage with 201 to 250 employees. The check counts with the same function, and both agree. In Haulwick’s build, that’s 45 companies, and every check shows a pass.

The fix is a second, independent path. Type the spec’s numbers into the check by hand and apply them to the raw data:

SPEC_SIZE = (11, 250)   # typed from spec.md, never imported from the pipeline

def check_size(raw_rows, pipeline_rows):
    lo, hi = SPEC_SIZE
    expected = {r["id"] for r in raw_rows
                if r["employees"] is not None and lo <= r["employees"] <= hi}
    actual = {r["id"] for r in pipeline_rows if r["size_ok"]}
    gap = expected ^ actual
    if gap:
        raise CheckFailed(f"{len(gap)} companies disagree on the size range, e.g. {sorted(gap)[:5]}")

This check fails with “45 companies disagree”. After the fix, the 45 go through the same checks as every other company.

Write one check like this for every number in the spec: the size range, the signal threshold of two people, and at least one person with a buying title per kept company.

Count the rows of the file you hand over by reading the file itself, never from the number the pipeline printed.

Compare your total with a public count. The Census counts 5,884 US offices of freight arrangement companies with 10 to 249 employees (2023). That group also holds freight forwarders and customs brokers, and one company can have several offices. So 3,000 kept brokerages is plausible. 9,000 would point to a filter that let the wrong companies in.

6. Make a check fail when it finds nothing to check

“Nothing found” must never read as “nothing wrong”.

Say the email check looks for a column called Email and the export calls it E-mail. The check runs over zero values, finds zero problems and prints PASS.

The same happens when the file has a note in row 1 and the column names in row 3. The check reads row 1 as the header, finds none of its columns and checks nothing.

Three rules fix this:

  • Find the header row instead of assuming it. The header is the first row with at least two filled cells. Column names go through a list of the spellings you’ve seen.
  • Fail when a column is missing, and print the header you found.
  • Print the number of rows checked next to the number of problems. “0 problems in 0 rows” is a failure.

Paste this:

Build checks/core.py with three functions every check uses:
find_header(rows): the first row with at least 2 filled cells.
map_columns(header, needed): map each needed column through a list of
known spellings (email: email, e-mail, email address). Raise CheckFailed
with the header if one is missing.
run_check(name, rows, ok): raise CheckFailed if rows is empty, else
return name, rows checked and problems.
Add a test for each: a file with a note in row 1, a file with E-mail
as the column name and an empty file.

Give every check one row you know is wrong, for example an email on a different domain from the company’s, and test that the check flags it. A check that has never failed on purpose has never been tested.

7. Confirm the signal from two sources

Haulwick’s first line talks about the brokerage’s carrier sales team. That’s the signal, a sign the company may need you right now: a team of two or more people who sign up carriers. A wrong signal in a first line is worse than none, because the reader knows right away it isn’t true.

If you can measure a signal two ways, use it only where both agree. For Haulwick, the two ways are:

  • Source A: the people database’s sales headcount for each company.
  • Source B: your own count of current job titles at the company that are carrier sales roles.
def signal_state(row, min_reps=2):
    a = row.get("dept_sales")    # the database's sales headcount
    b = row.get("title_sales")   # your own count of carrier sales titles
    if a is None or b is None:
        return "unmeasured"
    if a >= min_reps and b >= min_reps:
        return "fire"
    if a < min_reps and b < min_reps:
        return "no_signal"
    return "disagree"

Say that in the first build, both sources agree on a team at 1,450 of the 3,000 companies. Only the database says yes at 400, only your title count at 190, and neither at 960.

The 1,450 get the email that mentions the carrier sales team. The 590 where the sources disagree get the email without that line. Then read five of the 590 by hand. If one source is wrong in a pattern, for example it counts dispatchers as sales, fix that before the next build.

Two sources only count if their raw data is different. Two vendors that sell the same LinkedIn data are one source. Even A and B above use the same people records, so B catches A’s labeling errors but not people missing from the data. Where you can, add the company’s careers or team page as a third source for the rows that disagree.

8. Run every check before the file goes out

Put the scripts into one folder and run them as the last step of every export. This is the layout I’d copy into any list project:

checks/
  core.py         find_header, map_columns, run_check (0 rows checked = FAIL)
  spec.py         cutoffs typed from spec.md, never imported from pipeline/
  size.py         check_size and the other spec checks
  contacts.py     titles, current job, verifier results, do not contact
  signals.py      signal_state
  rules_test.py   one row that should match and one that shouldn't, per rule,
                  plus one known wrong row per check
  sample.py       picks the ten rows for the hand check
  run_all.py      prints check | rows checked | problems | status, exit 1 on FAIL

The export runs python3 -m checks.run_all first. The client file is only written when every check passes. The hand check in step 1 stays manual on purpose. It’s the only check that can find a problem nobody has written a rule for yet.

Where to start today

You can check your next list today in three steps:

  1. Read ten rows of your last list, picked the way step 1 describes, and fix the rule behind every wrong row.
  2. Let Claude Code write the contact checks from step 3 and run them on the same list.
  3. Run every check before the file goes out.

Blog

Keep Reading

Start With a System Check

Start with a free target market map or a short system check. Either way, you leave with something useful.