bundles/infrastructure/skills/postgres-ops/SKILL.md
Operate a production Postgres database — backup strategy, point-in-time recovery, restore drills, connection pooling for serverless, and a disaster-recovery runbook. Use when asked to set up Postgres backups, plan disaster recovery, configure connection pooling, restore a database, or harden Postgres for production. Covers managed (RDS / Prisma Postgres) and self-managed instances.
npx skillsauth add shipshitdev/library postgres-opsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Keep a production Postgres safe to lose and fast to serve: backups you have actually restored, recovery you have actually tested, and pooling that survives serverless connection storms. Restore and recovery operations can overwrite data — they run behind explicit confirmation, against the right target.
Inputs:
backup / restore /
pooling / dr.Outputs:
Creates/Modifies:
restore writes to a database. Never to production without explicit, named
confirmation of the target. backup/pooling/dr produce config and plans.External Side Effects:
restore mutates a database. Treat connection strings and dumps
as secrets — never print credentials.Confirmation Required:
Delegates To:
aws-infrastructure for the storage/IAM around backups on AWS.monitoring-setup to alert on replication lag, connection saturation, and slow
queries.backup)Match the method to the hosting:
Managed (RDS, Prisma Postgres, etc.) — enable automated snapshots + PITR in the provider; set retention to the business's tolerance. Verify it is on rather than assuming; snapshots you never checked are not a backup.
Self-managed — logical backups for portability, physical + WAL for PITR:
pg_dump --format=custom --file=db-$(date +%F).dump "$DATABASE_URL" # logical
# physical base backup + WAL archiving enables point-in-time recovery
pg_basebackup -D /backup/base -Ftar -z -X stream
Two rules that decide whether a backup is real: store it off the database host (a snapshot on the same disk dies with the disk), and set a retention that covers the time to notice a problem, not just to react.
PITR needs continuous WAL archiving (archive_mode = on, archive_command shipping
WAL off-host) on top of a base backup. Define and write down two numbers:
Recovery replays WAL from a base backup up to a target time. The only proof it works is a drill (below).
restore)A backup is unproven until restored. Restore into a scratch database, never over production, and verify:
scratch_db="restore_check_$(date +%s)"
trap 'dropdb --if-exists "$scratch_db"' EXIT
createdb "$scratch_db"
pg_restore --dbname="$scratch_db" --clean --if-exists db-YYYY-MM-DD.dump
psql "$scratch_db" -c "SELECT count(*) FROM <critical_table>;" # sanity-check row counts
dropdb "$scratch_db"
trap - EXIT
Only restore to production on an explicit, named request, after confirming the target connection string is the intended one. Schedule a periodic restore drill — an untested backup is a guess.
pooling)Serverless (Vercel functions) + Postgres = connection exhaustion: each concurrent
invocation opens a connection, and Postgres has a hard max_connections. Put a pooler
in front:
directUrl in Prisma).max_connections minus headroom for admin/migrations —
not higher, or the pooler just moves the exhaustion.dr)Produce a runbook someone can follow at 3am without this context:
monitoring-setup): replication lag,
connection saturation, disk full, instance down.State the current RPO/RTO honestly, and name the gap between them and the target.
max_connections
and take the app down under load.development
TypeScript refactoring and modernization guidelines from a principal specialist perspective. This skill should be used when refactoring, reviewing, or modernizing TypeScript code to ensure type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving TypeScript type architecture, narrowing, generics, error handling, or migration to modern TypeScript features.
tools
Resolves TypeScript and JavaScript problems across type-level programming, performance, monorepo management, migration, and modern tooling. Invoke when diagnosing "type instantiation excessively deep" errors, migrating JS to TS, configuring strict tsconfig, debugging module resolution, or choosing between Biome/ESLint/Turborepo/Nx.
tools
Turborepo monorepo build system guidance. Triggers on: `turbo.json`, task pipelines, `dependsOn`, caching, remote cache, the `turbo` CLI, `--filter`, `--affected`, CI optimization, environment variables, internal packages, monorepo structure, and package boundaries. Use when the user configures tasks or workflows, creates packages, sets up a monorepo, shares code between apps, runs changed packages, debugs cache behavior, or works in an `apps/` plus `packages/` workspace.
tools
Provides Tailwind CSS v4 performance optimization and best practices guidelines. Triggers when writing, reviewing, or refactoring Tailwind CSS v4 code; when working with Tailwind configuration, @theme directive, utility classes, responsive design, dark mode, container queries, or CSS generation optimization.