model-tests
Skill2 starsChanged 3 months agoMITView on GitHub
Designs and reviews tests for analytical model behavior and data contracts. Use when adding generic, singular, unit, relationship, key, accepted-value, or expression tests; when investigating missing, redundant, or misplaced model-test coverage; when translating a modeled risk into a test; or when build-model needs tests for a model.
In this repository24 other files it gives its agents.
- analytics-requirementsSkill
- api-pipelineSkill
- bi-modelSkill
- build-modelSkill
- data-model-reviewSkill
- data-profileSkill
- data-quality-investigationSkill
- dbt-healthSkill
- explain-data-codeSkill
- freshness-investigationSkill
- incremental-modelSkill
- metric-definitionSkill
- migration-planSkill
- model-documentationSkill
- project-profileSkill
- pr-reviewSkill
- refactor-modelSkill
- rename-modelSkill
- semantic-layerSkill
- source-setupSkill
- sql-reviewSkill
- trace-lineageSkill
- validate-dbtSkill
- yaml-maintenanceSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Add or review tests for model keys, relationships, allowed values, expressions, business rules, or transformation behavior.
- Very specific: line 15
When build-model reaches its testing step, perform this discovery automatically.
- Distinctive: line 16
Do not use for source-level tests, prose documentation, or YAML-only reorganization unless those domains are independently triggered.
- Very specific: line 20
Read .ae/exercise.json when present and honor its mode, constraints, rubric, allowed tools, and artifacts.
- Distinctive: line 33
Use the least complex demonstrated test form: built-in generic, installed package or project macro, singular SQL, then unit test when …
- Distinctive: line 35
Add relationship tests only when the intended referential rule and null policy are known.
- Distinctive: line 36
Keep tests at the model whose contract they protect.
- Very specific: line 39
If composing with build-model, return tests, protected risks, paths, and any unresolved contract gate.
- Distinctive: line 64
Read singular tests as assertions: zero returned rows must mean success.
- Distinctive: line 72
Use synthetic fixtures only.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Model Tests
Turn demonstrated model risks and contracts into the smallest tests that would detect them.
When to use
- Add or review tests for model keys, relationships, allowed values, expressions, business rules, or transformation behavior.
- Identify missing, redundant, contradictory, brittle, or incorrectly scoped model-test coverage.
- Translate grain, join, null, enumeration, and regression risks into generic, singular, or unit tests.
- When
build-modelreaches its testing step, perform this discovery automatically; users do not need to invoke another skill. - Do not use for source-level tests, prose documentation, or YAML-only reorganization unless those domains are independently triggered.
Mode and conventions
Read .ae/exercise.json when present and honor its mode, constraints, rubric, allowed tools, and artifacts. Otherwise use a user-requested mode; if none is requested, silently use Work.
- Work: design evidence-backed tests and make only authorized changes.
- Learn: expose risks through a hint ladder and let the learner author the tests.
- Assessment: evaluate submitted tests against the stated rubric without supplying replacements or editing them.
Read .ae/project.yml first and treat human edits as authoritative. If absent, run python3 "${CURSOR_PLUGIN_ROOT}/scripts/infer_conventions.py" <project-root> --json and inspect neighboring model YAML, singular tests, unit tests, packages, and macros. Infer test syntax, placement, arguments, severity, naming, and key defaults from repository evidence. Apply strong conventions silently, state weak assumptions, ask about genuine splits, and label defaults when evidence is absent.
Procedure
- State the model grain, candidate key, joins, filters, transformations, and documented contract from local artifacts.
- Inventory existing tests and distinguish what each actually proves from what its name suggests.
- Rank concrete failure risks by impact and likelihood. Add a test only when its failing rows and protected behavior can be stated.
- Use the least complex demonstrated test form: built-in generic, installed package or project macro, singular SQL, then unit test when fixture-level transformation behavior is the subject.
- Attach key tests only to a key the model logic can support. For composite grain, follow the repository's established combination test or singular-test pattern.
- Add relationship tests only when the intended referential rule and null policy are known. Do not turn optional relationships into false failures.
- Keep tests at the model whose contract they protect; do not duplicate upstream checks unless this model can reintroduce the defect.
- Confirm macros, packages, fixtures, refs, sources, and columns referenced by each proposed test exist locally.
- Apply explicitly requested, reversible test additions and edits in project-owned YAML, SQL, or synthetic fixtures without asking for a second approval. Preview and ask before deleting tests, weakening an established contract, or expanding beyond the requested model.
- If composing with
build-model, return tests, protected risks, paths, and any unresolved contract gate; do not redo source setup, model SQL, documentation, or structural YAML cleanup.
Evidence required
For every proposed test, cite the SQL, contract, requirement, incident, or downstream use establishing the invariant. State the expected failing rows or fixture behavior and why the chosen model is the correct boundary. Report convention counts when available and mark warehouse-dependent assumptions unverified.
Failure modes
- Adding
uniquebecause a column looks like an ID without establishing model grain. - Treating
not_nullplusuniqueas proof of business correctness. - Testing optional relationships as mandatory or ignoring accepted null semantics.
- Duplicating upstream tests that cannot fail because of this model's logic.
- Introducing a package macro or test syntax absent from project dependencies.
- Writing a singular test whose passing condition is reversed or whose scope is unbounded.
- Confusing test YAML placement with structural YAML maintenance.
- Running dbt or querying a warehouse instead of reporting execution as unverified.
Output contract
For ordinary creation or editing, return # Model Tests with: Changed; Why each test exists; Verified; Remaining uncertainty. Name the model grain and the risk protected by each test. Use formal severity and evidence findings only when reviewing coverage or reporting a material risk.
Verification
- Statically validate each model, column, macro, package, fixture,
ref, andsourcereference. - Confirm generic-test argument syntax matches the repository's dbt version and examples.
- Read singular tests as assertions: zero returned rows must mean success.
- Confirm tests are capable of failing for the stated defect and are not exact duplicates.
- Parse proposed YAML and SQL with available local static tools.
- Propose the smallest
dbt testordbt build --selectcommand without running it.
Safety/privacy
- Local Basic only: use local files and static local tools; never call MCP, execute dbt, or contact a warehouse.
- Use synthetic fixtures only; never copy raw production rows, PII, credentials, or sensitive values into tests.
- New files may be created and must be listed.
- Explicitly requested reversible test edits may proceed; deletion, contract weakening, and scope expansion require preview, blast radius, and approval.
- In Assessment mode, perform read-only evaluation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

