ddd-aggregate

Scaffolds a DDD aggregate root with entity, value objects, repository interface, domain events, and test stubs.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill ddd-aggregate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-aggregate
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-ddd/skills/ddd-aggregate
Command: npx skills add https://github.com/ruvnet/claude-flow --skill ddd-aggregate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new aggregate to an existing bounded context requires creating many coordinated files—entity, value objects, repository interface, domain events, and tests—which is repetitive and error-prone when done by hand.

Core Features & Use Cases

  • Aggregate Root Scaffolding: Generates a TypeScript aggregate root entity with invariant validation, identity-based equality, and domain methods.
  • Supporting Domain Artifacts: Creates immutable ID value objects, a repository interface (findById, save, delete), and past-tense domain events for created/updated lifecycle.
  • Test Stubs and Graph Tracking: Produces unit test stubs with behavior-style naming and records the aggregate in a hierarchical domain model graph via memory hooks.
  • Use Case: When modeling a new business concept like an order in an existing sales bounded context, run the skill to generate the full entity + repository + events triplet with consistent structure.

Quick Start

Ask the AI to scaffold a new aggregate by providing the bounded context and aggregate name, for example: create a ddd aggregate named order in the sales context.

Frequently Asked Questions about ddd-aggregate

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

FAQPage Schema
How do I scaffold a DDD aggregate root in TypeScript?

Provide the bounded context name and aggregate name in kebab-case as arguments. The skill generates the aggregate root entity, ID value object, repository interface, created/updated domain events, and test stubs under src/<context>/domain/.

What files are generated when creating a new aggregate?

It creates an entity file, an ID value object, a repository interface with findById/save/delete methods, created and updated domain event files, a unit test stub, and updates the relevant index.ts barrel exports.

Does the bounded context need to exist before adding an aggregate?

Yes, the skill validates that src/<context>/domain/ exists before scaffolding. If the context is missing, it suggests running the ddd-context skill first to create the bounded context structure.

Does the generated repository include an implementation?

No, only the repository interface is generated in the domain layer, typed with the aggregate root and its ID value object. The concrete implementation is an infrastructure concern left to a separate layer.

What naming convention do the generated tests follow?

Test stubs use describe/it blocks with behavior-driven names in the form 'should [behavior] when [condition]'. They cover construction invariants, domain methods, and identity-based equality of the aggregate.