Entity Design Skill
Installation
SKILL.md
-
Choose the correct identity type:
GuidEntityfor client-side generated UUIDsSerialEntityfor database auto-increment IDsEntity<T>for custom ID types
-
Create public constructor with all required fields including:
id,createdAt,updatedAt,isActive- All domain-specific fields
-
Add creation factory (e.g.,
.create()) that:- Generates appropriate ID using
GuidEntity.newId()orSerialEntity.unsavedId - Sets
createdAtandupdatedAtto current time - Sets
isActive: trueby default - Initializes entity in valid state
- Generates appropriate ID using
-
Protect internal collections:
- Use private fields with underscore prefix
- Return
List.unmodifiable()from getters - Never expose mutable collections directly