← ClaudeAtlas

hex-domain-modellisted

Use when creating or changing a domain entity, value object, enum or filter record — stdlib dataclasses, `__post_init__` invariants, identity versus value equality, when a bare primitive carrying a constraint, a unit or a rule must become a value object instead, and the tunable variant of a value object for an environment-sourced threshold (max rows, retention days), which is neither a service nor a settings class. A rule needing another aggregate's state is `hex-domain-service`; the wire model is `hex-restapi-schema`.
wntic/pyhouse · ★ 3 · AI & Automation · score 79
Install: claude install-skill wntic/pyhouse
# Hex — Domain Model The four data shapes of the domain layer. They share one substrate — stdlib only, no third-party imports — and a change that adds a capability usually adds several of them together, which is why they live in one place. ## When to use vs. neighbours Which of this skill's shapes a thing is → Choosing a shape, at the head of Rules. Outside it: - The interface a repository or a capability must satisfy → `hex-domain-ports`. - A rule needing another aggregate's state, or a domain capability → `hex-domain-service`. - The single error catalog → `exception-catalog`. - A DTO crossing the application boundary → `hex-application`. A filter record may be reused there; the query DTO wraps it, plus the caller's scope where the caller is authenticated. - The request or response model on the wire → `hex-restapi-schema`; a domain type is never serialized straight out. - Persistence of any of these → `hex-persistence` (a relational store) or `hex-store-repository` (a client-style store). - The settings class the tunable variant's values come from → `python-settings`; the lifetime rules its provider follows → `hex-wiring`; the provider itself is shown beside the template. - Testing an invariant, identity equality or the pinned enum member set → `hex-test-domain`. - What the class and its module are called → `naming`; one class per module and the re-export → `python-packaging`. ## Template(s) — stdlib dataclasses and enums ### Entity ```python from dataclasses import d