cosmicstack-labs/database-design
Schema design, normalization, indexing, migrations, and query optimization for SQL and NoSQL
npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills --skill database-design
Design efficient, scalable database schemas.
| 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.
| 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 |
Take cosmicstack-labs/database-design from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.