implement-ddd-aggregate

Automate DDD aggregate design with value objects, domain events, and repository ports.

Updated Oct 27, 2025
One-click install
npx skills add https://github.com/mariotoffia/gobridge --skill implement-ddd-aggregate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implement-ddd-aggregate
Source: https://github.com/mariotoffia/gobridge/tree/main/.cursor/skills/implement-ddd-aggregate
Command: npx skills add https://github.com/mariotoffia/gobridge --skill implement-ddd-aggregate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured blueprint for building Domain-Driven Design aggregates following Clean Architecture, ensuring invariants, events, and clear boundaries are enforced in the domain model.

Core Features & Use Cases

  • Value objects and invariants: Define immutable value objects with validated constructors to enforce business rules.
  • Domain events and aggregates: Implement an aggregate root that raises events and maintains consistency boundaries.
  • Repository port and use cases: Outline a port for persistence and an application service to orchestrate use cases.
  • Use-case oriented workflows: Use cases coordinate loading, executing domain logic, and persisting results in a transaction-like boundary.

Quick Start

Provide a domain problem with clear business rules, then follow the steps to implement the aggregate, load it via a repository, apply commands, and persist events.

Frequently Asked Questions about implement-ddd-aggregate

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

FAQPage Schema
How do I implement a DDD aggregate that enforces business invariants and raises domain events?

Implement a DDD aggregate by defining immutable value objects with validated constructors and an aggregate root that enforces invariants and raises domain events to maintain transactional consistency across bounded contexts.

What is the best way to structure domain models using Clean Architecture and Domain-Driven Design?

Structure domain models by defining value objects, aggregate roots, repository ports, and use-case orchestration. This separation enforces business rules and creates robust, maintainable domain models within Clean Architecture.

How do domain events work within an aggregate root to maintain consistency boundaries?

Domain events work within an aggregate root by capturing state changes as events raised by the root, which maintains consistency boundaries and coordinates transactional behavior across bounded contexts.

Can I use this approach to design repository ports and use cases for my bounded contexts?

Yes, this approach outlines a repository port for persistence and an application service to orchestrate use cases, coordinating loading, executing domain logic, and persisting results within a transaction-like boundary.

When should I not use a DDD aggregate pattern for software design?

Avoid a DDD aggregate pattern when a domain lacks complex business rules or clear consistency boundaries. Without significant invariants to enforce or domain events to coordinate, the pattern adds unnecessary structural overhead.