Validate data before trusting it: schema contracts for JSON rows, null/empty handling policy, range and enum checks, referential consistency between datasets, runnable assertions that fail loudly, and quarantine-vs-drop policy for bad rows. Triggers on: validate data, check data quality, schema for API response, bad rows, validate LLM output, data contract, assert data shape.
./install.sh data-validationname: "data_validation" description: "Validate data before trusting it: schema contracts for JSON rows, null/empty handling policy, range and enum checks, referential consistency between datasets, runnable assertions that fail loudly, and quarantine-vs-drop policy for bad rows. Triggers on: validate data, check data quality, schema for API response, bad rows, validate LLM output, data contract, assert data shape." metadata: { "includeInPrompt": true }
Put a contract between you and any data you didn't produce (API responses, files, LLM output) and check every row against it before downstream code touches it. Unvalidated data is the classic source of silent corruption: a missing field, a negative price, or a dangling foreign key that poisons results hours later. Validate once at the boundary, fail loudly, and quarantine bad rows instead of silently dropping them.
jsonschema schema before you look at the payload: types, required fields, minimum/maximum or exclusiveMinimum for ranges, enum for allowed values, additionalProperties: False to catch renamed fields. A schema is the contract; guessing what fields "should" be there is not a contract.null missing and "" empty are three different states. Say in the schema which fields are required, whether empty strings pass minLength: 1, and whether an absent optional field is fine. If you haven't decided, you haven't validated.seller_id means nothing if the sellers table doesn't contain it. Collect key sets from each dataset and assert membership — referential consistency catches joins that would silently lose rows.assert or explicit raise) so a violation stops the run with a clear message. Converting "N/A" to 0 or dropping a row without logging hides bugs; coercion is a decision, and silent coercion is a bug.Example suite (run: python3 -c "..." after saving; every assertion here was executed):
python
from jsonschema import Draft202012Validator
SCHEMA = {
"type": "object",
"properties": {
"id": {"type": "string", "minLength": 1},
"price": {"type": "number", "exclusiveMinimum": 0},
"currency": {"type": "string", "enum": ["USD", "EUR"]},
},
"required": ["id", "price", "currency"],
"additionalProperties": False,
}
v = Draft202012Validator(SCHEMA).validate
rows = [{"id": "p1", "price": 12.5, "currency": "USD"},
{"id": "p2", "price": -4.0, "currency": "USD", "seller": "s9"}]
known_sellers = {"s1"}
good, quarantine = [], []
for r in rows:
try:
v(r)
assert r.get("seller", "s1") in known_sellers, "dangling seller ref"
good.append(r)
except Exception as e:
quarantine.append((r, str(e))) # quarantined with reason
assert len(good) == 1 and len(quarantine) == 1 # loud gate
After applying this skill, an agent should produce:
publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.