gorm-sql-migration-safety
Skill15 starsChanged 9 months agoMITView on GitHub
Database migration safety review for GORM + PostgreSQL. Use when writing or reviewing schema changes, AutoMigrate usage, ALTER TABLE statements, or index creation. Covers zero-downtime patterns, NOT NULL backfill, CONCURRENTLY indexes, idempotency, and rollback files.
In this repository9 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Use this skill when:
- Distinctive: line 31
Before any production migration:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Migration Safety
Expert-level review of database migration safety for production PostgreSQL deployments. Ensures zero-downtime schema changes, correct rollback capability, and idempotent migrations.
When to Apply
Use this skill when:
- Writing new migration files (
*.up.sql,*.down.sql) - Using GORM
AutoMigrate - Adding columns, indexes, or constraints to existing tables
- Dropping columns or tables
- Reviewing migrations before deploying to production
Zero-Downtime Migration Checklist
Before any production migration:
- NOT NULL column has DEFAULT or backfill migration first
- Indexes use
CONCURRENTLY - Migration is idempotent (
IF NOT EXISTS/IF EXISTS) down.sqlrollback file exists and is tested- DROP COLUMN is in a separate deploy after code references removed
- AutoMigrate is not in the application startup path
Rule Categories
| Priority | Count | Focus |
| Critical | 3 | AutoMigrate in production, NOT NULL backfill, missing rollback |
| High | 2 | CONCURRENTLY indexes, idempotent migrations |
| Medium | 1 | DROP COLUMN deprecation period |
Rules Covered (6 total)
Critical Issues (3)
critical-no-automigrate-production— Never run AutoMigrate in production startup pathcritical-not-null-backfill— NOT NULL column addition requires 3-step migrationcritical-always-provide-rollback— Every migration must have a paireddown.sql
High-Impact Patterns (2)
high-create-index-concurrently— UseCREATE INDEX CONCURRENTLYto avoid write lockshigh-idempotent-migration— UseIF NOT EXISTS/IF EXISTSfor safe re-runs
Medium Improvements (1)
medium-drop-column-deprecation— Deprecate before dropping — never drop in same deploy as code changes
Trigger Phrases
- "Review this migration"
- "Is this migration safe?"
- "ALTER TABLE"
- "ADD COLUMN / DROP COLUMN"
- "CREATE INDEX"
- "AutoMigrate"
- "Schema change"
- "Zero-downtime migration"
Related Skills
- query-performance — For index design (partial, composite)
- postgresql-syntax — For correct DDL SQL syntax
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.

