database-design

Design relational database schemas with normalization, indexing, and safe migrations.

3|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/mauriciodelrio/delriodev-skills --skill database-design-mauriciodelrio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/mauriciodelrio/delriodev-skills/tree/main/es-skills/software/backend/database-design
Command: npx skills add https://github.com/mauriciodelrio/delriodev-skills --skill database-design-mauriciodelrio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide clear, production-ready guidance to design relational database schemas that are consistent, maintainable, and performant while avoiding common pitfalls like missing indexes, inconsistent naming, and unsafe migrations.

Core Features & Use Cases

  • Naming and conventions: enforce snake_case tables and columns, canonical primary and foreign key patterns, and consistent index/constraint naming.
  • Schema modeling: model 1:1, 1:N and explicit M:N relationships, choose between normalization and denormalization, and recommend JSON columns or STI patterns where appropriate.
  • Operational rules: design indexes and composite keys, implement soft deletes and timestamps, define enums and state machines, and plan safe, non-destructive migrations for ORMs such as Prisma or Drizzle.
  • Use Case: model an orders system with users, products, order_items, and product_categories including indexing, soft delete strategy, and migration steps for adding non-nullable columns.

Quick Start

Use the database-design skill to model a normalized schema for an orders system, specifying tables, primary and foreign keys, indexes, soft delete strategy, and migration steps.

Frequently Asked Questions about database-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a relational database schema with proper indexes and foreign keys?

To design a relational database schema, you model 1:1, 1:N, and M:N relationships using canonical primary and foreign key patterns, and plan composite indexes to ensure query performance and data consistency.

What's the best way to plan safe, non-destructive migrations in Prisma?

Planning safe migrations in Prisma involves non-destructive migration steps, such as safely adding non-nullable columns, to prevent data loss and maintain schema consistency during updates.

How do I implement soft deletes and state machine enums in a database schema?

Implementing soft deletes and enums in a database schema involves defining timestamped deletion columns and state machine constants to preserve historical records and enforce valid state transitions.

When should I normalize vs denormalize tables, or use JSON columns in my schema?

Normalize tables for data consistency, denormalize for read performance, and use JSON columns or single-table inheritance patterns when modeling flexible, semi-structured attributes in your schema.

Does this database schema design approach work with Drizzle ORM?

Yes, the database design approach works with Drizzle by defining compatible naming conventions, indexing strategies, and safe migration plans tailored for ORM-based relational projects.

What naming conventions should I use for tables, columns, and constraints?

Use snake_case for tables and columns, and apply canonical naming patterns for indexes and constraints to maintain a consistent, readable, and maintainable relational database schema.