skills/modra40/claude-codex-skills-directory/postgresql-principal-engineer

postgresql-principal-engineer

Installation
SKILL.md

PostgreSQL Mastery (Senior → Principal)

Operate

  • Start by confirming workload shape: OLTP, analytical, mixed, multi-tenant, or event-heavy.
  • Clarify scale: row counts, write rate, hottest tables, retention, and latency SLO.
  • Treat PostgreSQL as a production system, not just a storage library: backups, locks, migrations, observability, and failover matter.
  • Prefer boring relational design over clever schema tricks.

Default Standards

  • Model invariants with constraints first, code second.
  • Use transactions intentionally; keep them short.
  • Index for real query patterns, not theoretical ones.
  • Avoid ORMs hiding expensive SQL on hot paths.
  • Make migration rollout and rollback strategy explicit.

“Bad vs Good”

-- ❌ BAD: filter on an unindexed hot-path column.
SELECT * FROM orders WHERE status = 'pending';

-- ✅ GOOD: index with realistic filter/order pattern.
CREATE INDEX CONCURRENTLY idx_orders_status_created_at
ON orders (status, created_at DESC);
-- ❌ BAD: delete millions of rows in one transaction.
DELETE FROM events WHERE created_at < now() - interval '90 days';

-- ✅ GOOD: batch or partition for controlled retention.

Validation Commands

  • Run psql -f migration.sql only after review of lock/runtime impact.
  • Run EXPLAIN (ANALYZE, BUFFERS) for hot queries.
  • Run VACUUM (ANALYZE) and review autovacuum posture where needed.
  • Validate backup and restore workflows before calling a system production-ready.

References

Weekly Installs
2
GitHub Stars
5
First Seen
5 days ago