Database design

From cosmicstack-labs/mercury-agent-skills · View interactive version

Database design is an AI agent skill from the GitHub repository cosmicstack-labs/mercury-agent-skills. Schema design, normalization, indexing, migrations, and query optimization for SQL and NoSQL

How to use this skill

Skill file

Database Design

Design efficient, scalable database schemas.

Normalization

| Normal Form | Rule | Violation Example |

|-------------|------|-------------------|

| 1NF | Atomic columns, no repeating groups | phone_numbers: "555-0100,555-0200" |

| 2NF | 1NF + all non-key cols depend on full PK | Orders table with product details |

| 3NF | 2NF + no transitive dependencies | Employee with department_name (dept info in dept table) |

When to denormalize: Read-heavy workloads, reporting, caching layers.

Indexing Strategy

Index Types

| Index | Use Case | Tradeoff |

|-------|----------|----------|

| B-Tree | General purpose, equality + range | Default, usually best |

| Hash | Equality only | Fast lookups, no sorting |

| GIN | Array/JSON | Slightly slower writes |

| BRIN | Huge sorted tables | Very small size |

Rules

Migrations

Query Optimization

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.