database-design

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (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 validation tooling to make informed database architecture choices based on actual project context. ## 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 Design Guidance: Principles for normalization, primary key selection, timestamps, relationships, and foreign key delete behaviors. - Performance Optimization: Indexing strategies, N+1 query detection, EXPLAIN ANALYZE workflows, and safe zero-downtime migration patterns. - Schema Validation Script: A Python script that scans Prisma schemas for missing IDs, timestamps, naming issues, and missing indexes. - Use Case: When starting a new serverless app, use this Skill to decide between Neon and Turso, pick Drizzle as the ORM, design a normalized schema with proper indexes, and validate the Prisma schema for common mistakes. ## Quick Start Ask the agent to help you choose a database and design a schema for your project, describing your deployment environment and query requirements.

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. Consider query complexity, edge requirements, and global distribution needs.

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 studio tooling, and Kysely provides type-safe SQL building with maximum control. Raw SQL suits complex queries needing full control.

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

N+1 occurs when one query fetches parents and N queries fetch related records. Solve it with JOINs for single-query fetching, ORM eager loading, DataLoader for batching in GraphQL, or subqueries that fetch related data in one round trip.

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 with a rollback plan.

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

The schema_validator.py script checks Prisma schemas for PascalCase model naming, missing @id fields, missing createdAt timestamps, and foreign keys lacking @@index declarations. It outputs issues as JSON warnings without failing the run.