Data contract authoring
data-contract-authoring · v1.0.0
ivyx
Use when someone asks for a data contract, a pandera schema or a validation gate (veri kontratı, şema kontrolü, pandera, doğrulama) for a training file, or wants the pipeline to refuse bad data before training (eğitimden önce bozuk veriyi reddetsin); drafts the contract from a profile and adds it to the pipeline as a gate stage. Not for a first look at a file.
Who is asked
Risk medium: you are asked when it loads, and that yes covers reading its files in the same chat.
Tools it may call
While this skill is active, a call to any other tool is refused. These still meet every policy rule; the list narrows, it approves nothing.
duckdb.inspectprofiler.profilemlops.pandera.contractFromProfilemlops.pipeline.describemlops.stage.addWhat it tells the agent
The published SKILL.md, as written.
--- name: data-contract-authoring description: Use when someone asks for a data contract, a pandera schema or a validation gate (veri kontratı, şema kontrolü, pandera, doğrulama) for a training file, or wants the pipeline to refuse bad data before training (eğitimden önce bozuk veriyi reddetsin); drafts the contract from a profile and adds it to the pipeline as a gate stage. Not for a first look at a file. allowed-tools: duckdb.inspect profiler.profile mlops.pandera.contractFromProfile mlops.pipeline.describe mlops.stage.add metadata: risk: medium ---
A data contract for a training file
A contract is written from what the data measurably is, then added to the
pipeline as the first gate. You do not write the contract file or edit
.punica/mlops.yaml by hand: the two capabilities below write them, and the
person says yes to each write.
1. Measure the data
duckdb.inspectwith the file's path asfile: columns, row count, the first rows.profiler.profilewith{ "path": "<file>" }: per column, the type, the null share, the distinct count, and for numbers the min and max. Keep the result; the next step takes it as its input.
2. Draft the contract from the profile
mlops.pandera.contractFromProfile with the profile you just got (or the
file's path, which profiles again), contract as the path to write
(contracts/<file-stem>_contract.py unless the person named one), and:
ranges: truewhen the person wants bad values refused,falsewhen they want only the columns and types checked. Say which you chose and why.- Leave
strictoff unless they said a new column should fail the check.
Read the answer's columns and notes: a column the profile saw with
nulls, a label column with few distinct values, a range that looks like a
measurement limit. Report them as sentences, with the measured numbers.
Then read the draft against the data: the draft accepts every value the
file holds today, so a value that is already wrong in the file passes it.
For the label or class column, list its distinct values from the profile;
if the draft checks it with a range (in_range(0, 2)) rather than by its
allowed values, say so in your report and name the line the person should
change (pa.Check.isin([0, 1]) with the values they consider valid). You
do not edit the file yourself.
3. Add it to the pipeline
mlops.pipeline.describe: the stages in order and the engine.mlops.stage.addwithcapabilityset to the pandera validate gate's id as the describe output or the catalogue names it,id: "pandera",title,onFailure: "stop", andinputholdingcontract(the path written in step 2) anddata(the file). It is placed before the training step; readorderfrom the answer and say it.
If a contract stage already exists, do not add a second one; report the existing one and the contract it points at.
4. Report
- The contract path, the columns it checks and with what (type, nulls, range, values), each with the number it came from.
- The stage: its id, where it sits in the order, what a failing run will say.
- What to look at before trusting it: a range taken from a small sample, a column the profile found empty.
- Offer to run the pipeline once the person is ready; do not run it yourself.