first-class-collection
Installation
SKILL.md
First Class Collection
A first-class collection gives a collection a domain name and keeps collection rules in one place.
Rule
The wrapper should own one collection field and behavior around that collection. Extra unrelated fields usually mean it is an entity or aggregate instead.
Workflow
-
Find repeated collection operations, filters, totals, limits, ordering, or validation.
-
Name the collection as a domain concept.
-
Move rules into methods on the wrapper.
-
Keep the internal collection immutable or defensively copied.
-
Expose intention-revealing operations instead of raw mutation.