marten-aggregates

Design event-sourced aggregates with sealed records and decider pattern in Marten.

Updated Apr 21, 2026
One-click install
npx skills add https://github.com/erikshafer/CritterCab --skill marten-aggregates
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: marten-aggregates
Source: https://github.com/erikshafer/CritterCab/tree/main/docs/skills/marten-aggregates
Command: npx skills add https://github.com/erikshafer/CritterCab --skill marten-aggregates

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Marten, Wolverine, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers design and implement event-sourced aggregates using Marten in the CritterCab architecture, addressing the complexities of event sourcing and ensuring proper aggregate design.

Core Features & Use Cases

  • Aggregate Design: Provides guidelines for designing event-sourced aggregates, including sealed record shape, static Apply methods, and stream identity.
  • Event Sourcing Best Practices: Offers best practices for event sourcing in the CritterCab ecosystem, such as the decider pattern and handling of state evolution.
  • Use Case: For a developer looking to implement an event-sourced aggregate in a ride-sharing application, this Skill outlines the structure and conventions for the aggregate, event handling, and projection design.

Quick Start

Apply this skill when designing a new event-sourced aggregate in CritterCab by following the conventions and patterns described.

Frequently Asked Questions about marten-aggregates

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

FAQPage Schema
How do I design event-sourced aggregates with Marten in .NET?

Design event-sourced aggregates with Marten by using sealed record shapes for state, static Apply methods for event handling, and the decider pattern to separate state transitions from command processing.

What is the decider pattern for event sourcing in Marten?

The decider pattern for event sourcing in Marten separates command handling from state evolution by using static Apply methods on sealed record aggregates, ensuring immutable state transitions within the CritterCab architecture.

Can I use Wolverine with Marten for event-sourced aggregate handling?

Yes, Marten handles the event sourcing storage while Wolverine manages command handling and routing for the event-sourced aggregates, together providing the full CritterCab ecosystem infrastructure.

What's the best way to structure Marten aggregate events and state?

Structure Marten aggregate events and state by defining the aggregate as a sealed record, applying events through static methods, and managing stream identity to maintain proper event sourcing conventions.

When do I need event-sourced aggregates in a .NET application?

You need event-sourced aggregates in a .NET application when you require an immutable audit log of state changes, utilizing Marten for event storage and Wolverine for decider pattern command processing.

Why use sealed records for Marten event-sourced aggregates?

Sealed records are used for Marten event-sourced aggregates to enforce immutability and provide concise value equality, which aligns with the static Apply method conventions and state evolution handling.