db-normalization
Installation
SKILL.md
db-normalization (M1)
Normalization is the spine of relational design: it removes update/insert/delete anomalies by giving every fact one home. This module audits 1NF→3NF and the deliberate, documented exceptions (denormalization for read paths). It is design-axis only. For document/KV paradigms this module is replaced by Access-pattern&embedding in the profile — do not penalise a Mongo collection for "lacking 3NF".
What it checks
- 1NF — atomicity: columns holding lists (
tags VARCHARwith comma-separated values,phone_numbers TEXT), repeating-group columns (addr1, addr2, addr3,item_1, item_2), or arrays used as a join-table substitute. Static signal: column name patterns + atext/varchartype carrying delimited data in sample DDL/comments. - 2NF — partial dependency: on a composite PK, a non-key column that depends on only part of the key (e.g.
order_items(order_id, product_id, product_name)whereproduct_namedepends onproduct_idalone). - 3NF — transitive dependency: a non-key column functionally determined by another non-key (e.g.
employees(id, dept_id, dept_name)—dept_namebelongs indepartments). - Denormalization discipline: duplicated/derived columns (
total,full_name, cached counts) with no generated-column definition, no trigger, and no documented refresh path — these drift silently. Cross-check withdb-defaults-generated(M6).
Axis & severity
- Axis: design. Magnitude banded high|medium|low, never a fabricated anomaly rate.
- Repeating groups / CSV-in-a-column on a high-write table: severity 3–4,
warn/fail, confidencedirectional(static). - Transitive dependency causing redundant updatable data: severity 3,
warn. - Undocumented denormalized duplicate that can drift: severity 3,
warn,fixable: proposed. - M1 never holds a severity-5 cap; it shapes the Modelado category value.
Tier-0 static check
Parse DDL via scripts/parse-schema.mjs and inspect column inventories: flag delimited-list column names, repeating numbered columns, and non-key columns whose name matches another table's entity (*_name, *_label alongside a *_id). Program-source parses stay directional and never cap.