domain-entity-generator

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

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/hiiamsky/multi-agent-dev-team --skill domain-entity-generator-hiiamsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-entity-generator
Source: https://github.com/hiiamsky/multi-agent-dev-team/tree/main/.github/skills/dotnet-domain-entity
Command: npx skills add https://github.com/hiiamsky/multi-agent-dev-team --skill domain-entity-generator-hiiamsky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Builds rich, encapsulated Domain Entities that enforce invariants and emit domain events, reducing boilerplate and preventing invalid states.

Core Features & Use Cases

  • Encapsulation: private setters and controlled modifications to preserve invariants.
  • Factory Methods: Create() with validation to guarantee valid entities from inception.
  • Domain Events: state changes raise events for downstream processing and persistence.
  • Rich Domain Model: behavior lives in entities, not services, enabling expressiveness and testability.
  • Aggregates & Value Objects: supports aggregate roots, child entities, and value objects with strict boundaries.
  • Repository-oriented design: aligns with per-aggregate repositories for persistence boundaries.

Quick Start

Create a new Domain Entity by calling the Create factory with valid inputs and persist the entity while handling domain events.

Frequently Asked Questions about domain-entity-generator

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

FAQPage Schema
How do I build rich domain entities that enforce invariants in Domain-Driven Design?

Build rich domain entities by using factory-based creation patterns with validation and private setters to enforce invariants. This ensures entities are valid from inception and prevents invalid states through controlled modifications.

How do I encapsulate domain entities and prevent invalid state changes?

Encapsulate domain entities by implementing private setters and controlled modifications to preserve invariants. State changes are routed through factory methods and behavioral logic within the entity itself.

How do I raise domain events when entity state changes occur?

Raise domain events by signaling them during entity state changes. This allows downstream processing and persistence to react to modifications while keeping behavior localized within the rich domain model.

Does this approach support aggregate roots, child entities, and value objects?

Yes, the approach supports aggregate roots, child entities, and value objects with strict boundaries. It aligns with per-aggregate repositories to define clear persistence boundaries across the domain model.

What is the best way to create valid domain entities from inception?

The best way to create valid entities is using a Create factory method with validation. This guarantees valid domain entities from inception by enforcing invariants and encapsulation before persistence.

When should I not use a rich domain model for my entities?

Avoid a rich domain model if your project does not require strict invariant enforcement or domain event signaling. If your logic is purely CRUD without complex behavioral rules, this approach adds unnecessary boilerplate.