Practice

How to Write Your First Data Contract in Under an Hour

A step-by-step guide to writing your first data contract. No special tools required. Start with one dataset, one producer, and one consumer.


The most common reason data contracts do not get implemented is the assumption that they require a major initiative. A platform decision. Executive sponsorship. A six-month roadmap. None of that is true. Your first contract can be written today, in under an hour, using a markdown file in a git repository.

Before You Start

Choose one dataset. Specifically, choose the one that causes the most downstream pain when it is wrong. This gives you an early win that the whole team can see. Identify the producer and the consumers. You need input from both.

Step 1: Define the Schema (15 minutes)

Write down every field in the dataset. For each, document: name (exact field name), type (string/integer/float/timestamp/boolean), nullable (can it ever be null, and under what conditions), and one concrete example value. This sounds tedious and almost always surfaces at least one assumption that was wrong.

Step 2: Write Semantic Definitions (20 minutes)

For every field that could be ambiguous, write one plain English sentence describing what it means, not what it is named. Example: customer_id - The unique identifier assigned at account creation in the CRM. This is not the same as the billing account ID, which can have multiple customers per account. Pay special attention to fields that appear in multiple systems.

Step 3: Set Quality Thresholds (10 minutes)

For each critical field: completeness (what percentage can be null?), uniqueness (are values expected to be unique?), range or allowed values (what is valid?), and freshness (how old can this data be?). Start conservative. It is easier to loosen thresholds later than to tighten them after consumers have built on loose assumptions.

Step 4: Assign Ownership

Every contract needs a named producer owner: a team and ideally a person. This is the accountability anchor. When the contract is violated, there is no ambiguity about who resolves it.

A walkthrough of writing and implementing a data contract from scratch, covering schema definition, semantic documentation, and enforcement setup.

Step 5: Version and Commit

Store the contract in the same git repository as the pipeline it governs. Version it. When the schema changes, the contract changes with it and the change history is preserved. This is governance-as-code: auditable, reviewable, and as rigorous as the code it documents.

Your first contract will feel imperfect. That is correct. A contract covering 80% of what matters is infinitely more valuable than a perfect contract that never gets written.

Want a contract template to start from? Get in touch and we will send you the one we use.

Similar posts

Get notified on new Proof, Provocation, and Practice posts

Dogfood evidence, category argument, and transferable engineering method — straight from the team building the harness.