database-design

Design and optimize PostgreSQL relational database schemas and indexing.

186|15|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/kid-sid/claude-spellbook --skill database-design-kid-sid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/kid-sid/claude-spellbook/tree/main/skills/database-design
Command: npx skills add https://github.com/kid-sid/claude-spellbook --skill database-design-kid-sid

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

A practical reference for designing, indexing, migrating, and operating relational databases in production, with PostgreSQL as the primary target.

Core Features & Use Cases

  • Schema design guidance for robust data models, normalization strategies, and practical examples tailored to PostgreSQL.
  • Indexing and query optimization techniques, including when and how to apply B-tree, GiST, and GIN indexes, plus plan analysis with EXPLAIN ANALYZE.
  • Zero-downtime migration patterns and safe schema evolution using expand-contract and backfill strategies to avoid production disruption.
  • Use Case: When you need to migrate a live database: design changes, test with backfills, and cutover with minimal downtime.

Quick Start

Begin by reviewing current schemas, then apply PostgreSQL best practices described here to design scalable, maintainable relational databases.

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 PostgreSQL schema for scalability and maintainability?

PostgreSQL schema design involves applying normalization strategies and robust data modeling to ensure scalable, maintainable relational databases tailored to your specific service requirements.

When should I use GIN vs B-tree indexes in PostgreSQL?

PostgreSQL indexing strategies dictate using B-tree for standard equality and range queries, while GiST and GIN indexes optimize complex data types and full-text search for better query performance.

What is the best way to run zero-downtime database migrations?

Zero-downtime migrations utilize expand-contract patterns and backfill strategies to evolve PostgreSQL schemas safely, avoiding production disruption during deployment and cutover phases.

How do I diagnose N+1 query problems using EXPLAIN ANALYZE?

Diagnose N+1 queries by running PostgreSQL EXPLAIN ANALYZE on your SQL to inspect query plans, identify inefficient joins or repeated lookups, and apply appropriate indexing strategies.

Can I configure connection pooling for a PostgreSQL-backed service?

Connection pooling configuration is supported for PostgreSQL-backed services, managing database connections efficiently to reduce overhead and optimize query performance under concurrent load.