Skip to content
Back to skills

Ml Leakage Check

ASecurity

Use when reviewing ML preprocessing or feature pipelines for target leakage -- validation metrics look suspiciously good, transformers are fitted before splitting, or features may not exist at prediction time.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 6, 2026
ai-agentsgodatabase

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add yeaight7/agent-powerups --skill ml-leakage-check --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ml Leakage Check?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ml Leakage Check
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yeaight7-ml-leakage-check-agent-powerups/badge)](https://www.skillsdirectory.com/skills/yeaight7-ml-leakage-check-agent-powerups)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ml-leakage-check
description: Use when reviewing ML preprocessing or feature pipelines for target leakage -- validation metrics look suspiciously good, transformers are fitted before splitting, or features may not exist at prediction time.
---

## Purpose

Target leakage is the most common and dangerous error in applied ML. It creates models that look perfect in validation but fail instantly in production. This check inspects the pipeline for the standard leakage vectors.

## When to Use

- Reviewing preprocessing or feature-engineering code before training sign-off
- Validation metrics look too good to be true
- A model performed far worse in production than in validation

## Inputs

- The preprocessing/feature pipeline code and the train/test split logic

## Workflow

1. **Global scaling/imputation**: was any statistic (mean, std, encoder vocabulary) computed on the *entire* dataset before splitting? That leaks the test distribution into training.
2. **Future features**: is any training feature unavailable at the moment of prediction in real life? (e.g., using "surgery_outcome" to predict "hospital_admission_length")
3. **ID proxies**: are database IDs or row numbers included as features? They often correlate with time or order of entry.
4. **Enforce the order**: Split FIRST, then fit transformers on Train ONLY, then transform Train/Val/Test.

## Output

- A leakage verdict per vector (global statistics, future features, ID proxies), citing the offending lines and the fix for each

## Verification

- [ ] All fit/fit_transform calls occur after the split and only on training data
- [ ] Every feature audited for availability at prediction time
- [ ] No raw IDs or row numbers among the features
- [ ] Findings cite specific code lines

## Failure Modes

- **Pipeline blindness** — leakage hidden inside helper functions or composed pipelines; trace where fitting actually happens.
- **"It's just scaling"** — dismissing global scaling as harmless; it still leaks distribution information.
- **Fixing one vector only** — re-running after one fix while the other vectors remain unchecked; audit all three every time.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…