database-design

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

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill database-design-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/.agent/skills/database-design
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill database-design-virahitvin8

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Choosing the right database, ORM, and schema structure is error-prone, and poor early decisions lead to slow queries, painful migrations, and over-engineered stacks. This Skill provides decision frameworks and validation so you design schemas based on actual context instead of 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 context. - Schema Design Guidance: Principles for normalization, primary keys (UUID, ULID, auto-increment), timestamps, relationships, and foreign key ON DELETE behavior. - Performance & Migrations: Indexing strategies, N+1 query detection, EXPLAIN ANALYZE workflow, and zero-downtime migration patterns for serverless databases. - Use Case: When starting a new TypeScript API, ask for a schema review—the Skill helps you pick Turso for edge deployment, design normalized tables with proper indexes, and validate your Prisma schema with the included script. ## Quick Start Ask the AI to design a database schema for your application and validate the resulting Prisma schema for missing indexes and naming issues.

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 Prisma and Drizzle for my project?

Choose Drizzle for edge deployments and small bundle sizes since it is SQL-like and lightweight. Choose Prisma when you want the best developer experience with schema-first design, built-in migrations, and Prisma Studio, accepting its heavier runtime.

Which database should I use for a serverless application?

For serverless PostgreSQL, use Neon, which offers scale-to-zero, instant branching, and full PostgreSQL compatibility. For edge deployment with ultra-low latency, use Turso, an edge-distributed SQLite with a generous free tier.

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

N+1 occurs when one query fetches parents and N additional queries fetch related records. Fix it with JOINs to load everything in one query, ORM eager loading, DataLoader for batching in GraphQL, or subqueries.

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?

Add columns as nullable first, backfill data, then add NOT NULL constraints. Create indexes with CREATE INDEX CONCURRENTLY to avoid blocking, and rename columns by adding the new column, migrating data, deploying, then dropping the old one.

Should I use UUID or auto-increment for primary keys?

Use UUID for distributed systems and when exposing IDs publicly for security. Use ULID when you need UUIDs sortable by time. Auto-increment works fine for simple single-database applications.