architecture-database-design

Installation
SKILL.md

Architecture: Database Design

Purpose

This skill establishes strict architectural and optimization guidelines for the PostgreSQL database. It complements the database-asyncpg-qdrant skill by enforcing robust schema design, proper indexing, safe migrations, and efficient data access patterns.

When to Use

  • Gate 3 (PLAN): When designing table schemas or planning data migrations.
  • Gate 4 (IMPLEMENT): When writing complex SQL queries, creating indexes, or adding JSONB columns.

Core Database Doctrine (Non-Negotiable)

1. Schema Design Conventions

  • Identifiers: Use snake_case strictly for tables and columns (unquoted).
  • Primary Keys: For reference tables (users, orders), prefer BIGINT GENERATED ALWAYS AS IDENTITY. Use UUIDv7 ONLY when global uniqueness or opacity is strictly required. No serial.
  • Foreign Keys: PostgreSQL does NOT auto-index FK columns. You MUST add them manually.
  • Nullability: Add NOT NULL everywhere it’s semantically required.
  • Timestamps: ONLY use TIMESTAMPTZ. Never use TIMESTAMP without timezone.
Installs
3
GitHub Stars
28
First Seen
Jun 22, 2026