database-design

Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.

Author

Install

Hot:0

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-database-design&locale=en&source=copy

Database Design - Intelligent Database Design Assistant

Skill Overview


Database Design is an AI assistant focused on database design principles and decision-making, helping developers choose appropriate databases, ORMs, and architectural solutions based on project requirements, rather than simply copying SQL schemas.

Use Cases

  • Project technology selection phase

  • When you start a new project and need to decide which database to use—PostgreSQL, SQLite, Neon, Turso, etc.—and which ORM framework to choose—Drizzle, Prisma, Kysely, etc.—this skill provides targeted recommendations based on your project size, deployment environment, and performance requirements.

  • Database performance optimization

  • When an application experiences slow queries, N+1 problems, or needs index strategy optimization, the skill will analyze your query patterns and provide EXPLAIN ANALYZE analysis, composite index designs, and query refactoring suggestions.

  • Database architecture evolution

  • When you need to perform database migrations, adjust table structures, or migrate from a monolithic database to a serverless solution, the skill provides safe migration strategies and architecture evolution paths.

    Core Features

  • Intelligent database selection

  • Recommend the most suitable database solution based on project context (user scale, deployment environment, performance requirements, cost budget). It doesn't default to recommending PostgreSQL, but objectively analyzes the pros and cons of options like SQLite, Neon, Turso, etc., to help you make an informed decision.

  • Schema design and relationship modeling

  • Provide database table structure design recommendations, including primary key selection strategies, foreign key relationship definitions, decisions on the degree of normalization, and guidance on when to use structured data vs JSON fields.

  • Indexing strategy and query optimization

  • Analyze query patterns, design efficient index schemes (single-column indexes, composite indexes, partial indexes), identify and resolve N+1 query problems, and provide EXPLAIN ANALYZE interpretation and optimization suggestions.

    Frequently Asked Questions

    When should I use SQLite instead of PostgreSQL?


    SQLite is suitable for small applications, local development environments, edge computing scenarios, and single-user applications. Its advantages are zero configuration, serverless operation, file-level storage, and very low maintenance costs. If your application expects a relatively small user base (<100k concurrent users), does not require complex transactional processing, and is deployed on edge nodes or resource-constrained environments, SQLite is often the wiser choice. PostgreSQL shows clear advantages only when you need high write concurrency, complex relational queries, data analytics, or plan to scale to large deployments.

    How to choose between Prisma, Drizzle, and Kysely?


    The choice depends on your project requirements and team preferences. Prisma provides the most complete developer experience, auto-generating a type-safe client—suitable for rapid development and teams that heavily rely on ORM features. Drizzle strikes a balance between type safety and performance, producing more controllable SQL, suitable for projects with higher performance demands. Kysely offers the experience closest to raw SQL, with a gentler learning curve—suitable for developers familiar with SQL or scenarios that require precise control over query logic.

    How to avoid the N+1 query problem?


    N+1 issues typically occur when running related queries inside a loop. Solutions include: using the ORM's eager loading features, such as Prisma's include or Drizzle's relation queries; using JOINs to fetch data in a single query where appropriate; reconsidering data modeling to reduce joins via denormalized fields or JSON fields; using EXPLAIN ANALYZE to identify performance bottlenecks and adding targeted composite indexes. The skill will help analyze your specific query scenarios and provide the most suitable optimization plan.