Database Design

Schema design, normalization, indexing, migrations, and query optimization for SQL and NoSQL

492 stars 68 forksDatabases

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add cosmicstack-labs/mercury-agent-skills --skill database-design
Manual install
git clone --depth 1 https://github.com/cosmicstack-labs/mercury-agent-skills.git /tmp/mercury-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/mercury-agent-skills/categories/backend/database-design ~/.claude/skills/database-design

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 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
- Index columns used in WHERE, JOIN, ORDER BY
- Index foreign keys
- Covering indexes for frequent queries
- Don't over-index (slows writes, uses space)
- Drop unused indexes (use pg_stat_user_indexes)

## Migrations
- One file per change, sequential naming
- Always reversible (up/down pair)
- Test on staging before production
- Run in transactions where possible
- Avoid locking tables on large tables (use pt-online-schema-change)

## Query Optimization
- EXPLAIN ANALYZE every slow query
- Look for: Seq scans, nested loops, temp files
- Common fixes: missing index, bad join order, OR conditions
- N+1 problem: batch find / includes / joins
Read the full skill on GitHub

Details

Skill name
database-design
Path
categories/backend/database-design/SKILL.md
License
MIT
Repo updated
25 August 2026

FAQ

What does the Database Design skill do?

Schema design, normalization, indexing, migrations, and query optimization for SQL and NoSQL

How do I install the Database Design skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add cosmicstack-labs/mercury-agent-skills --skill database-design. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Database Design popular?

It lives in cosmicstack-labs/mercury-agent-skills, which has 492 GitHub stars and 68 forks.

Related skills

Accessibility

492

cosmicstack-labs/mercury-agent-skills

Achieve and maintain WCAG compliance through inclusive design practices, proper ARIA usage, and comprehensive testing methodologies.

Frontend & Design68

Accessibility Testing

492

cosmicstack-labs/mercury-agent-skills

WCAG 2.1/2.2 audit, axe, Lighthouse, manual testing, screen reader testing, and remediation

Testing & QA68

Agent Audit Logging

492

cosmicstack-labs/mercury-agent-skills

Implement comprehensive audit logging and reporting for multi-agent systems. Covers event capture, structured logging, traceability, compliance reporting, forensic analysis, and real-time monitoring dashboards for agent actions and decisions.

AI, LLMs & Agents68

Agent Clickhouse Io

514

Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

Databases146

Mongodb Search and AI

206

mongodb/agent-skills

Covers everything about search in MongoDB: Atlas Search (full-text), Vector Search (semantic), and Hybrid Search. Use this skill for ANY question about MongoDB search, including open-ended and explanatory ones asked before the user has any data or use case — 'how does search work in MongoDB?', 'I'm new to MongoDB search, where do I start?', 'what's the difference between Atlas Search and Vector Search?', 'which search type should I use?', 'what is vector search?', 'how does automated embedding work?', 'can you explain hybrid search?'. Do not answer these from general knowledge; use this skill.

Databases46

Database Cloud Optimization Cost Optimize

514

Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI

You are a cloud cost optimization expert specializing in reducing infrastructure expenses while maintaining performance and reliability. Analyze cloud spending, identify savings opportunities, and implement cost-effective architectures across AWS, Azure, and GCP.

Databases146

Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.