Guides / RevOps

Clean your CRM with a repeatable Claude Code pipeline

Most teams know their CRM data is bad and never find the time to fix it. Run hygiene as a scripted pipeline from one terminal and it becomes routine work.

Jan Rasmussen Jan Rasmussen · Co-founder · Strategy & clientsHalf a day first run · checked
Originally shared on LinkedIn by Jan

Claude Code can run CRM hygiene as a pipeline: export, audit, deduplicate, enrich, score, route and push back. Each stage is a script in a folder, so the cleanup you do once becomes infrastructure you can rerun.

The pattern is familiar in almost every RevOps team. Everyone knows the data is bad. Missing job titles, bounced emails, duplicates across contacts and companies, people who left months ago. Meanwhile reps sequence dead addresses, leads route to the wrong owner and scoring runs against an old ICP. The cleanup keeps getting pushed back because it looks like a quarter of manual work.

It does not have to be. Most of the work is well-defined data processing, which is exactly what Claude Code is good at writing and running.

What you need

  • Admin or export access to HubSpot, Salesforce or your CRM
  • Claude Code with a workspace for RevOps
  • An email verification service and one or more enrichment providers
  • Your current ICP and routing rules in writing
  • A sandbox or a full backup before anything is written back

The pipeline

  1. Export CRM data. Pull contacts, companies and deals with their IDs, owners, created dates and last activity dates. Save a dated copy that you never modify, so every later step can be compared with the original.
  2. Audit and flag issues. Ask Claude Code to write an audit script against your schema. Typical checks: missing required fields, badly formatted phone numbers and names, contacts not linked to a company, invalid or bounced emails from a bulk verification run. The output is a report with counts and a flagged file, not changes.
  3. Deduplicate records. Match exactly on email and LinkedIn URL first, then fuzzy match on name plus company domain. Tag each pair with a confidence level. If your CRM has a native or add-on dedup tool, you can use it for the merges themselves.
  4. Enrich missing fields. Send only records with gaps through a waterfall of providers, cheapest per lookup first. Have Claude Code map the results to your CRM schema and fill only fields that are empty, so it never overwrites data a rep entered.
  5. Score and segment. Apply your ICP fit rules and any activity or intent scoring to the cleaned records. If your criteria are loose, the ICP qualification rule builder helps turn them into rules a script can apply.
  6. Route to owners. Apply territory, segment or round-robin rules and flag records whose owner has left or whose account belongs to someone else.
  7. Push back to the CRM. Write changes through the API in small batches, log every change with the old and new value, and stop on errors.

A folder layout that keeps this reusable:

revops/
  CLAUDE.md
  exports/            dated raw exports, never edited
  audit/
    audit.py
    reports/
  dedup/
    match.py
    review-queue.csv
  enrich/
    waterfall.py
  score/
    rules.md
  route/
    rules.md
  push/
    push.py
    changelog.csv

The CLAUDE.md for this folder should state the rules that must never be broken, for example:

## Rules
- Never write to the CRM without a dry run first
- Only fill empty fields. Never overwrite existing values
- Merges below high confidence go to dedup/review-queue.csv
- Log every write to push/changelog.csv
- Never delete. Archive or tag instead

Run every stage as a dry run first and read the summary. A script that plans to change far more records than you expected is usually a matching rule that is too loose.

Three plays worth running

The ghost record purge

Flag contacts with no activity in the last twelve months. Cross-reference them with fresh enrichment: people who have left, companies that have closed, domains that no longer resolve. Archive the dead records and send the ones still active to a re-engagement list.

The duplicate domino

Run exact and fuzzy matching across the whole database. Merge only high-confidence pairs automatically and put everything else in a review queue a person clears. Duplicates usually cause routing and reporting problems, so fixing them often fixes other issues too.

The enrichment waterfall

Take every contact missing two or more key fields and run them through several providers in sequence, stopping at the first valid result. Measure coverage before and after so you know which providers earned their cost.

Make it a system, not a project

The value is in rerunning it. Once the scripts exist, schedule the audit monthly and review the report in your pipeline meeting. New issues get caught while they are small, and scoring and routing always run on current data. You can also check a new list before import with the lead list quality auditor, so bad data does not enter the CRM in the first place.

Want help setting up the pipeline on your CRM? Book a GTM Engine Review.

Frequently asked

Is it safe to let Claude Code write to our CRM?

Only with guardrails: a backup, dry runs, small batches, a change log and a rule that it fills empty fields rather than overwriting. Keep deletes and low-confidence merges human.

Does this work with HubSpot and Salesforce?

Yes. Both have APIs and exports that scripts can use. The pipeline stages are the same, only the push step and field names change.

How often should we run it?

Run the full pipeline once, then the audit monthly and the enrichment and routing steps whenever a large list is imported.