Entity Design Skill
CommunityBuild robust domain entities with clean design.
Authorpretodev
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Domain-driven design requires robust, encapsulated domain entities that enforce invariants, validate state, and manage identity, to prevent leakage of business rules into higher layers.
Core Features & Use Cases
- Identity handling: Choose an appropriate identity type (GuidEntity, SerialEntity, or Entity<T>) to match creation context.
- Public constructor for reconstitution: Expose a constructor with all fields to enable persistence rehydration.
- Creation factory: Provide a factory (e.g., .create()) that initializes the entity in a valid state with createdAt/updatedAt timestamps and isActive = true.
- Encapsulation and internal state: Use private fields with getters returning unmodifiable views.
- Domain methods for state changes: Mutate state through domain methods, always updating updatedAt and validating business rules.
- Validation hook: Override validate() to enforce invariants and throw domain-specific failures.
- Specialized failure types: Create a dedicated failure subclass to report domain violations.
- Debugging aids: Override props to expose key domain attributes for easier debugging.
Quick Start
Create a new domain entity by choosing an identity type, implement a public constructor with required fields, and add a creation factory to initialize a valid entity.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: Entity Design Skill Download link: https://github.com/pretodev/nice_app/archive/main.zip#entity-design-skill Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.