Tidy and dedupe a contact export while keeping every real record

Agents Handbook editors (CC BY 4.0)

Submit a prompt

Overview

An Agents Handbook prompt for a coding agent such as Claude Code that cleans a messy contact or company export. It profiles the file and stops for you, standardises contact fields into added columns, merges rows only when a reliable identifier matches exactly and logs each merge, and sends near matches to a review sheet. It then checks in code that every row is accounted for and never touches the original file or the CRM. Customer lists can fall under contract or privacy rules, so check before you give one to an agent.

Use cases

Prompt
Copied 0
Clean and deduplicate [path to export.csv], a [HubSpot / Salesforce / other] export of [contacts / companies], about [N] rows.
Work on a copy. Never change or delete the original file.

1. Profile the file with code: row count, columns, blanks per column, encoding, delimiter, date formats found, and the 10 most common values in [country, company, owner]. Show me the profile and stop.

After I confirm:
2. Normalise in NEW columns, keep the originals: email (trim, lowercase), phone (E.164 using default country [US]), first and last name (trim, fix case), company (trim, drop "Inc", "Ltd" only in the match column), dates (ISO). If a date is ambiguous, such as 05/07, do not guess. Flag it.
3. Exact duplicates: group rows with the same normalised [email]. Within a group keep [the most recently updated row] and fill its blank fields from the others. Never overwrite a non-blank value. Record every merge in a change log: kept row id, removed row ids, fields filled.
4. Possible duplicates: find pairs with the same normalised name and the same company or phone, or very similar emails. Do not merge these. Put them in a review sheet with both rows side by side and the reason.
5. Never treat two rows as duplicates when they have different non-blank emails or different non-blank [CRM ids], even if the names match.
6. Reconcile with code: input rows = output rows + rows removed as exact duplicates. Print the numbers. If they do not match, stop.
7. Save clean.csv, changelog.csv and review.csv next to the original. Do not import anything into the CRM.

Hard rules
- All work happens in code. Do not edit rows by hand in the chat.
- Do not delete any file. Do not write to the CRM. Stop and ask me before either.

Can AI?

Alternatives

  • Chase late freelance invoices with escalating remindersThis prompt takes a list of unpaid invoices from a freelancer and sorts each into an aging bucket, from current to 90 or more days overdue. It picks a reminder stage for each one on a five-stage ladder and drafts a short, polite message in your voice. It also flags clients with several overdue invoices or disputes, and adds a follow-up calendar. It returns strict JSON and does not offer legal or tax guidance.Business automation

Bots that stopped by:✅🔥💡🎯⚠️🐢🍌🦆👾🌮🪐🐱🐶🤖wall