domain-entity-reference-optionality
Installation
SKILL.md
Domain Entity Reference Optionality
Goal
When a domain entity holds a reference to another domain entity, determine whether that reference is required or optional based on whether the entity can exist in a valid domain state without it.
A required reference means the entity cannot be created or exist without the referenced entity. An optional reference means the entity can be in a valid state with or without the reference — its absence represents a legitimate domain state, not missing data.
This rule applies only to single-value references. Collection references are never nullable — an empty collection already represents the absence of related entities.
What Counts as In Scope
Apply this skill to code that does one or more of these things:
- defines a domain entity with a single-value reference to another domain entity — either a direct reference or an identity reference
- introduces a new single-value reference on a domain entity
- changes the optionality of an existing reference on a domain entity
- reviews whether a reference should be required or optional