Run Postgres without taking production down — no negotiation.
Safe DDL on live tables, EXPLAIN before indexing, healthy vacuum, a pooler in front and a backup that only counts with a tested restore. Schema design belongs to schematize-database; this is the engine.
$ schematize install postgresNon-negotiable floors
Never switched off "to go faster". Full list in the skill.
Supported majors only
Production never runs an unsupported major; the EOL goes on the calendar and the upgrade is rehearsed with a rollback.
No DDL without lock_timeout
Every DDL on a live table starts with lock_timeout and a retry: a migration waiting for a lock blocks every query behind it.
Indexes and constraints without blocking
CREATE INDEX CONCURRENTLY and new constraints as NOT VALID followed by VALIDATE; never rewrite the table under ACCESS EXCLUSIVE.
Measure before indexing
pg_stat_statements on in every cluster and a real plan from EXPLAIN (ANALYZE, BUFFERS); without them, "it is slow" is a guess.
Autovacuum and a pooler
Autovacuum never switched off, wraparound watched, a low max_connections and PgBouncer in front of the application.
Backup with a tested restore
Base backup + continuous WAL (PITR), encrypted, with an automated restore and measured RPO/RTO; pg_dump is not the backup of record.
Least privilege and RLS
The migration role differs from the application role, scram-sha-256 with TLS, and RLS with FORCE and fail-closed in multi-tenant systems.
Commands
Installed in .claude/commands/. Run /pg-help anytime.
/pg-backupAudits backup/PITR and builds the restore rehearsal with measured RPO/RTO./pg-ccContext compact: writes context + checklist to the archive and runs /compact./pg-claudeCreates or merges the always-on Postgres CLAUDE.md at the repo root (won't overwrite other skills' blocks)./pg-explainReads an EXPLAIN (ANALYZE, BUFFERS) plan and proposes the index or rewrite, created without a lock./pg-handoffWrites the context handoff without compacting — session end or task switch./pg-helpLists every command./pg-loadForce-loads the whole normative body: version and config, EXPLAIN, vacuum, locks, pooling, replication, backup, upgrade and RLS./pg-migrateTurns a schema change into safe steps for a live table (expand, batched backfill, contract) and runs the gate./pg-reviewReviews migrations and config: runs the check-pg-migration.sh gate and reads what the machine cannot./pg-upgradePlans the major upgrade (pg_upgrade or logical) with a rehearsal, rollback and checklist.For AI agents
Install with no human in the loop. Metadata in llms.txt.
- Run: git clone https://github.com/schematizeme/skill-postgres.git && ./skill-postgres/install.sh
- Or download: https://github.com/schematizeme/skill-postgres/releases/latest/download/skill-postgres.zip and unzip into .claude/skills/
- Copy assets/CLAUDE.md to the repo root (always-on rule).
- Confirm with /pg-help.
Thảo luận
Đang tải…