data-quality
Skill2 starsChanged 12 days agoMITView on GitHub
Profile, validate, and clean tabular data with Polars (and pandas) before analysis or modeling, covering a fast EDA workflow, type and placeholder fixes, key and join sanity checks, Pandera data contracts, target leakage checks, train/serve drift with PSI, and analysis hygiene. Includes a Polars profiling script that flags duplicates, sentinel values, numbers stored as strings, future dates, leakage, and drift as Markdown. Use when starting work on a new dataset, before training a model, when numbers look wrong after a join or aggregation, when adding data validation to a pipeline, or when checking for drift between datasets.
16 other projects use a version of this.
Adopted by
Most recently taken up by
- ChrisGVE/localdata-mcptheir own version, first seen Nov 29, 2026
- lengrufeng2008/dsh-skill-librarytheir own version, first seen Nov 15, 2026
- SSameer20/data-analyst-toolkittheir own version, first seen Nov 8, 2026
- SWEStash/swe-workflow-skillstheir own version, first seen Nov 8, 2026
- Happy-Technologies-LLC/happy-platform-skillstheir own version, first seen Nov 1, 2026
- newsc2/claude-skillstheir own version, first seen Oct 20, 2026
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 16
- nahid-sparktales/agent-dispatcher★ 59same name
- Happy-Technologies-LLC/happy-platform-skills★ 41same name
- nimadorostkar/Claude-Skills-collection★ 41same name
- brainbytes-dev/everything-claude-trading★ 16same name
- ChrisGVE/localdata-mcp★ 15same name
- khuynh22/agent-dev-team★ 9same name
- yeaight7/agent-powerups★ 6same name
- SSameer20/data-analyst-toolkit★ 4same name
- gmanch94/claude-code-aidlc-template★ 2same name
- SWEStash/swe-workflow-skills★ 1same name
6 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- agent-observabilitySkill
- git-pr-workflowSkill
- langgraph-patternsSkill
- llm-evalsSkill
- mcp-server-builderSkill
- ml-experiment-trackingSkill
- prompt-engineeringSkill
- python-qualitySkill
- rag-pipelinesSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Before training or evaluating a model.
- Distinctive: line 58
Keep a raw copy; cleaning is a reproducible script, not manual edits.
- Distinctive: line 108
Temporal: every feature must be computable at prediction time.
- Distinctive: line 113
If a model looks too good (AUC 0.99 on a hard problem), assume leakage until proven otherwise.
- Distinctive: line 135
Prefer Polars (lazy) for large files and pipelines.
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data Quality and Analysis Hygiene
Most modeling bugs are data bugs: a join that fanned out, a sentinel -999 averaged into revenue, a feature that is only known after the label. Profile first, write down what "valid" means as a contract, and check joins and leakage before you trust any metric.
When To Use
- First contact with a dataset (new source, new extract, new quarter).
- Before training or evaluating a model.
- A KPI or row count changed unexpectedly after a pipeline or query change.
- Adding validation to an ETL / feature pipeline.
- Comparing training data with production or a newer extract (drift).
Workflow
1. Profile before you analyze
uv run scripts/profile_data.py data/orders.parquet --key order_id --target churned
uv run scripts/profile_data.py assets/example_orders.csv --key order_id --target churned # demoscripts/profile_data.py prints a Markdown profile (types, nulls, cardinality, ranges, top values) and an issues list: duplicated rows and keys, all-null or constant columns, placeholder strings and sentinel numbers, numbers stored as strings, whitespace and case variants, extreme outliers, future dates, ID-like columns, and features that look like target leakage. Paste the output into the PR or notebook so reviewers see what you saw.
The bundled assets/example_orders.csv contains one of each common problem; run the profiler on it to see what each flag looks like.
2. Fix types and missing values explicitly
import polars as pl
PLACEHOLDERS = ["", "N/A", "n/a", "NA", "null", "-", "?", "unknown"]
df = (
pl.read_csv(
"orders.csv", null_values=PLACEHOLDERS, infer_schema_length=10_000, try_parse_dates=True
)
.with_columns(
pl.col("amount").str.replace_all(",", "").cast(pl.Float64),
pl.col("region").str.strip_chars().str.to_uppercase(),
)
.with_columns(
pl.when(pl.col("amount") == -999).then(None).otherwise(pl.col("amount")).alias("amount")
)
.unique(maintain_order=True)
)- Decide per column whether missing means unknown, zero, or not applicable, and write that decision down. Never
fillna(0)blindly. - Keep a raw copy; cleaning is a reproducible script, not manual edits.
- Re-run the profiler after cleaning: fixing types reveals the next layer of issues (sentinels inside a string column only show up once it is numeric).
3. Check every join
Joins are the most common source of silently wrong numbers.
before = orders.height
assert customers["customer_id"].is_unique().all(), "dimension key not unique"
joined = orders.join(customers, on="customer_id", how="left", validate="m:1")
assert joined.height == before, f"join changed row count {before} -> {joined.height}"
unmatched = orders.join(customers, on="customer_id", how="anti")
print(f"{unmatched.height} orders without a customer ({unmatched.height / before:.1%})")pandas equivalent: orders.merge(customers, on="customer_id", how="left", validate="many_to_one", indicator=True), then inspect _merge.
Also check: key dtypes match (int vs string IDs silently match nothing), keys are normalized (case, whitespace, leading zeros), and time-bounded joins use the right as-of date (join_asof).
4. Write a data contract
Turn what you learned into a schema that runs in the pipeline and in tests. Pandera supports both Polars and pandas:
import pandera.polars as pa
import polars as pl
class Orders(pa.DataFrameModel):
order_id: int = pa.Field(unique=True)
customer_id: str = pa.Field(str_matches=r"^C\d+$")
region: str = pa.Field(isin=["EU", "US", "APAC"], nullable=True)
amount: float = pa.Field(ge=0, le=100_000)
order_date: pl.Date
class Config:
strict = True # unexpected columns fail
coerce = True
Orders.validate(df, lazy=True) # lazy=True reports all failures at onceValidate at boundaries: after ingestion, before feature computation, and before writing outputs. Alternatives: Great Expectations / GX, dbt tests, Soda, or SQL assertions in the warehouse.
5. Check for leakage before training
- Temporal: every feature must be computable at prediction time. Use point-in-time joins and a time-based split when predicting the future.
- Target proxies: refunds, cancellation reasons, "account_closed_date," or post-outcome statuses. The profiler flags features with very high correlation or a perfect threshold split against the target.
- Entity overlap: the same user, patient, or device in train and test inflates scores. Split by group.
- Preprocessing leakage: scalers, imputers, encoders, and feature selection fit on the full data. Fit inside a pipeline on train only.
- Duplicates across splits: near-duplicate rows (same text, same image) in train and test.
- If a model looks too good (AUC 0.99 on a hard problem), assume leakage until proven otherwise; check feature importances first.
6. Monitor drift
uv run scripts/profile_data.py data/prod_2026_11.parquet --baseline data/train.parquet --fail-on-issuesThe drift section reports null-rate changes, mean shift in baseline standard deviations, PSI per numeric column (< 0.1 stable, 0.1-0.25 moderate, > 0.25 major), unseen categories, and added or missing columns. Investigate before retraining: drift is often an upstream bug, not a change in the world.
Polars and pandas Quick Reference
| Task | Polars | pandas |
| Lazy read + filter | pl.scan_parquet(p).filter(pl.col("x") > 0).collect() | pd.read_parquet(p, filters=[("x", ">", 0)]) |
| Group + aggregate | df.group_by("k").agg(pl.len(), pl.col("v").mean()) | df.groupby("k").agg(n=("v", "size"), v=("v", "mean")) |
| Null counts | df.null_count() | df.isna().sum() |
| Duplicates | df.is_duplicated().sum() | df.duplicated(keep=False).sum() |
| Validated join | a.join(b, on="k", how="left", validate="m:1") | a.merge(b, on="k", how="left", validate="many_to_one") |
| Window | pl.col("v").sum().over("k") | df.groupby("k")["v"].transform("sum") |
| As-of join | a.join_asof(b, on="ts", by="k") | pd.merge_asof(a, b, on="ts", by="k") |
Prefer Polars (lazy) for large files and pipelines; pandas remains fine for small data and library compatibility. Use DuckDB when SQL is the clearest expression.
Checklist
- Profile run and reviewed; output saved with the analysis
- Placeholders and sentinels converted to null; types explicit
- Missing-value semantics decided per column
- Primary key unique and non-null; every join row-count checked with
validate - Data contract (Pandera or equivalent) runs in the pipeline and in tests
- Leakage review done (temporal, proxies, entity overlap, preprocessing)
- Drift checked against the training baseline before retraining or scoring
- Cleaning is a script under version control, not manual edits
Common Mistakes
- Averaging a column that contains
-999or9999sentinels. - A many-to-many join that doubles revenue, discovered weeks later.
- Treating
"","N/A", and null as different categories. - Random splits on time-series or grouped data.
- Dropping rows with nulls without checking whether missingness correlates with the target.
- Validating data only in a notebook, never in the production pipeline.
References
- Polars user guide: https://docs.pola.rs/
- Pandera (Polars integration): https://pandera.readthedocs.io/en/stable/polars.html
- scikit-learn, common pitfalls and data leakage: https://scikit-learn.org/stable/common_pitfalls.html
- Kaufman et al., "Leakage in Data Mining" (KDD 2011): https://dl.acm.org/doi/10.1145/2020408.2020496
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

