scaffold-aggregate

Scaffold event-sourced aggregates with Apply methods and Marten configuration.

15|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/aalmada/BookStore --skill scaffold-aggregate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scaffold-aggregate
Source: https://github.com/aalmada/BookStore/tree/main/.claude/skills/scaffold-aggregate
Command: npx skills add https://github.com/aalmada/BookStore --skill scaffold-aggregate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps domain teams implement event-sourced aggregates by providing a ready-to-use scaffold that enforces Apply methods, consistent event definitions, and Marten-ready configuration. It reduces boilerplate and ensures patterns align with the project's event-sourcing standards.

Core Features & Use Cases

  • Automated aggregate scaffolding: Generate the initial aggregate record, the initial event, and the Marten configuration skeleton.
  • Pattern enforcement: Ensures the Apply methods are void with a single event parameter and provides templates for subsequent events.
  • Guided implementation: Walks through creating factory methods, behavior methods that return events, and unit-test scaffolding for the new aggregate.
  • Use Case: A developer adds a new domain entity (e.g., Author) and uses this skill to generate the Author aggregate boilerplate, ready for event-sourcing integration.

Quick Start

Scaffold a new Author event-sourced aggregate with an AuthorCreated event and Marten configuration.

Frequently Asked Questions about scaffold-aggregate

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

FAQPage Schema
How do I scaffold a C# event-sourced aggregate with Marten?

To scaffold a C# event-sourced aggregate, generate the initial aggregate record, initial event, and Marten configuration skeleton. This process enforces Apply methods, consistent event definitions, and analyzer-compliant patterns for robust domain design.

What is an event-sourced aggregate and how does it handle events in .NET?

An event-sourced aggregate is a domain entity that reconstructs its state by applying events. In .NET, it uses void Apply methods with a single event parameter, immutable records for proven immutability, and Guid.CreateVersion7 for consistent ID generation.

Does Marten work with event-sourcing patterns for C# domain entities?

Marten works with event-sourcing patterns for C# domain entities by providing a ready-to-use configuration skeleton. It aligns with event-sourcing standards by enforcing naming conventions and analyzer-compliant patterns for aggregate behavior methods that return events.

How do I enforce naming conventions when creating event-sourced aggregates?

Enforcing naming conventions when creating event-sourced aggregates requires ensuring Apply methods are void with a single event parameter. Using immutable records and Guid.CreateVersion7 for IDs maintains proven immutability and analyzer-compliant patterns throughout the domain.

How do I scaffold unit tests for a new event-sourced aggregate?

Scaffolding unit tests for a new event-sourced aggregate involves guided implementation of factory methods and behavior methods that return events. This generates a ready-to-use test skeleton validating the aggregate's event handling and Marten integration.