hex-persistencelisted
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