postgres-schema-designlisted
Install: claude install-skill ch4570/vulpora
# PostgreSQL Schema Design
Official PostgreSQL `Data Definition`/`Constraints` documentation + data modeling insight.
See `reference/principles.md` for the underlying principles.
## Design/review order
1. **Identify what the data represents** (entities/relationships/attributes). Spot concepts from receipts, screens, and requirements.
2. **Apply data modeling principles** — `reference/kb/data-modeling.md`.
3. **Design integrity/constraints** — `reference/kb/constraints-integrity.md`.
4. **If history is needed**, choose a history model — `reference/kb/history-modeling.md`.
5. **Check naming conventions** — `reference/kb/naming-standards.md`.
6. Present the DDL, and for a change also review safety with the **risk-check skill**.
## Quick checklist (HIGH-and-above candidates)
### Integrity (most important — non-negotiable)
- [ ] **Does every table have a PK.**
- [ ] **Is NOT NULL the default.** Allow NULL only for genuinely optional columns.
- [ ] **Does every relationship have an FK.** Does the `ON DELETE` behavior match the meaning (CASCADE/RESTRICT/SET NULL).
- [ ] **Is there an index on the FK column.** PG does not create one automatically → full scan on parent DELETE/UPDATE.
- [ ] **Does the natural key (business uniqueness) have a UNIQUE constraint.** Relying only on a surrogate key lets duplicates pile up.
- [ ] **Are domain rules enforced with CHECK** (`amount >= 0`, status value sets, period `start <= end`).
### Types
- [ ] Money is `numeric` (no floating point). Id