db-migration
Skill7 starsChanged 7 months agoMITView on GitHub
Generates database migration files for schema changes with up/down migrations, safety checks, rollback instructions, and index recommendations. Auto-detects the ORM/migration tool in use.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- TienDat-Vna/BackSpectheir own version, first seen Sep 28, 2026
- aiqadam/qadam-flowtheir own version, first seen Sep 20, 2026
- tadoEng/web-startertheir own version, first seen Aug 11, 2026
- nikandr-surkov/ai-saas-startertheir own version, first seen Jul 12, 2026
- PiloTracer/pilo.ai.logicbisontheir own version, first seen Jul 6, 2026
- justnau1020/claude-ostheir own version, first seen Mar 30, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- nikandr-surkov/ai-saas-starter★ 23same name
- aiqadam/qadam-flow★ 4same name
- justnau1020/claude-os★ 3same name
- tadoEng/web-starter★ 2same name
- TienDat-Vna/BackSpec★ 1same name
- PiloTracer/pilo.ai.logicbison★ 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 repository45 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- a11y-auditSkill
- api-designSkill
- architecture-reviewSkill
- business-blueprintSkill
- business-logic-auditSkill
- changelogSkill
- ci-pipelineSkill
- code-coverageSkill
- competitive-analysisSkill
- convert-codeSkill
- create-componentSkill
- debugSkill
- dependency-auditSkill
- deploy-checklistSkill
- design-flowSkill
- docker-setupSkill
- env-setupSkill
- error-monitorSkill
- estimateSkill
- explain-codeSkill
- fix-issueSkill
- generate-docsSkill
- git-cleanupSkill
- grill-meSkill
- handoffSkill
- legal-pagesSkill
- memory-importSkill
- memorySkill
- microcopySkill
- migrate-frameworkSkill
- onboardSkill
- optimizeSkill
- pr-summarySkill
- refactorSkill
- reference-appSkill
- review-prSkill
- security-scanSkill
- seo-scaffoldSkill
- tddSkill
- web-launch-checkSkill
- wireframeSkill
- write-skillSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Check current schema state
- Very specific: line 45
Update schema.prisma first, then generate.
- Distinctive: line 63
Create migration file manually following existing patterns.
- Distinctive: line 66
Create SQL files with up/down sections.
- Distinctive: line 75
Default values for new NOT NULL columns
- Distinctive: line 94
Run on staging first
- Distinctive: line 103
Always generate both UP and DOWN migrations
- Distinctive: line 104
Never drop columns without explicit user confirmation
- Distinctive: line 105
Always add indexes for foreign keys
- Distinctive: line 106
Test migrations against a copy of production data when possible
“Common” is measured: kept by at least 6 in 10 of the 5 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
Database Migration Helper
Detect Migration Tool
!ls prisma/ migrations/ alembic/ alembic.ini db/migrate/ knexfile.* flyway.conf sequelize* typeorm* drizzle.config.* 2>/dev/null
!ls package.json 2>/dev/null && cat package.json 2>/dev/null | grep -E "prisma|knex|sequelize|typeorm|drizzle|kysely|mikro-orm" | head -5
!ls requirements.txt pyproject.toml 2>/dev/null && cat requirements.txt pyproject.toml 2>/dev/null | grep -iE "alembic|django|sqlalchemy|tortoise" 2>/dev/null | head -5
!ls go.mod 2>/dev/null && cat go.mod 2>/dev/null | grep -E "goose|migrate|atlas|ent" | head -5
Existing Migrations
!find . -path "*/migrations/*" -o -path "*/migrate/*" -o -path "*/prisma/migrations/*" -o -path "*/db/migrate/*" 2>/dev/null | grep -v node_modules | tail -10
Migration Process
Step 1: Understand the Change
- Parse the requested schema change
- Identify affected tables/collections
- Check current schema state
- Determine if this is: CREATE, ALTER, DROP, or INDEX
Step 2: Safety Analysis
Data Loss Risk Assessment:
- Dropping a column/table → HIGH RISK — requires data backup
- Renaming a column → MEDIUM RISK — two-step migration recommended
- Adding NOT NULL without default → HIGH RISK — will fail on existing rows
- Changing column type → MEDIUM RISK — potential data truncation
- Adding column with default → LOW RISK — safe
- Adding index → LOW RISK — may lock table on large datasets
Step 3: Generate Migration
For Prisma (Node.js)
npx prisma migrate dev --name <description>Update schema.prisma first, then generate.
For Alembic (Python/SQLAlchemy)
alembic revision --autogenerate -m "<description>"For Django
python manage.py makemigrations --name <description>For Rails ActiveRecord
rails generate migration <Description>For Knex/Sequelize
Create migration file manually following existing patterns.
For Go (goose/migrate)
Create SQL files with up/down sections.
For Raw SQL
Generate separate UP and DOWN files.
Step 4: Migration Content
UP migration must include:
- Table/column creation or modification
- Default values for new NOT NULL columns
- Indexes for columns used in WHERE, JOIN, ORDER BY
- Foreign key constraints where appropriate
- Comments explaining the change
DOWN migration must include:
- Exact reversal of the UP migration
- Data preservation strategy if dropping columns
- Warning comments for irreversible operations
Step 5: Index Recommendations
For the affected tables, recommend indexes based on:
- New foreign key columns (always index)
- Columns used in WHERE clauses
- Columns used in ORDER BY
- Columns used in JOIN conditions
- Composite indexes for multi-column queries
Step 6: Deployment Notes
- Run on staging first
- Estimated duration for large tables
- Lock implications (table locks, row locks)
- Recommended maintenance window (if needed)
- Rollback command
Rules
- Always generate both UP and DOWN migrations
- Never drop columns without explicit user confirmation
- Always add indexes for foreign keys
- Test migrations against a copy of production data when possible
- Include data migration logic if restructuring data
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.

