event-versioning

Evolve event schemas with upcasters and versioned event data classes.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill event-versioning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: event-versioning
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/microservice/command/event-versioning
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill event-versioning

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Evolving event schemas in event-sourced systems without breaking consumers, corrupting historical data, or causing replay and projection failures.

Core Features & Use Cases

  • Backward-compatible schema changes: Add nullable fields with defaults and rely on direct deserialization where possible.
  • Upcaster pattern & registration: Define and register upcasters to transform old event shapes to new ones during aggregate replay or projection builds.
  • Migration & snapshot strategies: Choose between lazy upcasting on read and controlled batch migration, and manage snapshot versioning and invalidation.

Quick Start

Use the event-versioning skill to create a new versioned event type, implement an upcaster from V1 to V2, and register the upcaster in your DI container.

Frequently Asked Questions about event-versioning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I evolve event schemas in an event-sourced system without breaking consumers?

To evolve event schemas safely, use backward-compatible changes like adding nullable fields with defaults, and implement upcasters to transform old event shapes to new ones during aggregate replay or projection builds.

What is the upcaster pattern for event schema migration?

The upcaster pattern transforms old event data shapes to new versions during aggregate replay or projection builds. You define upcasters and register them in your dependency injection container to handle versioned event deserialization.

How do I implement event versioning with type and version deserialization?

Event versioning requires versioned event data classes and a Version discriminator for type and version deserialization. This allows the system to identify event versions and apply the correct upcaster transformations during replay.

What's the best way to handle snapshots when evolving event schemas?

Manage snapshot versioning and invalidation by choosing between lazy upcasting on read or controlled batch migration. This ensures snapshots remain compatible when event schemas change during aggregate replay.

When should I use lazy upcasting versus controlled batch migration for event data?

Use lazy upcasting to transform old event shapes on read during aggregate replay, or choose controlled batch migration for systematic updates. The choice depends on your read patterns and how quickly you need all historical events converted.

Do I need upcasters for backward-compatible event schema changes?

For backward-compatible changes like adding nullable fields with defaults, you can rely on direct deserialization without upcasters. Upcasters are needed when event shapes change in ways that require transforming old event data to new structures.