Data cleaner
Agent Skills collection — Reusable capabilities for AI coding agents. Install: npx skills add TheWatcher01/skills
npx -y skills add TheWatcher01/skills --skill data-cleanerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Agent expert en nettoyage, normalisation et structuration de données brutes. Spécialisé PostgreSQL, pandas, SQL batch, déduplication, validation Zod/Pydantic. Use when: nettoyer des données, dédupliquer, normaliser, standardiser des formats, corriger des incohérences, valider la qualité, structurer du JSON/CSV brut, mapper des référentiels (NAF, INSEE, région→département), détecter des anomalies. Triggers: nettoyage, data quality, déduplication, normalisation, ETL, mapping, standardisation, anomalie, incohérence, données sales, import CSV, structuration.
SKILL.md
5.1 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
Data Cleaner Agent — Nettoyage & Structuration
Principes fondamentaux
- Jamais modifier en place — créer colonne/table temporaire, valider, puis remplacer
- Idempotent — chaque opération relançable sans effet de bord
- Traçable — loguer chaque transformation (avant/après, nb lignes)
- Batch first — jamais de row-by-row, toujours UPDATE ... FROM ou COPY
- Valider avant d'écrire — Zod (TS) ou Pydantic (Python) sur chaque output
Workflow en 6 étapes
1. Audit de qualité (diagnostic)
Avant toute action, mesurer l'état actuel. Voir references/audit-template.md.
2. Déduplication
Ordre de priorité :
- Doublons exacts — GROUP BY toutes colonnes, garder min(id)
- Doublons sémantiques — normaliser puis dédupliquer ("Assoc." = "Association")
- Doublons fuzzy — pg_trgm similarity seuil 0.8
DELETE FROM table a USING table b
WHERE a.col1 = b.col1 AND a.col2 = b.col2 AND a.id > b.id;
3. Normalisation textuelle
Appliquer dans cet ordre :
trim(both from col)regexp_replace(col, '\s+', ' ', 'g')(collapse spaces)- NFD unicode normalization (pour index de recherche)
upper()pour codes,initcap()pour noms propresregexp_replace(col, '[\x00-\x1F]', '', 'g')(caractères de contrôle)
4. Mapping référentiels
Toujours via tables de mapping statiques. Voir references/referentiels.md.
5. Validation des formats
| Champ | Pattern | Exemple |
|---|---|---|
| SIREN | ^\d{9}$ | 813065398 |
| SIRET | ^\d{14}$ | 81306539800016 |
| RNA | ^W\d{9}$ | W831003504 |
| NAF | ^\d{2}\.\d{2}[A-Z]$ | 88.99B |
| Code postal | ^\d{5}$ | 83300 |
^[^\s@]+@[^\s@]+\.[^\s@]+$ | - |
-- Identifier invalides AVANT correction
SELECT siren, count(*) FROM table WHERE siren !~ '^\d{9}$' GROUP BY siren;
6. Enrichissement croisé
Après nettoyage, croiser les sources pour combler les trous. Voir references/enrichissement.md.
Anti-patterns
- UPDATE sans WHERE
- DELETE sans backup (
CREATE TABLE backup AS SELECT * FROM ...) - Regex trop permissives — valider sur échantillon 100 lignes
- Normalisation destructive — garder colonne originale, créer colonne
_clean - Import sans staging table temporaire
Métriques à reporter
[CLEAN] table.col : X lignes modifiées / Y total (Z%)
[DEDUP] table : X doublons supprimés (Y restants)
[VALID] table.col : X invalides (patterns: ...)
[ENRICH] table.col : X valeurs comblées depuis source Y
Libs déterministes (pallier l'imprévisibilité LLM)
Toujours préférer un script déterministe à une réponse LLM pour les transformations de données.
Validation (exécuter scripts/validate_column.py)
# Valider SIREN
python3 scripts/validate_column.py dl_entities siren --type siren
# Valider avec regex custom
python3 scripts/validate_column.py dl_entities "nafCode" --pattern '^\d{2}\.\d{2}[A-Z]$'
Python — libs fiables (pip install)
| Lib | Usage | Pourquoi |
|---|---|---|
ftfy | Fix encoding (mojibake, BOM) | Déterministe, gère 99% des cas d'encoding |
unidecode | Translittération unicode → ASCII | Pour les index de recherche sans accents |
phonetics | Soundex/Metaphone noms propres | Matching fuzzy déterministe (pas de LLM) |
pandas | Batch transforms DataFrame | Vectorisé, 100x plus rapide que row-by-row |
great_expectations | Data quality assertions | Pipeline de validation reproductible |
pydantic | Schema validation Python | Rejet strict des données non conformes |
email-validator | Validation email RFC 5321 | Plus fiable que regex |
stdnum | Validation SIREN/SIRET/TVA | Lib officielle, checksums inclus |
TypeScript — libs fiables (pnpm add)
| Lib | Usage |
|---|---|
zod | Schema validation (déjà installé) |
validator | isEmail, isSIRET, isPostalCode... |
PostgreSQL — extensions utiles
| Extension | Usage |
|---|---|
pg_trgm | Fuzzy matching trigram (similarity > 0.8) |
unaccent | Recherche sans diacritiques |
fuzzystrmatch | Levenshtein, Soundex, Metaphone |
Pattern : script > LLM
Pour chaque opération de nettoyage, l'agent doit :
- Écrire un script Python/SQL déterministe
- Le tester sur un échantillon (LIMIT 100)
- Vérifier le résultat avec
validate_column.py - Appliquer en batch sur la table complète
- Reporter les métriques [CLEAN] [DEDUP] [VALID] [ENRICH]
Ne jamais laisser le LLM "deviner" une transformation — toujours coder un script reproductible.
What ships with it: 2 files
3.1 KB alongside SKILL.md, 1 of them executable
references/
- audit-template.md686 B
scripts/
- validate_column.pyruns2.5 KB
Gives 0 of the 12 instructions most databases sql skills give in ~1.4k tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07
- Use parameterized queriesin 37 of 589, across 34 files
- Use timestamptz for timestampsin 30 of 589, across 14 files
- Index foreign keysin 29 of 589, across 18 files
- Create indexes concurrentlyin 29 of 589, across 24 files
- Use numeric type for moneyin 25 of 589, across 8 files
- Use cursor pagination instead of offsetin 24 of 589, across 17 files
- Select only required columnsin 24 of 589, across 20 files
- Add indexes manually on foreign key columnsin 22 of 589, across 12 files
- Normalize to third normal formin 19 of 589, across 10 files
- Configure connection poolingin 19 of 589, across 17 files
- Put equality columns before range columns in indexesin 18 of 589, across 10 files
- Read individual rule files for detailed explanationsin 18 of 589, across 4 files
Said here and by no other author read
- use temporary columns or tables before replacing data
- log every transformation with before and after counts
- process data in batches
- validate each output with schema validation
- audit data quality before any action
- keep original columns during normalisation
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.