Schema Evolution Manager
Design schema evolution strategies using Avro, Protobuf, and JSON Schema with compatibility enforcement via schema registries.
Activation Triggers
Activate on: "schema evolution", "Avro schema", "Protobuf", "backward compatibility", "forward compatibility", "schema registry", "breaking change", "schema migration", "schema versioning"
NOT for: Database DDL migrations → data-migration-specialist | API versioning → api-versioning-backward-compatibility | Data contract enforcement → data-quality-guardian
Quick Start
- Choose serialization — Avro (schema-with-data, compact), Protobuf (code-gen, fast), JSON Schema (human-readable)
- Set compatibility mode — BACKWARD (default for consumers), FORWARD (for producers), FULL (both)
- Deploy schema registry — Confluent Schema Registry or AWS Glue for centralized schema governance
- Test compatibility — check every schema change against the registry before deployment
- Plan for breaking changes — new topic/table + migration period, never in-place breaks
Core Capabilities
| Domain |
Technologies |
| Serialization |
Apache Avro 1.12+, Protobuf 5.x, JSON Schema 2020-12 |
| Registry |
Confluent Schema Registry, AWS Glue, Apicurio |
| Compatibility |
BACKWARD, FORWARD, FULL, NONE modes |
| Code Generation |
avro-codegen, protoc, json-schema-to-ts |
| Validation |
Schema compatibility checks, CI integration |
Architecture Patterns
Compatibility Mode Decision Matrix
BACKWARD FORWARD FULL
───────── ──────── ────
Allowed changes:
Add field YES (with default) YES YES (with default)
Remove field NO YES NO
Rename field NO NO NO
Change type NO NO NO
Use when:
Consumer-first YES NO NO
Producer-first NO YES NO
Both evolve NO NO YES
Default choice: Most common Rare Safest
Avro Schema Evolution Example
// v1: original schema
{
"type": "record",
"name": "UserEvent",
"namespace": "com.example",
"fields": [
{ "name": "user_id", "type": "string" },
{ "name": "email", "type": "string" },
{ "name": "created_at", "type": "long" }
]
}
// v2: BACKWARD compatible (new field with default)
{
"type": "record",
"name": "UserEvent",
"namespace": "com.example",
"fields": [
{ "name": "user_id", "type": "string" },
{ "name": "email", "type": "string" },
{ "name": "created_at", "type": "long" },
{ "name": "phone", "type": ["null", "string"], "default": null }
]
}
// Old consumers can read v2 data (they ignore `phone`)
// New consumers can read v1 data (`phone` defaults to null)
CI Schema Compatibility Check
#!/bin/bash
# ci/check-schema-compatibility.sh
REGISTRY_URL="http://schema-registry:8081"
SUBJECT="user-events-value"
SCHEMA_FILE="schemas/user-event.avsc"
# Check compatibility before merge
RESULT=$(curl -s -X POST \
"${REGISTRY_URL}/compatibility/subjects/${SUBJECT}/versions/latest" \
-H "Content-Type: application/vnd.schemaregistry.v1+json" \
-d "{\"schema\": $(cat $SCHEMA_FILE | jq -Rs .)}")
IS_COMPATIBLE=$(echo $RESULT | jq -r '.is_compatible')
if [ "$IS_COMPATIBLE" != "true" ]; then
echo "SCHEMA INCOMPATIBLE: $RESULT"
exit 1
fi
echo "Schema is compatible"
Anti-Patterns
- Removing required fields — under BACKWARD compatibility, removing a field without a default breaks old consumers
- Renaming fields — renaming is equivalent to remove + add; it breaks both readers and writers
- No default values — new fields must have defaults for backward compatibility; always provide one
- Skipping the registry — local schema files without centralized validation lead to runtime deserialization failures
- NONE compatibility mode — disabling compatibility checks "for speed" guarantees future production incidents
Quality Checklist
1---
2license: Apache-2.0
3name: schema-evolution-manager
4description: 'Avro, Protobuf, backward/forward compatibility for schema evolution. Activate on: schema evolution, Avro, Protobuf, backward compatibility, forward compatibility, schema registry, breaking change, schema migration. NOT for: database migrations (use data-migration-specialist), API versioning (use api-versioning-backward-compatibility).'
5allowed-tools: Read,Write,Edit,Bash(npm:*,npx:*,python:*,docker:*)
6category: Backend & Infrastructure
7tags:
8 - schema-evolution
9 - avro
10 - protobuf
11 - compatibility
12 - schema-registry
13pairs-with:
14 - skill: streaming-pipeline-architect
15 reason: Stream schemas must evolve without breaking consumers
16 - skill: event-driven-architecture-expert
17 reason: Event schemas need versioning for long-lived systems
18 - skill: cqrs-event-sourcing-architect
19 reason: Event store schemas must evolve while remaining replayable
20metadata:
21 source: https://skillmd.com/skills/curiositech/schema-evolution-manager
22---
23
24# Schema Evolution Manager
25
26Design schema evolution strategies using Avro, Protobuf, and JSON Schema with compatibility enforcement via schema registries.
27
28## Activation Triggers
29
30**Activate on:** "schema evolution", "Avro schema", "Protobuf", "backward compatibility", "forward compatibility", "schema registry", "breaking change", "schema migration", "schema versioning"
31
32**NOT for:** Database DDL migrations → `data-migration-specialist` | API versioning → `api-versioning-backward-compatibility` | Data contract enforcement → `data-quality-guardian`
33
34## Quick Start
35
361. **Choose serialization** — Avro (schema-with-data, compact), Protobuf (code-gen, fast), JSON Schema (human-readable)
372. **Set compatibility mode** — BACKWARD (default for consumers), FORWARD (for producers), FULL (both)
383. **Deploy schema registry** — Confluent Schema Registry or AWS Glue for centralized schema governance
394. **Test compatibility** — check every schema change against the registry before deployment
405. **Plan for breaking changes** — new topic/table + migration period, never in-place breaks
41
42## Core Capabilities
43
44| Domain | Technologies |
45|--------|-------------|
46| **Serialization** | Apache Avro 1.12+, Protobuf 5.x, JSON Schema 2020-12 |
47| **Registry** | Confluent Schema Registry, AWS Glue, Apicurio |
48| **Compatibility** | BACKWARD, FORWARD, FULL, NONE modes |
49| **Code Generation** | avro-codegen, protoc, json-schema-to-ts |
50| **Validation** | Schema compatibility checks, CI integration |
51
52## Architecture Patterns
53
54### Compatibility Mode Decision Matrix
55
56```
57 BACKWARD FORWARD FULL
58 ───────── ──────── ────
59Allowed changes:
60 Add field YES (with default) YES YES (with default)
61 Remove field NO YES NO
62 Rename field NO NO NO
63 Change type NO NO NO
64
65Use when:
66 Consumer-first YES NO NO
67 Producer-first NO YES NO
68 Both evolve NO NO YES
69
70Default choice: Most common Rare Safest
71```
72
73### Avro Schema Evolution Example
74
75```json
76// v1: original schema
77{
78 "type": "record",
79 "name": "UserEvent",
80 "namespace": "com.example",
81 "fields": [
82 { "name": "user_id", "type": "string" },
83 { "name": "email", "type": "string" },
84 { "name": "created_at", "type": "long" }
85 ]
86}
87
88// v2: BACKWARD compatible (new field with default)
89{
90 "type": "record",
91 "name": "UserEvent",
92 "namespace": "com.example",
93 "fields": [
94 { "name": "user_id", "type": "string" },
95 { "name": "email", "type": "string" },
96 { "name": "created_at", "type": "long" },
97 { "name": "phone", "type": ["null", "string"], "default": null }
98 ]
99}
100// Old consumers can read v2 data (they ignore `phone`)
101// New consumers can read v1 data (`phone` defaults to null)
102```
103
104### CI Schema Compatibility Check
105
106```bash
107#!/bin/bash
108# ci/check-schema-compatibility.sh
109
110REGISTRY_URL="http://schema-registry:8081"
111SUBJECT="user-events-value"
112SCHEMA_FILE="schemas/user-event.avsc"
113
114# Check compatibility before merge
115RESULT=$(curl -s -X POST \
116 "${REGISTRY_URL}/compatibility/subjects/${SUBJECT}/versions/latest" \
117 -H "Content-Type: application/vnd.schemaregistry.v1+json" \
118 -d "{\"schema\": $(cat $SCHEMA_FILE | jq -Rs .)}")
119
120IS_COMPATIBLE=$(echo $RESULT | jq -r '.is_compatible')
121
122if [ "$IS_COMPATIBLE" != "true" ]; then
123 echo "SCHEMA INCOMPATIBLE: $RESULT"
124 exit 1
125fi
126echo "Schema is compatible"
127```
128
129## Anti-Patterns
130
1311. **Removing required fields** — under BACKWARD compatibility, removing a field without a default breaks old consumers
1322. **Renaming fields** — renaming is equivalent to remove + add; it breaks both readers and writers
1333. **No default values** — new fields must have defaults for backward compatibility; always provide one
1344. **Skipping the registry** — local schema files without centralized validation lead to runtime deserialization failures
1355. **NONE compatibility mode** — disabling compatibility checks "for speed" guarantees future production incidents
136
137## Quality Checklist
138
139- [ ] Schema registry deployed and enforced (no bypass)
140- [ ] Compatibility mode set: BACKWARD for consumer-first, FULL for maximum safety
141- [ ] All new fields have default values
142- [ ] CI pipeline checks schema compatibility before merge
143- [ ] Breaking changes require new subject/topic + migration plan
144- [ ] Schema changes documented in changelog with migration notes
145- [ ] Producers and consumers tested against both old and new schemas
146- [ ] Schema IDs embedded in messages (Confluent wire format)
147- [ ] Unused schemas deprecated and cleaned up quarterly
148- [ ] Team trained on compatibility rules for their serialization format