database-design

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

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

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 validation tooling to make informed database architecture choices based on actual context rather than defaults. ## 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 environment and query complexity. - Schema Design Guidance: Principles for normalization, primary key selection (UUID, ULID, auto-increment), timestamp strategy, and relationship modeling with foreign key behaviors. - Performance Optimization: Indexing strategies, composite index ordering, N+1 query detection, and EXPLAIN ANALYZE workflows. - Schema Validation Script: A Python script that scans Prisma schemas for missing IDs, timestamps, naming violations, 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 before deployment. ## Quick Start Ask the AI 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 and offers SQL-like syntax. Prisma provides the best developer experience with schema-first migrations and studio tooling. Kysely is a type-safe SQL query builder for maximum control with manual migrations.

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 to fetch all data in one query, ORM eager loading, DataLoader for batching in GraphQL, or subqueries that fetch related records together.

How do I add a column to a database without downtime?▼

Add the column as nullable first, backfill the data, then add the NOT NULL constraint in a later step. For indexes, use CREATE INDEX CONCURRENTLY to avoid blocking writes. Never make breaking changes in a single deployment step.

When should I use UUID vs auto-increment primary keys?▼

Use UUID for distributed systems or when exposing IDs publicly for security. Use ULID when you need UUIDs sortable by time. Auto-increment works for simple single-database applications. Natural keys with business meaning are rarely recommended.

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

The script checks Prisma schemas for PascalCase model naming, missing @id fields, missing createdAt timestamps, and suggests @@index entries for foreign key columns. It outputs a JSON report listing issues per file as warnings rather than failures.