← ClaudeAtlas

hex-persistencelisted

Use when one hexagonal service's own relational layer changes — the `Table` and its constraints, the repository adapter satisfying a domain repository protocol, the paired Alembic revision, or the store's settings class with its engine and repository binding — or when one command must write two or more repositories atomically through a unit of work. Owns the SQLAlchemy Core templates binding `persistence`'s store-generic rules — the shared naming convention, the entity mapper, the integrity-error translator — the adapter's standalone and unit-of-work-managed forms, the port's read contract, the paired revision, and the unit-of-work protocol, implementation and handler form. Not compensation for an external write (`hex-application`), not a flat-layered service's data-access package, which binds the same rules with no port in front of it (`flat-persistence`, in the `pyhouse-flat` plugin), and not a nonrelational store (`hex-store-repository`).
wntic/pyhouse · ★ 3 · AI & Automation · score 79
Install: claude install-skill wntic/pyhouse
# Hexagonal Persistence (relational) The table, the repository that queries it, and the migration that ships it, kept together because the constraint names are one contract across all three (`persistence` rule 7). **Load `persistence` before writing any file below**; the templates satisfy its rules and do not restate them. The rules here are the hexagonal shape around them: an adapter behind a port, its two constructor forms, the paired revision and the unit of work. For a non-relational store — a key-value, cache or document backend — use the client-repository form instead. The store profile decides which applies (`hex-conventions` block B). ## When to use vs. neighbours - The obligations any store's data access meets, whatever the family — transaction ownership, driver-error translation, constraint names, row mapping, stored types and indexes, conflicts and ordering, safe schema changes → `persistence`; this skill binds them. - A persistent table, its columns, constraints or indexes → `TABLE.md`. - The adapter satisfying a domain repository protocol on a relational store → `REPOSITORY.md`. - The migration pairing with a schema change → `REVISION.md`. - The `IFooRepository` protocol file the adapter is written against → `hex-domain-ports`. - Why the adapter satisfies that protocol structurally and never inherits it → `hex-architecture`. - The one-time migration bootstrap — config, `env.py`, and a baseline only over a schema that already exists → `hex-project-setup