relational-database

Designs relational database schemas with constraints, transactions, indexes, and zero-downtime migrations.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill relational-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: relational-database
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/relational-database
Command: npx skills add https://github.com/machenjie/rd-skills --skill relational-database

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Prevents data corruption and performance surprises by turning relational storage decisions into explicit schema constraints, transaction boundaries, and safe migration plans.

Core Features & Use Cases

  • Relational schema design with DB-enforced invariants: translate business rules into PK/FK, UNIQUE, CHECK, and NOT NULL constraints so correctness survives concurrent writers.
  • Transaction, isolation, and locking guidance: define isolation levels, locking strategy, and conflict handling for concurrent update paths.
  • Index and migration planning for production safety: align indexes to real query predicates and stage schema changes using expand-contract to minimize downtime and lock risk.

Quick Start

Use relational-database to produce a production-ready relational schema plan for your new entity relationships, including constraints, transaction settings, index rationale, and a zero-downtime expand-contract migration sequence.

Frequently Asked Questions about relational-database

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

FAQPage Schema
How do I design a relational database schema that prevents data corruption under concurrent writes?

Design a relational database schema by translating business invariants into explicit PK/FK, UNIQUE, CHECK, and NOT NULL constraints. This enforces transactional integrity so data correctness survives concurrent writers and prevents anomalies at the storage layer.

How do I plan a zero-downtime migration for a production PostgreSQL database?

Plan zero-downtime PostgreSQL migrations by staging schema changes using an expand-contract sequence. This approach minimizes lock risk and downtime, while explicitly incorporating rollback and observability considerations for production safety.

What isolation level and locking strategy should I use for concurrent transactional updates?

Choose isolation levels and locking strategies by explicitly defining conflict handling for concurrent update paths. Mapping transaction boundaries to your specific concurrency requirements ensures predictable query performance and prevents write conflicts.

How do I align indexes with real query predicates for predictable database performance?

Align indexes with query predicates by providing explicit query-driven index justification. This ensures indexes directly support your actual SQL query workloads and multi-table joins, delivering predictable performance rather than blind optimization.

Does this schema design approach work for multi-table joins and complex relational data domains?

Yes, this approach explicitly handles multi-table joins and concurrency-safe writes for critical data domains. It requires mapping explicit invariants to database constraints to ensure transactional correctness across complex relational structures.