Database Design

Designs database schemas, indexes, and migrations for SQL and NoSQL systems.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/fabioc-aloha/AlexAgent --skill database-design-fabioc-aloha
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Database Design
Source: https://github.com/fabioc-aloha/AlexAgent/tree/main/plugin/skills/database-design
Command: npx skills add https://github.com/fabioc-aloha/AlexAgent --skill database-design-fabioc-aloha

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the wrong database type, schema structure, or indexing strategy leads to slow queries, data integrity issues, and painful migrations. This Skill provides structured guidance for schema design, normalization, query optimization, and data modeling across relational and NoSQL databases. ## Core Features & Use Cases - Database Selection: Decision matrices comparing SQL, document, key-value, and graph databases including PostgreSQL, MongoDB, Redis, Cosmos DB, DynamoDB, and Neo4j. - Schema & ORM Patterns: Normalization rules (1NF through BCNF), denormalization trade-offs, and code examples for Prisma, Drizzle, and Entity Framework. - Query Optimization: EXPLAIN plan interpretation, index strategies (composite, partial, covering), and fixes for anti-patterns like N+1 queries and SELECT *. - Use Case: When building an e-commerce backend, use this Skill to design a normalized orders schema, add the right indexes for known query patterns, and plan a zero-downtime column migration. ## Quick Start Ask the AI to design a normalized PostgreSQL schema with indexes for your application's entities and query patterns.

Frequently Asked Questions about Database Design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between SQL and NoSQL databases?▼

Choose SQL for structured data with complex queries and ACID transactions; choose NoSQL document stores for flexible schemas and rapid iteration. Key-value stores fit caching and sessions, while graph databases suit relationship-heavy data like social networks.

How to optimize slow SQL queries with indexes?▼

Run EXPLAIN ANALYZE to read the execution plan, then add indexes on WHERE and JOIN columns. Use composite indexes with correct column order, partial indexes for filtered subsets, and covering indexes that include all queried columns.

Prisma vs Drizzle for TypeScript database access?▼

Prisma provides a declarative schema file with type-safe generated clients and relation includes. Drizzle defines schemas directly in TypeScript with a SQL-like query API, giving closer control over generated SQL.

When should I denormalize a database schema?▼

Denormalize for read-heavy workloads, queries joining many tables, reporting tables, or when eventual consistency is acceptable. Keep the normalized schema as the source of truth and maintain denormalized summaries for performance.

How do I run zero-downtime schema migrations?▼

Add new columns as nullable first, backfill data in batches, update the application to write both columns, then enforce constraints and drop old columns last. Never modify existing migrations; use small forward-only incremental changes.

When should MongoDB documents embed vs reference data?▼

Embed for 1:1 or 1:few relationships accessed together with bounded size, such as order items. Reference for 1:many or many:many relationships, independently accessed data, or unbounded growth like user posts.