What problem does it solve? Slow queries, sequential scans on large tables, and bloated or missing indexes degrade multi-tenant Postgres/Supabase application performance, and fixing them ad-hoc risks production downtime. This Skill performs a read-only, six-gate audit and produces safe, reviewable SQL migrations instead of risky direct DDL. ## Core Features & Use Cases - Six-Gate Index Audit: Checks for missing indexes on hot columns (tenant_id, foreign keys, lookup keys), verifies tenant-leading composites, and detects duplicate, unused, and slow-query patterns via pg_stat_user_indexes and pg_stat_statements. - Safe Migration Generation: Emits CREATE INDEX CONCURRENTLY migrations with partial predicates and post-deploy verification queries, while scheduling DROP INDEX statements as separate follow-up migrations after 7+ days of evidence. - Guardrails and Refusals: Refuses non-concurrent index creation on large tables, drops without idx_scan proof, and non-tenant-leading indexes on tenant-scoped tables. - Use Case: When a CRM contacts page times out, run the audit to find a missing (tenant_id, phone) composite index, receive a concurrent migration file, and verify the Seq Scan is eliminated with EXPLAIN ANALYZE. ## Quick Start Ask the assistant to audit the Supabase database for missing indexes and slow queries on the contacts and jobs tables and propose safe migrations.