ooligo
claude-skill

Salesforce data cleanup with a Claude Skill

Difficulty
advanced
Setup time
90min
For
revops
RevOps

Stack

A Claude Skill that finds and proposes fixes for the data garbage that quietly destroys your reporting: duplicate accounts, orphan contacts, junk leads, malformed phone numbers, mismatched account-contact relationships, and stage values that violate your funnel definition. Proposes changes; never writes without explicit approval.

What you’ll need

  • Salesforce with API access and a sandbox for safe testing
  • Claude Code with the Skill installed
  • A duplicate-detection ruleset (your existing matching rules or a fresh one)
  • A stage definition doc (which stages allow which fields populated)
  • Read-only credentials for first runs; write credentials only after you trust output

Setup

  1. Install the Skill. Drop sfdc-cleanup.skill into ~/.claude/skills/. Set SFDC_TOKEN (start with read-only).
  2. Run a discovery scan. scan_data_health(scope="full"). The Skill samples each major object and reports counts of suspected duplicates, missing required fields, format violations, and stage-rule violations. Output is a one-page report with line-item counts.
  3. Pick one issue and dry-run. dry_run_fix(issue_id="duplicates-account"). The Skill produces a CSV of every proposed change with the exact field-level diff. Review with a human.
  4. Apply with approval. apply_fix(issue_id="duplicates-account", csv_path="approved.csv"). The Skill writes only the rows present in the approved CSV. Every write is logged with a reversible audit record.
  5. Schedule recurring scans. Run weekly; fixes monthly after review.

How it works

The Skill uses the Salesforce Bulk API to pull objects in chunks, then runs Claude on each chunk against the rules you provided. For duplicates, it uses a hybrid: deterministic rules (exact domain match, normalized phone) plus a Claude semantic-similarity pass for fuzzy cases (different capitalizations, suffixes, branch offices). For format issues, it’s pure regex and validation.

The hard part is the proposed merge target. For two duplicate accounts, which one survives? The Skill ranks by activity recency, contact count, and opportunity history, and proposes a survivor. RevOps reviews and overrides as needed.

Every action is logged to a custom Salesforce object (Cleanup_Audit__c) so you can revert.

Watch-outs

  • Never grant write access on day one. Run read-only for at least two cycles. The first run will surface false positives in your matching rules.
  • Merge in sandbox first. Account merges cascade to opportunities and activities. Test in sandbox, validate the cascades, then move to production.
  • Soft delete, not hard delete. Use Salesforce’s recycle bin discipline. Never bypass it.
  • Communicate the cleanup. If reps wake up to merged accounts, they’ll panic. Announce ahead and provide an undo path.

Stack

  • Salesforce — source of truth and target of writes
  • Claude — semantic dedup and fix proposals