database-design

Design normalized database schemas with constraints, indexes, and safe migrations.

3|1|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/Probably-Group/Dev-AID --skill database-design-probably-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/Probably-Group/Dev-AID/tree/main/.dev-aid/skills/expert/database-design
Command: npx skills add https://github.com/Probably-Group/Dev-AID --skill database-design-probably-group

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Database design often leads to fragile schemas, slow queries, and security flaws when teams rely on assumptions instead of enforceable constraints and verified migration patterns.

Core Features & Use Cases

  • Normalization and schema structure: Produce clean relational models (including relationships and join tables) with explicit constraints and primary keys.
  • Indexing and full-text search: Recommend performant index strategies (composite, partial, covering, GIN/FTS) aligned to real query patterns.
  • Safe migrations and change management: Generate forward-safe migration steps with backfills and constraint timing to reduce data loss risk.
  • Security guardrails: Enforce anti-injection practices, least privilege guidance, constraint-based validation, and audit logging/row-level security patterns.

Use it when you are planning tables for a new feature, refactoring an underperforming data model, or creating migrations that must preserve data integrity and security.

Quick Start

Generate a PostgreSQL schema and migration plan for a multi-tenant application that includes users, organizations, membership, safe indexes for common queries, row-level security policies, and an audit log table.

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 database schema with row-level security policies and audit logging?

Database schema design with row-level security and audit logging requires defining least-privilege policies, generating trigger-based audit tables, and enforcing database-level validation constraints to maintain strict data integrity.

What is the best way to generate safe database migrations for PostgreSQL without losing data?

Safe database migrations are generated by creating deterministic, version-aware SQL steps with planned backfills and carefully timed constraint additions to ensure data integrity is preserved throughout the schema change.

How do I set up full-text search and composite indexes aligned to my query patterns?

Full-text search and composite indexing strategies are configured by analyzing query patterns and generating covering, partial, or GIN indexes to optimize data retrieval and ensure performant database operations.

Does this database design approach support multi-tenant soft-delete structures in MySQL and SQLite?

Multi-tenant soft-delete design is supported across PostgreSQL, MySQL, and SQLite by generating explicit relational models, join tables, and integrity constraints that enforce valid data relationships and safe record removal.

Why do I need database-level validation constraints instead of relying solely on application logic?

Database-level validation constraints are needed to prevent fragile schemas and security flaws, enforcing data integrity directly within the database structure rather than relying on potentially inconsistent application-level checks.