What problem does it solve? Slow queries, missing indexes, N+1 patterns, and weak schema constraints are hard to diagnose without a disciplined process. This Skill provides structured, task-routed guides for relational database work so every recommendation is grounded in the real execution plan and actual schema rather than guesswork. ## Core Features & Use Cases - Query Optimization: Diagnose slow queries with EXPLAIN (ANALYZE, BUFFERS), fix Seq Scans with the right B-tree, composite, partial, or covering index, enforce sargable predicates, eliminate N+1 with joins or batched IN queries, and replace high-OFFSET pagination with keyset cursors. - Schema Design: Apply normalization, correct types (numeric for money, timestamptz for time), constraints as executable documentation (FK, UNIQUE, CHECK, NOT NULL), surrogate vs natural key selection, and consistent naming conventions. - Safety-First Execution: Read-only by default — only SELECT and EXPLAIN run; all writes, DDL, and migrations (CONCURRENTLY indexes, batched backfills, expand/contract) are delivered as ready-to-run recommendations requiring explicit user authorization. - Use Case: A developer notices an endpoint slowing down as order volume grows. The Skill reads the real schema and indexes, runs EXPLAIN ANALYZE on the query, identifies a missing composite index and an N+1 loop in the ORM code, and delivers the corrected query plus a CREATE INDEX CONCURRENTLY statement for the user to approve. ## Quick Start Ask the assistant to review a slow SQL query or database schema using the rc-sql skill, providing the query text and any available DDL or table definitions.