Skip to content
Development
Skill

/data-rigor-and-leakage

Use BEFORE training any model, to build correct train/val/test splits and hunt data leakage - the #1 cause of fake-high accuracy. Covers group/patient/subject splits, temporal splits, official-benchmark splits, label correctness, class balance, and preprocessing parity. Triggers

From plugin
mlcraft
823 skills1 agent1 command

Claude Code

$ npx -y skills add mxslr/mlcraft --skill data-rigor-and-leakage --agent claude-code

SKILL.md

data-rigor-and-leakage.SKILL.md
name: data-rigor-and-leakage
description: "Use BEFORE training any model, to build correct train/val/test splits and hunt data leakage - the #1 cause of fake-high accuracy. Covers group/patient/subject splits, temporal splits, official-benchmark splits, label correctness, class balance, and preprocessing parity. Triggers on 'split the data', 'train/test split', 'cross validation', 'why is accuracy suspiciously high', 'data leakage', 'per-patient'."

Data Rigor & Leakage Audit

Wrong splits invalidate every downstream number. Do this **before** training and re-check whenever results look too good.

Leakage checklist

  • **Group leakage (most common).** If one entity (patient, person, product, document, study) yields multiple samples, ALL its samples must sit in ONE split. Random per-sample splitting scatters them across train/test the model memorizes the entity. Use `GroupShuffleSplit` / `StratifiedGroupKFold` keyed by the entity id.
  • **Temporal leakage.** Time-series / any time-ordered data: train must be strictly earlier than val/test. No shuffling across time. No future-derived features.
  • **Official split.** If the benchmark defines a train/test split (e.g., encoded in an ID), use it - otherwise numbers aren't comparable to papers.
  • **Preprocessing / normalization leakage.** Fit scalers, PCA, class weights, augmentation stats, and target encodings on **train only**, then apply to val/test. Never fit on the full set.
  • **Duplicate / near-duplicate leakage.** De-duplicate (and augmented copies) across splits.
  • **Target leakage in features.** Drop features that encode the label or are only known post-outcome.
  • **Threshold/selection leakage.** Choosing a decision threshold or doing model selection using **test** labels is leakage. Do it on validation.

Make it enforceable

Add explicit **assertions** that split membership is disjoint at the entity level, e.g.:

assert not (train_ids & val_ids) and not (train_ids & test_ids) and not (val_ids & test_ids)

Print per-split counts of **entities** (not just samples) and the class balance.

Also verify

  • **Labels** are correct and consistent (one authoritative source; handle multi-label-per-entity deliberately).
  • **Class balance** - decide handling now (class-weighted loss OR resampling, not both by default).
  • **Manifest, not copies.** Prefer a manifest table (path, entity, label, split) over shuffling files into folders - it makes the split auditable.
Read more
@mxslr
Ships withmlcraft

A research-first AI/ML research-engineer workflow for Claude Code

823 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
8
Star history of mxslr/mlcraft on GitHub, a chart by star-history.com

Other skills on mlcraft.

accuracy-improvement-loop

accuracy-improvement-l…

Use when an existing model's results are disappointing and the user wants higher accuracy - 'accuracy is still too low',…

@mxslr@mxslrInstall Skill
dataset-profiling

dataset-profiling

Use as the FIRST step of any ML task, before choosing a model, to inspect and understand the actual dataset. Works for a LOCAL…

@mxslr@mxslrInstall Skill
deployment-explainability

deployment-explainabil…

Use when turning a trained model into something usable (an app, an inference function, a demo) or adding explainability. Selects…

@mxslr@mxslrInstall Skill
domain-3d

domain-3d

Use for 3D and point cloud tasks: point cloud classification, 3D semantic or instance segmentation, 3D object detection from…

@mxslr@mxslrInstall Skill
domain-anomaly-detection

domain-anomaly-detecti…

Use for anomaly, outlier, and novelty detection across data types: industrial or visual defect detection, time-series or sensor…

@mxslr@mxslrInstall Skill
domain-audio-speech

domain-audio-speech

Use for audio and speech tasks: speech recognition (speech to text, ASR, transcription), audio or sound classification and…

@mxslr@mxslrInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about data-rigor-and-leakage.

Which coding agents can use data-rigor-and-leakage?
data-rigor-and-leakage installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.