Author your first data contract
Draft an enforceable contract for one real dataset by walking the six parts — owner, schema, semantics, SLA, breaking-change policy, enforcement — starting from the data-contract template, and finish with the CI test that makes it a contract instead of documentation.
At a glance
| When | A producer and its consumers keep arguing about what a column means; A dataset feeds multiple teams and needs a freshness or completeness SLA |
|---|---|
| Where | Data Contracts |
| Why | A contract with no enforcement is documentation, and documentation is not a contract — the sixth part is what makes the other five binding. |
Learning objectives
- Write all six parts of a contract for a real dataset
- Specify freshness and completeness numbers in the SLA
- Name the CI test that fails when the contract is violated
What you need
- A producer dataset with at least one consumer
- [object Object]
- [object Object]
Steps
- Name an owner — a team, with an on-call. (from skill-data-contract-author )
- Define the schema, typed and versioned. (from skill-data-contract-author )
- Write the semantics: what each field means, units, nullability. (from skill-data-contract-author )
- Set the SLA — freshness and completeness. (from skill-data-contract-author )
- Agree the breaking-change policy — notice period and a deprecation path. (from skill-data-contract-author )
- Wire enforcement: name the CI test that fails on violation. (from skill-data-contract-author )
Check yourself
- The contract names a team with an on-call as owner, not a distribution list.
- Renaming a promised field in a test branch fails the CI test named in part six.
Worked example
Scaffold the contract repo — from tpl-data-contract
amp template new de-agent/data-contract-template ./contracts
The six parts of a contract — from skill-data-contract-author
1. Owner (a team, with an on-call).
2. Schema (typed, versioned).
3. Semantics (what each field *means*, units, nullability).
4. SLA (freshness, completeness).
5. Breaking-change policy (notice period, deprecation path).
6. Enforcement (which CI test fails on violation).
Template layout — contract, schema, CI gate, deprecation path — from tpl-data-contract
data-contract-template/
contract.yaml # owner, sla, semantics, policy
schema.avsc # typed schema
ci/check-compat.sh # compatibility gate
DEPRECATION.md # dated deprecation path
Sourced from
Security scan
Last sweep 2026-10-24: 0 finding(s), 0 marked as examples.
Common gotchas
- A contract with no enforcement is documentation. Documentation is not a contract.
- The owner is a team with an on-call — a contract owned by nobody has no pager.
- A rename + a new column with the old name looks compatible to a schema differ but breaks every consumer that read the old semantics — write the semantics section so the diff catches it.
Production considerations
- Enforcement is part six — the contract must name the CI test that fails on violation.
- Keep contract.yaml, schema.avsc, ci/check-compat.sh and DEPRECATION.md together; the template ships all four.
Diagram
contract authoring
|
|- owner + schema --> semantics (units, nullability)
|
|- SLA (freshness, completeness) --> breaking-change policy
|
|- enforcement --> CI test fails on violation --> contract, not documentation
Registry stats
| Verification | community · Oct 21, 2026 |
|---|---|
| Completeness | 81 |
| Trust multiplier | ×1.25 |
| Composite | 34.15 · adequate |
| Freshness | 3 days since last source check |
| Difficulty | beginner |
| Version | 0.1.0 |
| License | CC-BY-4.0 |
| Security flags | none |
Did this solve your problem?
Author your first data contract