database-design
Scannednpx machina-cli add skill vudovn/antigravity-kit/database-design --openclawDatabase Design
Learn to THINK, not copy SQL patterns.
šÆ Selective Reading Rule
Read ONLY files relevant to the request! Check the content map, find what you need.
| File | Description | When to Read |
|---|---|---|
database-selection.md | PostgreSQL vs Neon vs Turso vs SQLite | Choosing database |
orm-selection.md | Drizzle vs Prisma vs Kysely | Choosing ORM |
schema-design.md | Normalization, PKs, relationships | Designing schema |
indexing.md | Index types, composite indexes | Performance tuning |
optimization.md | N+1, EXPLAIN ANALYZE | Query optimization |
migrations.md | Safe migrations, serverless DBs | Schema changes |
ā ļø Core Principle
- ASK user for database preferences when unclear
- Choose database/ORM based on CONTEXT
- Don't default to PostgreSQL for everything
Decision Checklist
Before designing schema:
- Asked user about database preference?
- Chosen database for THIS context?
- Considered deployment environment?
- Planned index strategy?
- Defined relationship types?
Anti-Patterns
ā Default to PostgreSQL for simple apps (SQLite may suffice) ā Skip indexing ā Use SELECT * in production ā Store JSON when structured data is better ā Ignore N+1 queries
Source
git clone https://github.com/vudovn/antigravity-kit/blob/main/.agent/skills/database-design/SKILL.mdView on GitHub Overview
This skill teaches principled database design, covering schema design, indexing strategy, ORM selection, and serverless options. It emphasizes thinking through requirements and context rather than copying SQL patterns or defaulting to a single database choice.
How This Skill Works
You start by assessing the project context and deployment environment, then choose the database and ORM based on that context. Next, you design the schema with proper normalization and relationships, plan an indexing strategy, and outline safe migrations for the chosen platform, guided by focused references like database-selection.md, orm-selection.md, and indexing.md.
When to Use It
- Starting a new project and selecting a database and ORM
- Evaluating serverless database options for cost and scalability
- Choosing an ORM (Drizzle, Prisma, Kysely) for a TypeScript stack
- Designing a schema with normalization, keys, and relationships
- Planning an indexing strategy and query optimization
Quick Start
- Step 1: Ask user about database preference
- Step 2: Choose database and ORM based on context
- Step 3: Draft schema, index strategy, and migration plan
Best Practices
- Ask about database preferences up front
- Contextually choose DB and ORM; do not default to PostgreSQL
- Consult the relevant docs (database-selection.md, orm-selection.md, schema-design.md, indexing.md)
- Plan safe migrations for serverless environments
- Avoid anti-patterns such as skipping indexing or using SELECT * in production
Example Use Cases
- Compare PostgreSQL, Neon, Turso, and SQLite to pick the right fit for a new app
- Evaluate Drizzle vs Prisma vs Kysely for a TypeScript project based on needs
- Design a normalized schema with proper PKs and clearly defined relationships
- Implement composite indexes aligned to common query patterns
- Use EXPLAIN ANALYZE to detect N+1 queries and optimize accordingly