database-schema-designer

Design SQL and NoSQL database schemas with decision frameworks for denormalization, multi-tenancy, and polymorphic associations.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/leonardoacosta/skills --skill database-schema-designer-leonardoacosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-schema-designer
Source: https://github.com/leonardoacosta/skills/tree/main/t3-stack-kit/skills/database-schema-designer
Command: npx skills add https://github.com/leonardoacosta/skills --skill database-schema-designer-leonardoacosta

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Designing a database schema involves judgment calls that go beyond normalization syntax: when to denormalize, whether to use a junction table or a JSONB column, how to shape multi-tenant schemas, and how to model polymorphic associations. This Skill provides decision frameworks for those trade-offs so schemas maintain data integrity, query performance, and long-term maintainability. ## Core Features & Use Cases - Decision Frameworks: Structured guidance for SQL vs NoSQL selection, denormalization timing, junction-table-vs-JSONB trade-offs, multi-tenancy schema shapes, and polymorphic association strategies. - Syntax Reference: Deep-dive reference covering data types, indexing strategies, constraints, relationship DDL, MongoDB patterns, zero-downtime migrations, and EXPLAIN-based performance analysis. - Checklists and Templates: A pre-design through documentation checklist plus a reversible up/down migration SQL template. - Use Case: When building a multi-tenant SaaS on Postgres, use this Skill to decide on a shared schema with tenant_id columns, learn that indexes must lead with the tenant column, and scope UNIQUE constraints per tenant. ## Quick Start Ask the agent to design a schema for a multi-tenant SaaS application and explain whether tags should use a junction table or a JSONB column.

Frequently Asked Questions about database-schema-designer

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

FAQPage Schema
How do I decide between a junction table and a JSONB column?

Use a junction table when you need to JOIN, filter, or aggregate on individual values, require referential integrity, or have unbounded cardinality. Use a JSONB column when the set is small, bounded, varies per row, and is never queried relationally.

When should I denormalize a database schema?

Denormalize only when a JOIN-based query measurably misses its latency budget, you have defined staleness tolerance, and a clear sync mechanism exists such as a trigger or materialized view. Keep normalized tables as the canonical source of truth.

What multi-tenant schema shape should I use in Postgres?

Default to a shared schema with a tenant_id column for hundreds to thousands of tenants. Use schema-per-tenant for regulatory isolation at moderate tenant counts, and database-per-tenant only for contractual physical isolation requirements.

Should I use a native Postgres ENUM for category columns?

Avoid native Postgres ENUM types for category sets that may grow, shrink, or reorder, since enum values cannot be removed once shipped. Use a lookup table with a foreign key or a CHECK constraint instead.

How do I model polymorphic associations with data integrity?

Use separate nullable foreign keys with a CHECK constraint enforcing exactly one non-null when the target type set is small and stable. Reserve type-plus-id columns without database-level foreign keys for genuinely open-ended target sets.

How do I write zero-downtime database migrations?

Add new columns as nullable first, deploy code that writes to them, backfill existing rows, then add constraints. Always write a reversible DOWN migration and test it on staging with production-shaped data.