Individual skill
relational-data-modeling
Corrects the wrong defaults a model has when designing a relational schema — the DDL decisions an experienced engineer makes differently. Use when creating or reviewing tables, migrations, ER models, or ORM schema definitions. Covers identity and keys (surrogate vs natural, identity vs serial, uuidv7, composite keys that make cross-tenant references impossible), relationships (polymorphic foreign keys the database cannot enforce, referential actions, unindexed FK columns, disjoint subtypes), invariants the engine can prove instead of application code (EXCLUDE, partial unique indexes, CHECK limits, deferrable cycles, NOT VALID), types (timestamptz, exact money, range types, enum vs lookup table), derived and encoded data (generated columns, JSONB as an escape hatch), and time (events vs in-place updates, soft-delete flags that silently disable constraints, temporal keys). NOT for query tuning, index selection for read paths, or connection pooling.
skills/.experimental/relational-data-modeling/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 222
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
- data Derived category
- data-databases Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 7,669 bytesSKILL.mdcore · 9,780 bytesSKILL.mdcore · 9,780 bytesassets/templates/_template.mddoc · 1,910 bytesmetadata.jsonasset · 2,903 bytesreferences/_sections.mddoc · 3,887 bytesreferences/cons-check-is-single-row.mddoc · 2,798 bytesreferences/cons-deferrable-for-cycles.mddoc · 2,771 bytesreferences/cons-exclude-for-non-overlap.mddoc · 2,855 bytesreferences/cons-not-null-by-default.mddoc · 2,580 bytesreferences/cons-not-valid-then-validate.mddoc · 3,154 bytesreferences/cons-partial-unique-index.mddoc · 2,410 bytesreferences/key-identity-not-serial.mddoc · 1,973 bytesreferences/key-partition-axis-binds-the-key.mddoc · 2,773 bytesreferences/key-primary-key-is-real-identity.mddoc · 2,126 bytesreferences/key-propagate-scoping-key.mddoc · 2,565 bytesreferences/key-uuidv7-for-client-generated.mddoc · 2,007 bytesreferences/norm-derived-needs-a-mechanism.mddoc · 4,459 bytesreferences/norm-encoded-composite-values.mddoc · 2,699 bytesreferences/norm-jsonb-for-open-shapes.mddoc · 3,099 bytesreferences/rel-choose-referential-action.mddoc · 2,615 bytesreferences/rel-index-referencing-side.mddoc · 2,156 bytesreferences/rel-no-polymorphic-fk.mddoc · 2,517 bytesreferences/rel-one-to-one-is-one-table.mddoc · 2,656 bytesreferences/rel-relationship-as-entity.mddoc · 2,811 bytesreferences/rel-subtypes-through-the-key.mddoc · 3,133 bytesreferences/time-events-not-in-place-updates.mddoc · 3,520 bytesreferences/time-soft-delete-breaks-constraints.mddoc · 2,966 bytesreferences/time-valid-vs-transaction-time.mddoc · 3,883 bytesreferences/time-validity-as-a-range.mddoc · 3,507 bytesreferences/type-enum-lookup-or-check.mddoc · 2,751 bytesreferences/type-numeric-with-currency.mddoc · 2,646 bytesreferences/type-range-not-two-columns.mddoc · 2,798 bytesreferences/type-text-over-varchar.mddoc · 2,325 bytesreferences/type-timestamptz-for-instants.mddoc · 2,737 bytes
Read excerpt
# Relational Data Modeling
The decisions a relational schema forces, and how to settle them so the database
enforces what it can and the application is left with only what it must. Every
rule names the wrong default it corrects; there is no rule for what a capable
model already gets right.
**Examples are PostgreSQL 18**, and every DDL statement in this skill was
executed against 18.4 — including the failure cases, to confirm the constraints
reject what they claim to reject. Roughly a third of the rules depend on
mechanisms MySQL and SQLite do not have (`EXCLUDE`, partial unique indexes,
range types, `WITHOUT OVERLAPS`, deferrable constraints, `NOT VALID`); those
rules say so. The judgment rules transfer to any relational engine.