# Rinse & Repeat: Clean a CSV Once, Replay It on Every Export

> Clean a messy CSV once, save the fixes as a recipe, and replay it on every new export in one command, with drift alerts and a full undo. Every changed cell is logged with its old and new value. Runs offline and never edits your original file.

Rinse & Repeat: Clean a CSV Once, Replay It on Every Export is a paid AI agent skill on Agensi by Karma Wangchuk, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Karma Wangchuk](https://www.agensi.io/creators/karma-wangchuk)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.1
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/rinse-repeat-clean-a-csv-once-replay-it-on-every-export
- Tags: csv, data-cleaning, deduplication, data-quality, spreadsheet, etl, automation, crm

## What it does

- Profiles a messy CSV: types, missing values, duplicates, broken rows and spelling variants
- Fixes whitespace, null tokens, dates, numbers, currencies, yes/no values, emails and duplicates
- Saves your cleaning steps as a recipe and replays them on next week's export in one command
- Warns you before writing when an export drifts: new or missing columns, values that stop parsing
- Logs every changed cell (old value, new value, rule) and every removed row with its reason
- Undoes the whole clean in one command and proves every value is back

## Who it's for

- **Ops and sales people with weekly CRM or shop exports:** The same cleanup in one command every week. Try: "Clean this week's customer export the same way as last week."
- **Analysts handed someone else's spreadsheet:** A profile of what is wrong before they trust the data. Try: "Profile this CSV and tell me what's wrong with it."
- **Anyone who must explain changes to a boss or auditor:** A cell-by-cell change log and a provable undo. Try: "Clean this file and show me every change you made."
- **Small teams without a data engineer:** A repeatable cleanup pipeline without code or cloud tools. Try: "Remove duplicate customers by email and standardize the dates."

## About this skill

Most CSV cleaners fix one file and forget what they did. Real exports come back every week with the same mess. Rinse & Repeat profiles your file, proposes a recipe (a small JSON file of fixes you approve), cleans it, and keeps the recipe so next week's export is cleaned the same way in one command.

If the export changes shape, for example someone adds a column or a date column fills with text, the replay stops before writing anything and tells you what changed. Nothing is ever lost: removed rows go to their own file with the reason and the original values, values it cannot fix are left alone and listed, and every changed cell is logged with its old and new value. One command rebuilds the original and checks it value by value.

It runs on your machine with Python's standard library. No API key, no upload, no packages.

## Requires

- Terminal
- Python 3.8+

Works on Windows, macOS and Linux. No packages and no API keys.

## Known limitations

Undo restores values, not bytes: quoting, line endings and encoding become standard UTF-8. Dates with times and percent values are reported as issues, not converted. The whole file is read into memory: fine for hundreds of thousands of rows, not for many GB. Excel files must be saved as CSV first. Not financial, legal or medical advice.

## Technical details

Three standalone Python 3.8+ scripts, standard library only:
- `profile_csv.py`: detects encoding (UTF-8, Windows-1252, Latin-1) and delimiter, infers column types (text, number, date, yes/no, email), counts missing values per spelling (`N/A`, `-`, `null`, blank), finds exact and near duplicates, broken rows and spelling variants, and writes `profile.md`, `profile.json` and a suggested `recipe.json`.
- `clean.py`: applies a recipe: trim, null tokens, rename to snake_case, numbers (currency signs, thousands separators, `(15.00)` negatives, European `1.234,50`), dates to ISO (day-first or month-first), yes/no to true/false, email lower-case and validation, value maps, case, required columns, exact or normalized dedupe by key. Writes `cleaned.csv`, `changes.csv`, `removed.csv`, `issues.csv`, `report.md`. Drift check against the recipe; `--strict` exits with code 2 and writes nothing.
- `undo.py`: rebuilds the original from the logs; `--check` compares it value by value with the original.
Columns are matched by name, so reordered or re-cased headers still work. Undo restores values, not bytes (output is UTF-8).

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Rinse & Repeat: Clean a CSV Once, Replay It on Every Export skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Is my data sent anywhere?

No. The scripts run on your computer, read your file and write new files next to it. There is no network call and no API key. The agent is told not to paste rows into any web service.

### Does it change my original file?

Never. Results go to a new folder. Even then, `undo.py` can rebuild the original from the change log and prove every value matches.

### What happens when next month's export has a new column?

The replay with `--strict` stops before writing anything and lists the drift (new column, missing column, or a typed column whose values stopped parsing). You update the recipe, or accept the drift, and run again.

### Will it guess missing values?

No. Missing stays blank unless you give a value. Values it cannot convert, like `soon` in a date column, are left as they were and listed in `issues.csv`.

### How are duplicates decided?

By the key columns you choose (for example email), ignoring case and extra spaces, or by the whole row. The first row wins; the others go to `removed.csv` with "duplicate of row N".

### Does it handle European numbers and dates?

Yes: `1.234,50`, `22.03.2026` and day-first dates are read correctly. Set `day_first` for ambiguous dates like `03/04/2026`.

### Excel files?

Save the sheet as CSV first. Output is a CSV that Excel, Google Sheets and Numbers open directly.

### Is this financial or legal advice?

No. It fixes formats and duplicates; it does not judge what the data means.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
