Skip to content
Back to skills

Data Contracts Schema Governance

ASecurity

Use when implementing data contracts and schema governance.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
ai-agentspythongotestingapidatabaseci/cd

Works with

  • api

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill data-contracts-schema-governance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Contracts Schema Governance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Data Contracts Schema Governance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-data-contracts-schema-governance/badge)](https://www.skillsdirectory.com/skills/loopyluci-data-contracts-schema-governance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: data-contracts-schema-governance
description: "Use when implementing data contracts and schema governance."
version: 1.0.0
author: Hermes Agent
license: MIT
metadata:
  hermes:
    tags: [data-contracts, schema-governance, Avro, Protobuf, data-lineage, data-quality]
    related_skills: [data-profiling-quality, data-pipeline-streaming, database-schema-design, ml-pipeline-design]
---

# Data Contracts and Schema Governance

Implementing data contracts and schema governance — from schema registries (Avro, Protobuf) through contract testing, data lineage, and breaking change detection.

## When to Use

- Ensuring data quality between producers and consumers
- Managing schema evolution across microservices
- Detecting breaking schema changes in CI/CD
- Building data lineage and impact analysis
- Establishing data ownership and SLAs

## Data Contract Patterns

```python
DATA_CONTRACT_EXAMPLE = {
    'dataset': 'user_events',
    'owner': 'team-analytics',
    'schema_version': '1.2.0',
    'schema': {
        'type': 'record', 'name': 'UserEvent',
        'fields': [
            {'name': 'user_id', 'type': 'string'},
            {'name': 'event_type', 'type': 'string'},
            {'name': 'timestamp', 'type': 'long', 'logicalType': 'timestamp-millis'},
            {'name': 'properties', 'type': {'type': 'map', 'values': 'string'}},
        ],
    },
    'slas': {'freshness': '5min', 'completeness': '99.9%', 'volume_min': 1000},
    'consumers': ['team-product', 'team-ml'],
}

class SchemaCompatibility:
    """Check schema compatibility to prevent breaking changes."""
    
    @staticmethod
    def check_backward(original_schema: dict, new_schema: dict) -> bool:
        """Backward compatible: new reader can read old data."""
        original_fields = {f['name']: f for f in original_schema.get('fields', [])}
        new_fields = {f['name']: f for f in new_schema.get('fields', [])}
        
        for name, orig_field in original_fields.items():
            if name not in new_fields:
                return False  # Can't delete fields
            if orig_field['type'] != new_fields[name]['type']:
                # Allowed: widening type (int → long, string → union)
                if not SchemaCompatibility._is_widening(orig_field['type'], new_fields[name]['type']):
                    return False
        return True
```

## Verification Checklist

- [ ] Schema registry deployed (Confluent, Apicurio, or custom)
- [ ] Compatibility mode defined for each topic (backward, forward, full, none)
- [ ] Data contract document defined per dataset (owner, schema, SLAs, consumers)
- [ ] Breaking change detection in CI/CD pipeline
- [ ] Schema evolution documented in data contract versions
- [ ] Data lineage tracked (producer → topic → consumer)
- [ ] Data quality metrics monitored per contract

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.