database-design

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

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/beliciobcardoso/mcp-postgres --skill database-design-beliciobcardoso
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/beliciobcardoso/mcp-postgres/tree/main/.agent/skills/database-design
Command: npx skills add https://github.com/beliciobcardoso/mcp-postgres --skill database-design-beliciobcardoso

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 guides so you make informed database architecture choices based on your actual context instead of defaults. ## Core Features & Use Cases - Database & ORM Selection: Decision trees comparing PostgreSQL, Neon, Turso, SQLite, and PlanetScale, plus Drizzle vs Prisma vs Kysely, matched to deployment context. - Schema Design Guidance: Principles for normalization, primary key selection (UUID, ULID, auto-increment), timestamps, relationships, and foreign key delete behavior. - Performance & Migrations: Indexing strategies, N+1 query detection, EXPLAIN ANALYZE workflow, and zero-downtime migration patterns, plus a Python script that validates Prisma schemas for missing indexes and naming issues. - Use Case: You are starting a new edge-deployed TypeScript app and need to pick a database and ORM, design the initial schema with proper indexes, and validate your Prisma schema before shipping. ## Quick Start Ask the AI to help you choose a database and design a schema for your project, describing your deployment environment 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 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 weighs query complexity, edge needs, and global distribution.

Drizzle vs Prisma: which ORM should I use?▼

Drizzle suits edge deployments and small bundle sizes with SQL-like syntax, while Prisma offers better developer experience with schema-first migrations and tooling. Kysely fits when you want a type-safe SQL query builder with manual migrations.

When should I add indexes to database columns?▼

Index columns used in WHERE clauses, JOIN conditions, ORDER BY, and foreign keys. Avoid over-indexing write-heavy tables, low-cardinality columns, and rarely queried fields, since each index slows down inserts.

How do I fix N+1 query problems?▼

Solve N+1 queries by using JOINs to fetch related data in one query, eager loading through your ORM, DataLoader for batching in GraphQL, or subqueries. Use EXPLAIN ANALYZE first to confirm the query pattern before optimizing.

How do I run zero-downtime database migrations?▼

Make changes in multiple steps: add columns as nullable then backfill before adding NOT NULL, use CREATE INDEX CONCURRENTLY for non-blocking indexes, 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 schema_validator.py script checks Prisma schemas for PascalCase model naming, missing @id fields, missing createdAt timestamps, and foreign keys lacking @@index definitions. It outputs a JSON report of issues as warnings rather than failures.