sxsphinxstack

Skills / Clean a dataset

Clean a dataset

Turn a messy dataset into one you can trust. Types fixed, duplicates gone, missing values handled, every change logged. Use when they have an export or collected data that looks wrong, or another skill stalls because the data is a mess.

Use this skill. Nothing to install.

Open in ChatGPT Open in Claude prefilled and ready; just hit send
for Gemini, Copilot, or Cursor: paste it, then say "use the clean a dataset skill"

Don't have an agent?  ·  Raw file: skills/clean-a-dataset.md

Watch the first two minutes

This is how a cleaning session starts, including the rule that protects you from yourself. Click through it.

(pastes the skill) our club signup sheet is a disaster. dates stored as text, names spelled three ways, random blank rows
A real mess is the right classroom. Before we touch anything: copy the whole thing to a tab called raw and treat that tab as read-only. Cleaning never happens on the original.
copied. can we just delete the junk rows now?
Look before touching. Sort each important column and skim the extremes, count blanks with COUNTBLANK, count exact duplicates, and write every problem in a list before fixing any of them. That list becomes your cleaning log.
found 4 exact duplicate rows. deleting them?
One check first: could two identical rows both be real? Two people with the same name can sign up the same day. You know this club and I don't, so that call is yours.
no, the form double-submitted. deleted, and i wrote it down: 212 rows to 208
That log line is the whole discipline. Anyone reading it, including future you, can see exactly what the data went through and why. Next problem on your list: the three spellings of "Priya".

Scripted example of a real session.

Isn't editing the data just... changing the data?

It can be, which is why the skill makes you keep a log tab: one line per change, what and why, with row counts before and after. The original stays untouched in the raw tab, so any change can be traced or reversed. Blanks are decided per column instead of filled to look complete, out-of-range values get flagged in a notes column instead of silently deleted, and you make every judgment call because you know the data's world. If you want a dataset of your own to practice on, these projects produce satisfyingly messy ones:

Street tree survey Build a missing stat table Club dues tracker

What you end up with

Three tabs. The same signup rows before and after, and the log that says what happened in between.

Example
RAW TAB  ·  UNTOUCHED 1
name        joined       paid
Priya S.    March 3rd    yes
priya s     March 3rd    yes
Jordan M.                $10
DANA K      3/9/26       ten dollars
CLEAN TAB 2
name       joined      paid   notes
Priya S.   2026-03-03  10
Jordan M.  2026-03-05  10     joined date from form email
Dana K.    2026-03-09  10
LOG TAB 3
removed 4 exact dupes (form double-submit), 212 -> 208
dates parsed to YYYY-MM-DD, 11 were text
"paid" to numbers; "ten dollars" confirmed as 10 w/ Dana
merged 3 spellings of Priya S. (same email)
Proof: =SUMIF(paid) returned an error on raw and returns 2,080 on clean 4
  1. The original survives. The raw tab is copied first and never edited. Every fix happens on the clean tab, so nothing is unrecoverable.
  2. One problem type at a time. Types first, then inconsistent labels, then duplicates, then blanks, then out-of-range values. You decide each case; the skill explains the trade-off.
  3. The log is what separates cleaning from tampering. One line per change with a reason and row counts. It also records anything masked before sharing, like other people's contact details.
  4. Cleaning has to buy something. The session ends with a summary formula that failed on raw working on clean, and with you able to say in one sentence what this dataset can and cannot answer.

Questions people actually ask

Will I lose my original data?

No. The first step is copying everything to a raw tab that stays read-only for the whole session. All fixes happen on a separate clean tab.

What do I do with blank cells?

Decide per column, out loud: leave blank, fill with a known value, or drop the row, and write the reason in the log. A blank is information. The skill never invents a value to make a column look complete.

How do I know when it's clean enough?

When one row means one thing, columns hold one type each, and a summary formula that failed on the raw tab works. Clean enough to answer your question is the bar, and the skill has you state what the dataset still cannot answer.

My dataset has other people's names and emails in it.

Then before the sheet is shared anywhere, you mask or remove those columns and add a log line saying what was removed. The skill prompts this explicitly.

Do I need to code?

No. Everything happens in Google Sheets or LibreOffice Calc with sorting, find-replace, TRIM, COUNTBLANK, and helper columns. If your questions later outgrow formulas, first-sql is the next step.

Where to go from here

Data clean? Now it will not fight back:

Chart the truth First SQL Simple dashboard

Need messier practice? Collect a dataset of your own:

Run a survey Hours vs grades Your listening, charted

Ideas to use it on

Curious? Read the full skill — the exact instructions your agent gets
---
name: clean-a-dataset
category: data
description: Turn a messy dataset into one you can trust. Types fixed, duplicates gone, missing values handled, every change logged. Use when they have an export or collected data that looks wrong, or another skill stalls because the data is a mess.
---

# clean-a-dataset

Clean a real dataset with someone, and teaching them that
cleaning is most of data work. The dataset must be one they actually
have: a bank or app export, a club sign-up sheet, survey responses,
game logs, a sheet a teacher or boss shared. Work in Google Sheets or
LibreOffice Calc. Never overwrite the original — copy it to a new tab
called `raw` first and treat that tab as read-only.

Keep sensitive data local and minimize it before work begins. Do not upload or
share bank exports, student records, names, contact details, or identifiers
without the data owner's permission. Remove or mask fields the analysis does not
need, and use a redacted sample when asking another person or service for help.

## Look before touching

Walk the data together and write down what you both see:

- How many rows and columns? What is one row supposed to represent?
- Sort each important column and skim the extremes — that surfaces
  typos, impossible values, and stray text in number columns.
- Count blanks per column (COUNTBLANK). Count exact duplicate rows.
- Note every problem in a list before fixing anything. The list
  becomes the cleaning log.

## Fix, one problem type at a time

Work on a copy tab called `clean`. For each fix, they decide, you
explain the trade-off:

1. Types: dates parsed as dates, numbers stripped of units and
   commas, one format per column. Text-that-should-be-number is the
   most common breakage; show a formula failing on it first.
2. Inconsistent labels: "NY", "ny", "New York" become one value.
   TRIM and a find-replace pass; a helper column with the mapping if
   there are many.
3. Duplicates: exact duplicates usually go, but check whether two
   identical rows could both be real (two same-priced purchases the
   same day can be). Deciding takes knowledge of the data, which they
   have and you do not — ask.
4. Missing values: blank is information. Choose per column — leave
   blank, fill with a known value, or drop the row — and say why.
   Never invent a value to make a column look complete.
5. Out-of-range values: a 130% grade or negative age is a typo or a
   lie. Trace it to the source if possible; otherwise flag it in a
   `notes` column rather than silently deleting.

## Write down what changed

Keep a third tab called `log`: one line per change, what and why,
with row counts before and after. This is the habit that separates
cleaning from tampering — anyone, including future-them, can see
exactly what the data went through. If the dataset contains other
people's names or contact details, add a line about what was removed
or masked, and do that before the sheet is shared anywhere.

## Done

- `raw` tab untouched, `clean` tab tidy: one row per thing, typed
  columns, consistent labels, duplicates resolved, blanks decided
- `log` tab listing every change with a reason
- Sensitive fields removed or masked before sharing, with access and storage
  location recorded
- One summary formula on the clean tab works that failed on the raw
  tab — proof the cleaning bought something
- They can say in a sentence what the dataset can and cannot answer

Then use chart-the-truth or first-sql on the cleaned data.