entity-creator

Generate DDD entities with factory methods, domain events, and EF Core configurations.

Updated Dec 31, 2025
One-click install
npx skills add https://github.com/ademceper/merge --skill entity-creator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: entity-creator
Source: https://github.com/ademceper/merge/tree/main/server/.cursor/skills/entity-creator
Command: npx skills add https://github.com/ademceper/merge --skill entity-creator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the boilerplate creation of DDD-compatible entities, including a factory method, domain events, value objects scaffolding, and EF Core configuration, reducing repetitive coding and ensuring architectural consistency.

Core Features & Use Cases

  • Auto-generates a complete entity skeleton under Merge.Domain/{Module}/Entities/{Entity}.cs
  • Enforces a Create factory method for controlled instantiation and emits a CreatedEvent
  • Adds domain events for lifecycle changes (Created, Updated, Deactivated) and a ById specification
  • Generates EF Core configuration under Merge.Infrastructure/Data/Configurations/{Entity}Configuration.cs
  • Useful when introducing new domain models or refactoring existing aggregates

Quick Start

Provide the entity name and required fields to generate the complete DDD entity, including its factory, domain events, specification, and EF configuration. The generated files will be placed in Merge.Domain and Merge.Infrastructure under the appropriate module and can be migrated with EF Core migrations.

Frequently Asked Questions about entity-creator

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

FAQPage Schema
How do I generate DDD entities with factory methods and domain events automatically?

To generate DDD entities with factory methods and domain events, provide the entity name and required fields to auto-create a complete skeleton. This enforces a mandatory Create factory, emits a CreatedEvent, and applies guard clauses for controlled instantiation.

What is the best way to scaffold EF Core configurations for domain-driven design aggregates?

Scaffolding EF Core configurations for DDD aggregates is automated by generating a configuration file under the Infrastructure layer. It enforces a private EF Core constructor, readonly collections, and private setters to maintain strict aggregate boundaries.

How do I enforce domain events on state changes when creating C# entities?

Enforcing domain events on state changes requires adding lifecycle events like Created, Updated, and Deactivated during entity creation. This automated scaffolding hooks these events directly into the generated C# entity behavior updates.

Does this DDD scaffolding generate value objects and specifications alongside the entities?

Yes, this DDD scaffolding generates value objects scaffolding and a ById specification alongside the entity. It places these files in the appropriate domain module, ensuring architectural consistency across your C# project.

Can I use this entity generator for refactoring existing aggregates in a modular architecture?

You can use this entity generator for refactoring existing aggregates by updating entity behavior and configuring EF mappings across modules. It standardizes domain modeling tasks by enforcing private setters and factory methods during the update.

What limitations exist when auto-creating entities with private constructors for EF Core?

A limitation when auto-creating entities with private constructors for EF Core is that the generated structure strictly enforces a private constructor and readonly collections. You must ensure your existing EF Core migration setup aligns with this rigid DDD structure.