← ClaudeAtlas

grain-probelisted

Prove a model's declared grain by executing a duplicate-key query against the built table and reporting rows, distinct keys, and the top offending key values. Run before any aggregation claim is trusted, before approving any fact-to-dimension join, after a grain or key change, and as the uniqueness column of every model audit. Proves the key IS unique in the data — `contract-diff` proves the upstream SHAPE has not changed under it, and `lineage-trace` proves who would be affected if it had.
adnanmokhtar/refract · ★ 1 · AI & Automation · score 77
Install: claude install-skill adnanmokhtar/refract
# Skill: grain-probe ## Premise A grain is a claim about data, so it is settled by data. Reading the SQL tells you what the author intended; only the probe tells you what is in the table. Every output cites the model, the key expression probed, the row count, the distinct-key count, and — when they differ — real offending key values with their duplicate counts. No estimate, no sampling shortcut, no "the primary key constraint covers it" (most analytical platforms do not enforce constraints; several accept them as documentation and ignore them at write time — confirm which yours does before ever treating one as proof). ## Halt conditions - **No declared grain.** Refuse to probe. A probe of a key nobody declared proves nothing; get the grain sentence from `@warehouse-modeler` first. - **Model not built.** Probe the materialised output, never the definition. A view whose upstream has not run is not evidence. - **PII classification unknown** and the offending-value sample would print identifiers. Report counts only, and say the sample was withheld. - **Filtered scope not stated.** If the probe runs on a partition subset (for cost), the output must name the subset — a unique result on last week does not clear the table. ## When to run - Before any verdict from `@warehouse-modeler`, `@data-quality-auditor`, or `/audit-data-model` that touches uniqueness. - Before approving a fact-to-dimension join, on the dimension's join key. - After any change to a model's grain, key expre