test-ml-pipeline
Owns the `tests/` folder of an ML workspace and the pairing rule between an experiment and its tests. Lightweight router: every test category has its own subskill (`smoke-test-ml-pipeline` is the only one for v1; `regression-test-ml-pipeline` / `distribution-test-ml-pipeline` etc. plug in as siblings as the workspace grows). This skill places an empty `tests/<category>/` folder, enforces the stem-pairing rule between `tests/<category>/test_NN_<short_name>.py` and `experiments/NN_<short_name>.py`, and dispatches to the matching subskill when the user asks for a test. TRIGGER when: a new design note was just approved by `iterate-ml-experiment` and the matching test has to be drafted before the experiment can be marked done; the user asks "write the smoke test for `02`", "add the regression test", "do we have a test for X?"; an experiment script was edited and the paired test needs revisiting; about to run `pytest tests/` and one of the expected paired tests is missing. SKIP when: the des
probabl-ai · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add probabl-ai/skills --skill test-ml-pipeline技能说明
name: test-ml-pipeline
description: >
Owns the tests/ folder of an ML workspace and the pairing
rule between an experiment and its tests. Lightweight router:
every test category has its own subskill (smoke-test-ml-pipeline
is the only one for v1; regression-test-ml-pipeline /
distribution-test-ml-pipeline etc. plug in as siblings as the
workspace grows). This skill places an empty tests/<category>/
folder, enforces the stem-pairing rule between
tests/<category>/test_NN_<short_name>.py and
experiments/NN_<short_name>.py, and dispatches to the matching
subskill when the user asks for a test.
TRIGGER when: a new design note was just approved by
iterate-ml-experiment and the matching test has to be drafted
before the experiment can be marked done; the user asks "write
the smoke test for 02", "add the regression test", "do we have
a test for X?"; an experiment script was edited and the
paired test needs revisiting; about to run pytest tests/
and one of the expected paired tests is missing.
SKIP when: the design note does not yet exist (route to
iterate-ml-experiment first); the test is for the package's
internal helpers and unrelated to a specific experiment (regular
unit tests live wherever the project's pytest config picks
them up — out of scope here); the question is what does the
test result mean rather than should the test exist (route to
the matching subskill).
HOW TO USE: this skill is a router. Read the dispatch table to figure out which subskill owns the test category the user is asking about, then hand off. Do not write the test body yourself — that belongs to the subskill. Do place the empty test file with the matching stem and the pytest scaffolding, then hand control over.
Test ML Pipeline (router)
Where tests for an ML workspace live, what gets paired with what, and which subskill owns the body of each test category.
First action (every turn)
Before answering anything else:
- Confirm an approved design note exists for the test
the user is asking about. The pairing rule is hard:
tests/<category>/test_NN_<short_name>.pyonly exists ifjournal/NN_<short_name>.mdis at leastapprovedandexperiments/NN_<short_name>.pyis the matching script. If the design note doesn't exist, hand back toiterate-ml-experiment. - Emit the Pre-flight checklist (below) as visible text in your response, with each box marked.
- Use the Dispatch table to pick the subskill that owns the test category, then hand off.
Pre-flight — emit this checklist as visible text before any test work
Pre-flight (test-ml-pipeline):
- [ ] `journal/NN_<short_name>.md` exists and is at least `approved`
(or confirmed n/a — about to hand off to `iterate-ml-experiment`)
- [ ] `experiments/NN_<short_name>.py` exists with the matching stem
(or confirmed n/a — about to hand off to `organize-ml-workspace`)
- [ ] Test category picked: smoke | regression | distribution | …
- [ ] Subskill dispatched: `smoke-test-ml-pipeline` | …
- [ ] Test file stem decided: `tests/<category>/test_NN_<short_name>.py`
- [ ] pytest is on the project's dependency manifest (per
`data-science-python-stack` § Tier 1)
Stop conditions — read before anything else
- No test without an approved design note. Never create
tests/<category>/test_NN_*.pyif the matchingjournal/NN_*.mdisn't on disk and at leastapproved. The design note is the contract; the test asserts the contract holds. Reverse order is incoherent. - The stem rule is hard. Test file basename is
test_NN_<short_name>.py(with thetest_prefix that pytest expects); theNN_<short_name>portion matches the experiment exactly. One experiment → one test file per category. Notest_<NN>_v2.py, notest_NN_<short_name>_2.py. If a test needs to evolve, edit it in place; the pairing must stay 1:1. - One subskill per category. This skill only places the empty
test file and hands off. Don't write assertion bodies, fixture
construction, or test-specific logic in this skill — that belongs
to the matching subskill (
smoke-test-ml-pipeline, etc.). - pytest is the runner. Tests are pytest tests, not
jupytext-style
# %%scripts. The experiment scripts live inexperiments/and stay# %%-style for interactive iteration; the tests are binary pass/fail and benefit from pytest's reporting. Don't mix the two conventions.
Layout this skill owns
project/
└── tests/
├── smoke/
│ ├── test_01_baseline.py # ↔ experiments/01_baseline.py
│ ├── test_02_short_name.py
│ └── ...
└── (future: regression/, distribution/, …)
The pairing rule:
journal/NN_<short_name>.md
experiments/NN_<short_name>.py
tests/<category>/test_NN_<short_name>.py
— same NN_<short_name> stem in all three. The test_ prefix on
the test file basename is the pytest naming convention; everything
after it tracks the experiment.
The tests/<category>/ subfolder lets the workspace grow more
test types without renaming anything. tests/smoke/ is the only
required category for v1.
Test categories — Dispatch table
Use the user's signal first; fall back to the defaults at the bottom.
| Situation | Subskill |
|---|---|
| Brand-new experiment was just approved; need to wire its smoke test | smoke-test-ml-pipeline |
User says "write the smoke test for 02", "the smoke test is failing", "what should the smoke test for X assert?" | smoke-test-ml-pipeline |
User says "the metrics drifted between 02 and 03, can we lock that in?", "regression test against last week's run" | regression-test-ml-pipeline (future — not implemented in v1) |
| User says "predictions are out of range", "calibration looks off in production", "schema invariants" | distribution-test-ml-pipeline (future — not implemented in v1) |
| User asks an open-ended "should th |