prod-dry-run
Skill113 starsChanged 10 days agoMITView on GitHub
Dump the production database through the tunnel, restore it over the local dev DB, apply pending migrations, and check the app against real data. Use for "dump prod", "restore prod locally", "dry-run migrations on a prod copy", or testing a branch against prod data.
- Reads credentials
- Deletes or force-pushes
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- commitSkill
- db-migrateSkill
- knip-cleanupSkill
- pr-reviewSkill
- releaseSkill
- restart-terminalSkill
- teaser-videoSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
App checks: Run this skill's script from apps/api (so .env loads) with push disabled:
- Very specific: line 50
Clean up: Delete .tmp/prod-dump/ once the user is done with the backups.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prod dry run
Prod is read-only here: the tunnel is used for pg_dump and nothing else. The local dev DB is
overwritten, so back it up first.
Setup
- Tools:
C:\Program Files\PostgreSQL\18\bin(pg_dump,pg_restore,psql). Not on PATH. - URLs:
apps/api/.envhas aDATABASE_URLfor local:5432and one for the tunnel:5433; one is commented out. Take the user, password and DB from each.%23in a URL is#. - Export
DATABASE_URLfor local:5432in every command below, whatever.envhas active. - Nothing may be connected to the local DB:
curl localhost:4101/api/healthmust fail. A running dev API would run maintenance and send pushes to real users' devices.
Steps
- Tunnel.
bun run db:tunnelin the background. Pollpsql -h localhost -p 5433 ... -c "select 1"until it answers. Note prod's latest_prisma_migrationsrows and the users andpilot_runscounts. Dump. Into
.tmp/prod-dump/(gitignored):- prod:
pg_dump -h localhost -p 5433 ... -Fc -f prod-<date>.dump - local backup:
pg_dump -h localhost -p 5432 ... -Fc -f local-before-<date>.dump
Then stop the tunnel.
- prod:
- Restore. On
:5432againstpostgres: terminatejobpilotbackends,drop database jobpilot,create database jobpilot, thenpg_restore --no-owner --no-acl -d jobpilot prod-<date>.dump. Confirm the counts match step 1. - Migrate.
bun --cwd=apps/api run db:migrate:apply. Thenbun --cwd=apps/api run db:diffmust print an empty migration. Prisma misses partial indexes, so also confirm the hand-written ones survive (select indexname from pg_indexes where tablename='pilot_runs'). - SQL checks. Query what the new migrations backfill or drop: null counts on new columns, rows a backfill missed (grouped by type and date), and data the branch's behavior changes now act on (for example, unanswered messages that will get a reply after deploy).
App checks. Run this skill's script from
apps/api(so.envloads) with push disabled:cd apps/api DATABASE_URL=<local> VAPID_PRIVATE_KEY= bun ../../.claude/skills/prod-dry-run/scripts/check.tsFor every user it parses every run payload, loads up to 5 thread pages, loads run history, and builds a task list. Mail sync, maintenance and the digest are stubbed. It must print
Failures: 0. For branch-specific live checks, write a scratch script beside it the same way (services built withnew X(db)), delete any rows it creates, then delete the script.- Clean up. Delete
.tmp/prod-dump/once the user is done with the backups. Local now holds the migrated prod copy; restorelocal-before-*.dumpwith step 3 if the user wants the old data back.
Report
Prod's state (migrations, counts), each migration applied, drift result, the SQL findings, the app-check totals and failures, and what deploying will visibly change for users.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

