Design Efficient Database Schemas
A context-driven database design skill teaching database/ORM selection reasoning instead of defaulting to PostgreSQL, plus schema, indexing, and migration
Why it matters
Design robust and efficient database schemas tailored to your application's specific needs. Avoid common anti-patterns and optimize for performance from the start.
Outcomes
What it gets done
Select the most appropriate database and ORM for your project context.
Design normalized schemas with proper primary keys and relationships.
Implement effective indexing strategies for performance tuning.
Optimize queries and understand performance implications.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-database-design | bash Overview
Database Design
A database design skill teaching context-driven database/ORM selection reasoning plus schema, indexing, and migration guidance. Use when choosing a database/ORM, designing a schema, planning indexes, optimizing queries, or planning migrations.
What it does
This skill teaches database design reasoning rather than copying SQL patterns, organized around a selective-reading map so only the relevant reference file is consulted: database-selection.md (PostgreSQL vs Neon vs Turso vs SQLite) when choosing a database, orm-selection.md (Drizzle vs Prisma vs Kysely) when choosing an ORM, schema-design.md (normalization, primary keys, relationships) when designing a schema, indexing.md (index types, composite indexes) for performance tuning, optimization.md (N+1 queries, EXPLAIN ANALYZE) for query optimization, and migrations.md (safe migrations, serverless databases) for schema changes.
Its core principle is to ask the user about database preferences when unclear and choose the database/ORM based on context rather than defaulting to PostgreSQL for everything. Its decision checklist before designing a schema: has the user's database preference been asked about, has a database been chosen for this specific context, has the deployment environment been considered, is there an index strategy, and are relationship types defined.
Its anti-patterns: defaulting to PostgreSQL for simple apps where SQLite may suffice, skipping indexing, using SELECT * in production, storing JSON when structured data would be better, and ignoring N+1 queries.
When to use - and when NOT to
Use this skill when choosing a database or ORM, designing a schema, planning an indexing strategy, optimizing queries, or planning schema migrations.
Inputs and outputs
Inputs: a database design task - technology selection, schema design, indexing, query optimization, or migration planning - plus the deployment context and user preferences.
Outputs: a context-appropriate database/ORM choice, a normalized schema with defined relationships, an indexing strategy, and safe migration guidance - avoiding common anti-patterns like defaulting to PostgreSQL or skipping indexes.
Integrations
PostgreSQL, Neon, Turso, SQLite, Drizzle, Prisma, Kysely; bundled reference files database-selection.md, orm-selection.md, schema-design.md, indexing.md, optimization.md, and migrations.md.
Who it's for
Developers designing a database schema or choosing database/ORM technology who want context-driven reasoning instead of defaulting to one stack for every project.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.