migration-review
Skill2 starsChanged 3 days agoMITView on GitHub
Read-only zero-downtime audit of Alembic (alembic/versions/*.py), SQL migrations, and SQLAlchemy Foreign Keys for PostgreSQL lock contention, table rewrites, data-loss operations, missing lock_timeout/statement_timeout, and empty downgrade() functions. Writes MIGRATION_REPORT.md and migration_findings.json.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- jpicklyk/task-orchestratortheir own version, first seen Nov 27, 2026
- macro-inc/macrotheir own version, first seen Nov 15, 2026
- Urthella/backend-agent-skillstheir own version, first seen Nov 15, 2026
- paureis/pau-skillstheir own version, first seen Nov 8, 2026
- ryukirin/openspec-code-migrationtheir own version, first seen Nov 1, 2026
- melocalex/agent-knowledge-demotheir own version, first seen Oct 25, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- macro-inc/macro★ 6.6ksame name
- jpicklyk/task-orchestrator★ 215same name
- paureis/pau-skills★ 2same name
- Shri-Phnx/claude-skills★ 2same name
- melocalex/agent-knowledge-demo★ 0same name
- ryukirin/openspec-code-migration★ 0same name
- Urthella/backend-agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- backend-reviewSkill
- concurrency-checkSkill
- fastapi-prod-readySkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Read-only: Never edit migrations, models, or run alembic upgrade / downgrade.
- Very specific: line 20
If the user tells you which revision is live in production, add --since <revision> so only newer, still-changeable migrations are audited.
- Very specific: line 46
Run alembic upgrade or modify any migration or model file during a review.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migration review (read-only)
Goal: catch PostgreSQL locking, table-rewrite, rollback, and missing-index hazards before a migration hits production traffic. Talk to the user in their language; write MIGRATION_REPORT.md in English.
Read-only. Never edit migrations, models, or run alembic upgrade / downgrade. Write only the report files.
<kit> = <this skill's folder>/../fastapi-prod-ready. Read <kit>/MIGRATIONS-ZERO-DOWNTIME.md before grading edge cases.
1. Run the automated migration & FK audit
python <kit>/scripts/migration_audit.py <project> --out <report_dir> --no-failIf the user tells you which revision is live in production, add --since <revision> so only newer, still-changeable migrations are audited.
This scans alembic/versions/*.py, *.sql, alembic/env.py, and SQLAlchemy ORM models with Python ast (zero external packages) and writes MIGRATION_REPORT.md and migration_findings.json.
2. Verify each finding in context
Open each flagged migration and model file and verify:
- Index locks: Does
op.create_index/op.drop_indexon an existing table passpostgresql_concurrently=Trueinsidewith op.get_context().autocommit_block():? (Indexes on a brand-new empty table created in the sameupgrade()are safe.) - NOT NULL & defaults: Does
op.add_column(..., nullable=False)have a constantserver_default(PostgreSQL 11+ fast metadata-only default) instead of a volatile expression or missing default? Doesop.alter_column(..., nullable=False)useCHECK (col IS NOT NULL) NOT VALID->VALIDATE CONSTRAINT? - Destructive & rolling-deploy safety: Does
op.drop_column,op.drop_table,op.alter_column(type_=...), or column rename break currently running application pods during a rolling deploy? Enforce the expand-and-contract two-release pattern. - Lock & statement timeouts: Are
SET lock_timeout = '5s'andSET statement_timeout = '30s'enforced inalembic/env.pyor each DDL migration to prevent lock-queue amplification? - Reversible
downgrade(): Doesdowngrade()actually reverseupgrade()instead ofpass/.../NotImplementedError? - Foreign Key indexes: Does every SQLAlchemy
ForeignKey(...)column haveindex=True(or lead a compositeIndexin__table_args__)?
3. Deliver MIGRATION_REPORT.md
Ensure <report_dir>/MIGRATION_REPORT.md includes:
- Verdict (
❌ NOT READY/⚠️ ALMOST READY/✅ READY). - Verified findings with
file:line, PostgreSQL lock level (SHARE,ACCESS EXCLUSIVE), production impact, and zero-downtime replacement snippet. - "Changes to automated findings" listing any dropped or re-graded items (e.g., an empty staging-only table) and any manual schema risks found.
Reply in chat in 3–6 lines in the user's language: verdict, blocking migrations, safe rollout step, and report path.
Never
- Run
alembic upgradeor modify any migration or model file during a review. - Approve a non-concurrent index or
ALTER COLUMN TYPEon an existing production table without an explicit maintenance-window note from the user.
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.

