agentleFS
cookieMonsterDevcookieMonsterDev/agents-skills/skills/architecture/database-normalization/SKILL.md

database-normalization

Skill7 starsChanged 15 days agoMITView on GitHub

Database normal forms (1NF to 5NF, BCNF) and deliberate denormalization, with a reference per form and worked examples per database. Use when a question names a normal form or a functional, multivalued, or join dependency, describes an insertion, update, or deletion anomaly, asks to normalize, denormalize, or review a schema, or asks how normalization applies in MongoDB, Cassandra, ScyllaDB, or DynamoDB.

The file

Files
SKILL.md

Database Normalization

Ground every normalization answer in this skill's reference files, not in improvised definitions. Each form exists to remove a real anomaly: normalize exactly as far as the user's data has anomalies to remove. Most schemas stop at 3NF/BCNF; 4NF and 5NF are narrow tools for specific dependency shapes.

Workflow

For schema reviews or migrations, first read schema review to establish domain dependencies, verify lossless reconstruction, and plan the consumer transition.

  1. Identify the normal form(s) in the catalog below. When the user describes symptoms instead of naming a form, trace each anomaly to the dependency causing it (functional, partial, transitive, multivalued, join) and the form that eliminates it. Done when every anomaly is traced to a named dependency and form, or the schema is shown anomaly-free at the form in question; then say so.
  2. Read each identified reference at references/<form>.md in full, including its Database Notes. When comparing forms, read every one compared and contrast the dependency each one targets.
  3. Read the database example at examples/<form>/<file> for the user's database (file names in the table below).
  4. Answer with the dependency, the anomaly it causes stated in terms of the user's own schema, and a schema or model adapted to it. For MongoDB, Cassandra, ScyllaDB, and DynamoDB, lead with access patterns and consistency requirements, and say whether that database's idiom calls for staying normalized or denormalizing on purpose. Done when every identified form has all three parts.

Normal Form Catalog

Core Forms

The forms nearly every relational schema should reach; each eliminates a specific class of anomaly caused by a specific kind of dependency.

FormEliminatesReference
1NFRepeating groups and non-atomic (multi-valued) column valuesreferences/first-normal-form.md
2NFPartial dependency of a non-key attribute on part of a composite keyreferences/second-normal-form.md
3NFTransitive dependency of a non-key attribute on another non-key attributereferences/third-normal-form.md

Advanced Forms

Forms that close gaps 3NF leaves open — situations 3NF permits but that still cause anomalies. Most production schemas stop at 3NF/BCNF; 4NF and 5NF apply to specific dependency shapes.

FormEliminatesReference
BCNFEvery functional dependency not sourced from a candidate key (a 3NF gap when candidate keys overlap)references/boyce-codd-normal-form.md
4NFMultivalued dependencies — independent multi-valued facts forced into one tablereferences/fourth-normal-form.md
5NFJoin dependencies not implied by candidate keys — lossy binary decompositions of an n-ary relationshipreferences/fifth-normal-form.md

Beyond Normalization

The deliberate, informed reversal of normalization for a specific performance or access-pattern reason — the default posture in most NoSQL databases.

TopicTradesReference
DenormalizationWrite-time consistency and storage for read-time speed (fewer joins/round trips)references/denormalization.md

Examples

DatabaseFileContents
PostgreSQLpostgres.sqlRunnable DDL/DML
MySQLmysql.sqlRunnable DDL/DML, noting MySQL-specific syntax
SQLitesqlite.sqlRunnable DDL/DML
MongoDBmongodb.jsmongosh script: embedding vs. referencing
Cassandracassandra.cqlCQL script: query-driven tables
ScyllaDBscylladb.cqlCQL script: query-driven tables
DynamoDBdynamodb.mdWalkthrough with item JSON and access patterns

The relational examples apply each form directly. The MongoDB, Cassandra, ScyllaDB, and DynamoDB examples show the analogous anomaly-causing shape and that database's idiomatic answer, which is often duplicating data on purpose: a rational trade-off there, explained in each reference's Database Notes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.