immutable-domain-entities
Installation
SKILL.md
Immutable Domain Entities
Goal
Apply the immutable design pattern when writing or changing domain entities.
An immutable domain entity keeps the same domain identity while preventing in-place mutation of its state. Domain operations that would otherwise change the entity must instead return a new entity instance, or the closest immutable equivalent the stack supports, preserving the same identity and enforcing the same invariants.
Treat this skill as construction and change-management guidance for domain entities. The key question is whether the entity can be modeled so its state is fixed after creation and all valid changes are expressed as explicit creation of a new immutable version.
What Counts as In Scope
Apply this skill to code that does one or more of these things: