domain-entity

Generate DDD domain entities with factory methods, private setters, and domain events.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/gerardogarnica/aurora-flowboard-api --skill domain-entity-gerardogarnica
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-entity
Source: https://github.com/gerardogarnica/aurora-flowboard-api/tree/main/.claude/skills/domain-entity
Command: npx skills add https://github.com/gerardogarnica/aurora-flowboard-api --skill domain-entity-gerardogarnica

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generates Domain Entities following Domain-Driven Design (DDD) principles: encapsulation with private setters, factory methods, and domain events to reflect state changes, ensuring entities stay in valid states.

Core Features & Use Cases

  • Encapsulation with private setters to enforce invariants.
  • Factory Methods (Create) with validation and domain events.
  • Domain Events for Created, Updated, and Deactivated states.
  • Rich domain model where behavior lives in the entity, not services.
  • Support for Aggregate Roots, Child Entities, and Value Objects.

Quick Start

Create a new aggregate root domain entity by calling the Create method with a valid name, optional description, creator, and creation timestamp.

Frequently Asked Questions about domain-entity

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

FAQPage Schema
How do I create C# domain entities with private setters and factory methods?

You create C# domain entities using factory methods like Create that enforce validation, use private setters for encapsulation, and raise domain events for state changes. This ensures entities stay in valid states throughout their lifecycle.

What are domain events in Domain-Driven Design and when should I use them?

Domain events in DDD represent state changes like Created, Updated, and Deactivated within domain entities. You use them to reflect invariant-protected state transitions, keeping behavior inside the entity rather than external services.

How do I structure aggregate roots with child entities and value objects in .NET?

You structure aggregate roots with child entities and value objects using deterministic construction and encapsulation. Factory methods validate inputs, private setters protect invariants, and domain events track state changes across the aggregate.

Does this DDD pattern work for rich domain models where behavior lives in the entity?

Yes, this DDD pattern supports rich domain models where behavior lives in the entity rather than services. It applies encapsulation, factory methods, and domain events to maintain valid, behavior-rich models across aggregate roots and child entities.

What is the best way to protect invariants in C# domain entities?

The best way to protect invariants in C# domain entities is through encapsulation with private setters, factory methods with validation, and domain events. This approach ensures deterministic construction and prevents invalid state transitions.

When should I not use aggregate roots for domain modeling?

You should avoid aggregate roots when your domain lacks complex invariants or child entity relationships. This pattern adds construction overhead and event-raising complexity that may not benefit simple CRUD models without behavior-rich requirements.