database_design

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

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/jvsandhu/agentic-skills --skill database-design-jvsandhu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database_design
Source: https://github.com/jvsandhu/agentic-skills/tree/main/skills/database_design
Command: npx skills add https://github.com/jvsandhu/agentic-skills --skill database-design-jvsandhu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It guides developers through designing reliable database schemas, choosing indexes, optimizing slow queries, and running safe migrations without breaking production systems. ## Core Features & Use Cases - Schema Design & Normalization: Apply naming conventions, column type selection, and normalization up to 3NF with guidance on when to denormalize. - Indexing & Query Optimization: Create B-Tree, composite, partial, and GIN indexes, and fix anti-patterns like N+1 queries and SELECT * using EXPLAIN ANALYZE. - Safe Migrations & NoSQL Patterns: Follow zero-downtime migration steps and model MongoDB embedded/referenced documents plus Redis data structures. - Use Case: When building a new orders feature, use this Skill to design the tables, add the right indexes for query patterns, and write a backward-compatible migration script. ## Quick Start Ask the agent to design a normalized PostgreSQL schema with indexes and a migration plan for your application's entities.

Frequently Asked Questions about database_design

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

FAQPage Schema
How do I design a database schema for a new application?

Start by identifying access patterns and drawing an ER diagram of entities and relationships. Then normalize tables up to 3NF, define primary keys, foreign keys, and constraints, and choose column types appropriate for your database engine.

How to optimize slow SQL queries with indexes?

Run EXPLAIN ANALYZE on the slow query to inspect the execution plan, then add B-Tree indexes on columns used in WHERE, JOIN, and ORDER BY clauses. Avoid functions on indexed columns and replace SELECT * with only the columns you need.

When should I use MongoDB instead of PostgreSQL?

Use embedded MongoDB documents for one-to-few, read-heavy relationships and referenced collections for one-to-many, write-heavy workloads. Choose relational databases like PostgreSQL when you need strict constraints, joins, and normalized transactional data.

How do I run a zero-downtime database migration?

Add the new column as nullable, start dual-writing to both old and new columns, backfill the data, then enforce NOT NULL and remove the old column. Avoid dropping columns or tables directly in production.

Why should I avoid indexing boolean or low-cardinality columns?

Indexes on low-cardinality columns like booleans provide little selectivity, so the database often ignores them while still paying write and storage costs. Index only frequently filtered, joined, or sorted columns with meaningful cardinality.