Data and ML Testing
Writes meaningful tests for data pipelines and machine learning models using small fixtures and sensible limits.
Claude's review
7/10 Practical test layers for data and ML code: hand-derived fixtures, Hypothesis properties, baseline thresholds and what not to test.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Use when writing tests for data or ML code — what to test at each layer (transforms, schemas, properties, pipeline smoke, model-quality thresholds, determinism and parity), how to build small synthetic fixtures, and what not to test
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: ml-testing-strategy
category: testing
description: Use when writing tests for data or ML code — what to test at each layer (transforms, schemas, properties, pipeline smoke, model-quality thresholds, determinism and parity), how to build small synthetic fixtures, and what not to test
tech_stack: Python
source: obra/superpowers test-driven-development (MIT) and wshobson/agents data-quality-frameworks testing pyramid (MIT), adapted to data and ML code; Hypothesis and pytest docs cited
---
# ML Testing Strategy
## Overview
Data code is easy to "test" badly: a test that re-runs the pipeline and asserts the metric equals last week's 0.8312 breaks on every library upgrade and catches nothing. Good data tests pin behaviour on tiny, explicit fixtures where you know the right answer by hand, and assert model quality as a threshold on planted signal.
**Core principle:** test your logic, not the library; derive expected values by hand on a fixture small enough to read; assert ranges for anything learned.
## 1. The layers
| Layer | What it proves | Share of tests |
|---|---|---|
| Pure transforms | A cleaning rule, a feature, a metric gives the hand-derived answer | most |
| Schemas / contracts | Bad input is rejected with the right column named | one per rule |
| Properties (Hypothesis) | Invariants hold for many generated inputs | a few, on core transforms |
| Pipeline smoke | Entry point runs end-to-end on a fixture, writes a loadable artifact | one per entrypoint |
| Model quality | Beats the baseline by a margin on planted signal, fixed seed | one or two per model |
| Determinism and parity | Same seed → same output; saved/loaded and served predictions equal training-time ones | one each |
| Warehouse | dbt data and unit tests (sql-analytics-and-dbt) | per model |
## 2. Fixtures: small, synthetic, explicit
Build them in the test or `conftest.py`. Never a production extract (PII, size, drift) and never the network.
```python
def test_order_value_sums_lines_and_ignores_cancelled() -> None:
lines = pd.DataFrame({
"order_id": ["o1", "o1", "o2", "o3"],
"amount": [10.0, 5.0, 7.0, 3.0],
"status": ["ok", "ok", "cancelled", "ok"],
})
expected = pd.Series({"o1": 15.0, "o3": 3.0}, name="order_value")
expected.index.name = "order_id"
...From makifbaysal's repository, Apache-2.0 licence.
Related skills
-
Checked
JUnit and Mockito tests
Writes and fixes Java tests with JUnit, AssertJ and Mockito that are deterministic and keep failures visible.
8/101 credit -
Checked
Test code review
Reviews new or changed tests in pytest, Jest, Go and more, so weak tests are caught before merge.
7/101 credit -
Checked
Go table driven tests
Writes Go tests with table cases, fakes, fuzzing, benchmarks and golden files that stay fast and reliable.
8/101 credit -
Checked
UX Click Budget Tests
Writes Playwright tests that fail when a signup or checkout flow needs more clicks or fields than allowed.
7/101 credit -
Checked
Test Cases From Tickets
Turns a ticket's acceptance criteria into traceable test cases with data, steps, expected results and proof.
7/101 credit -
Checked
VSTest to Testing Platform
Switches your .NET tests and CI from VSTest to Microsoft.Testing.Platform with the right settings and commands.
8/101 credit