database-design

Guides database selection, schema design, indexing, and query optimization decisions.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/5onyy/essential-ai-agent-skills --skill database-design-5onyy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/5onyy/essential-ai-agent-skills/tree/main/.cursor/skills/database-design
Command: npx skills add https://github.com/5onyy/essential-ai-agent-skills --skill database-design-5onyy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Choosing the wrong database, ORM, or schema structure early in a project leads to performance bottlenecks, painful migrations, and costly rewrites. This Skill provides decision frameworks and reference material so you make context-appropriate database choices instead of defaulting to familiar tools. ## Core Features & Use Cases - Database & ORM Selection: Decision trees comparing PostgreSQL, Neon, Turso, SQLite, PlanetScale, and ORMs like Drizzle, Prisma, and Kysely based on deployment context. - Schema & Indexing Guidance: Principles for normalization, primary keys, timestamps, relationships, composite indexes, and index type selection (B-tree, GIN, HNSW). - Query Optimization & Migrations: Diagnose N+1 problems with EXPLAIN ANALYZE and plan zero-downtime migrations for serverless databases. - Schema Validation Script: Run the included Python validator to check Prisma schemas for missing IDs, timestamps, naming issues, and index recommendations. - Use Case: When starting a new edge-deployed app, ask the agent to recommend a database and ORM, then design a normalized schema with proper indexes before writing any SQL. ## Quick Start Ask the agent to help you choose a database and ORM for your project and design the initial schema with an indexing strategy.

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 PostgreSQL, Neon, Turso, and SQLite?▼

Choose based on deployment context: PostgreSQL for full relational features, Neon for serverless PostgreSQL with branching, Turso for edge deployment with low latency, and SQLite for simple embedded or local apps. The decision tree in the reference files walks through these trade-offs.

Drizzle vs Prisma vs Kysely: which ORM should I use?▼

Drizzle fits edge deployments where bundle size matters, Prisma offers the best developer experience with schema-first migrations, and Kysely provides type-safe SQL building with maximum control. The choice depends on your deployment target and DX priorities.

How do I fix N+1 query problems in my application?▼

N+1 problems occur when one query fetches parents and N queries fetch related records. Solve them with JOINs, ORM eager loading, DataLoader batching for GraphQL, or subqueries that fetch related data in a single query.

When should I add indexes to database columns?▼

Index columns used in WHERE clauses, JOIN conditions, ORDER BY, foreign keys, and unique constraints. Avoid over-indexing write-heavy tables, low-cardinality columns, and rarely queried columns since indexes slow down inserts.

How do I run zero-downtime database migrations?▼

Never make breaking changes in one step: add columns as nullable then backfill, create indexes with CREATE INDEX CONCURRENTLY, and rename columns by adding the new one, migrating data, then dropping the old. Always test on a data copy first.

What does the schema validator script check in Prisma files?▼

The Python script checks Prisma schemas for PascalCase model naming, missing @id fields, absent createdAt timestamps, and foreign keys lacking @@index entries. It outputs a JSON report of issues as warnings without failing the run.