Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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…

pproencaот pproenca★ 231 звезда на GitHub

Об этом скилле

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.

When to Apply

Use this skill when:

  • Writing or reviewing CREATE TABLE / ALTER TABLE, a migration, or an ORM schema definition (Prisma, Drizzle, Django models, ActiveRecord, Ecto, SQLAlchemy)
  • Designing an entity-relationship model, or naming what a row is — the point where key choices become expensive to reverse
  • The user says "should this be one table or two", "how do I model many-to-many", "the schema allows bad data", "we need history", "we're adding multi-tenancy", or "can the database enforce this"
  • A bug turns out to be a schema that permitted the bad state — duplicates that a unique constraint should have caught, orphans a foreign key should have blocked, overlapping bookings, two rows flagged as default
  • Adding constraints to a table that already has rows and traffic
  • Reviewing a schema generated by an ORM or a scaffolding tool, which is where polymorphic associations, reflexive surrogate keys, and blanket soft-delete flags arrive from

This skill is NOT for:

  • Query tuning, execution plans, or choosing indexes for a read path — this covers only the indexes that constraints and foreign keys require
  • Connection pooling, replication, or operational tuning
  • Non-relational stores, where the trade-offs it argues from do not hold

Rule Categories

# Category Prefix Covers
1 Identity and Keys key- What a row is; the choice every foreign key depends on
2 Relationships and Cardinality rel- Keeping references declarable to the database, not just intended
3 Constraints as the Model cons- Which mechanism can actually hold which invariant
4 Types and Domains type- The cheapest constraint available, chosen for meaning not habit
5 Derived and Encoded Data norm- What every deliberate copy costs, and what the database can't see inside
6 Time, History and Lifecycle time- What happens to a row when the world changes

Quick Reference

1. Identity and Keys

2. Relationships and Cardinality

3. Constraints as the Model

Полный SKILL.md на GitHub

Установить relational-data-modeling в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

AGENTS.mdassets/templates/_template.mdmetadata.jsonreferences/_sections.mdreferences/cons-check-is-single-row.mdreferences/cons-deferrable-for-cycles.mdreferences/cons-exclude-for-non-overlap.mdreferences/cons-not-null-by-default.mdreferences/cons-not-valid-then-validate.mdreferences/cons-partial-unique-index.mdreferences/key-identity-not-serial.mdreferences/key-partition-axis-binds-the-key.mdreferences/key-primary-key-is-real-identity.mdreferences/key-propagate-scoping-key.mdreferences/key-uuidv7-for-client-generated.mdreferences/norm-derived-needs-a-mechanism.mdreferences/norm-encoded-composite-values.mdreferences/norm-jsonb-for-open-shapes.mdreferences/rel-choose-referential-action.mdreferences/rel-index-referencing-side.mdreferences/rel-no-polymorphic-fk.mdreferences/rel-one-to-one-is-one-table.mdreferences/rel-relationship-as-entity.mdreferences/rel-subtypes-through-the-key.mdreferences/time-events-not-in-place-updates.mdreferences/time-soft-delete-breaks-constraints.mdreferences/time-valid-vs-transaction-time.mdreferences/time-validity-as-a-range.mdreferences/type-enum-lookup-or-check.mdreferences/type-numeric-with-currency.mdreferences/type-range-not-two-columns.mdreferences/type-text-over-varchar.mdreferences/type-timestamptz-for-instants.md

FAQ

Что делает скилл 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.

Как установить скилл relational-data-modeling?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл relational-data-modeling запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить relational-data-modeling с