Get the FREE Ultimate OpenClaw Setup Guide →

database-design

Scanned
npx machina-cli add skill vudovn/antigravity-kit/database-design --openclaw
Files (1)
SKILL.md
1.5 KB

Database 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.

FileDescriptionWhen to Read
database-selection.mdPostgreSQL vs Neon vs Turso vs SQLiteChoosing database
orm-selection.mdDrizzle vs Prisma vs KyselyChoosing ORM
schema-design.mdNormalization, PKs, relationshipsDesigning schema
indexing.mdIndex types, composite indexesPerformance tuning
optimization.mdN+1, EXPLAIN ANALYZEQuery optimization
migrations.mdSafe migrations, serverless DBsSchema 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

  1. Step 1: Ask user about database preference
  2. Step 2: Choose database and ORM based on context
  3. 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

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers ↗