db-migrate
Skill8 starsChanged 48 days agoMITView on GitHub
Creates, checks the status of, and validates database migrations by auto-detecting the project's migration framework (Alembic, Prisma, Knex, Django, Rails/ActiveRecord, Flyway, Atlas, TypeORM, Sequelize, SQLx, golang-migrate, Liquibase) from marker files, then driving that framework's own CLI. Use when the user wants to create a new migration, check pending vs. applied migration status, or validate a migration for a missing rollback script, a missing foreign-key index, or a destructive operation like DROP TABLE / TRUNCATE / DELETE FROM. Trigger phrases include "create a migration", "check migration status", "any pending migrations", "validate this migration", "does this migration have a rollback". Not for designing the schema change itself or writing ORM model code (use implement-feature), this skill only manages migration files and framework tooling once the schema change is already decided.
- Deletes or force-pushes
18 other projects use a version of this.
Adopted by
Most recently taken up by
- suxrobGM/jobpilottheir own version, first seen Nov 7, 2026
- lablup/backend.aitheir own version, first seen Oct 8, 2026
- linuxfoundation/insightstheir own version, first seen Oct 8, 2026
- Ame-Al/ametheir own version, first seen Oct 8, 2026
- simstudioai/simtheir own version, first seen Oct 8, 2026
- pgnzbl-ux/crucibletheir own version, first seen Aug 27, 2026
Used with
Projects with it also use react-query-best-practices, you-might-not-need-a-callback and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bibektimilsina00Skillreact-query-best-practices
Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.
Also in 3 projects that use this
bibektimilsina00Skillyou-might-not-need-a-callback
Analyze and fix useCallback anti-patterns in your code
Also in 3 projects that use this
MicrosoftSkillcleanup
Also in 3 projects that use this
VercelSkilldeploy
Deploy applications to Vercel. Use when the user says "deploy", "deploy to Vercel", "push to production", "deploy my app", or "go live".
Also in 4 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
MicrosoftSkillrelease
Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).
Also in 3 projects that use this
- +3 more from bibektimilsina00
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- simstudioai/sim★ 30ksame name
- lablup/backend.ai★ 679same name
- linuxfoundation/insights★ 288same name
- alexeykrol/claude-code-starter★ 194same name
- suxrobGM/jobpilot★ 110same name
- getsentry/abacus★ 77same name
- lfrodrigues/packt-claude-code-course-auth★ 9same name
- mean-weasel/bullhorn★ 4same name
- pgnzbl-ux/crucible★ 4same name
- vndee/engineering-skills★ 3same name
8 more not listed
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 repository53 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-browserSkill
- anything-to-skillSkill
- ci-generateSkill
- ci-localSkill
- clotho-researchSkill
- codex-imagegenSkill
- create-ruleSkill
- create-skillSkill
- docker-initSkill
- docs-adrSkill
- docs-checkSkill
- docs-diagramSkill
- docs-initSkill
- docs-rfcSkill
- docs-updateSkill
- env-setupSkill
- find-skillsSkill
- fix-bugSkill
- git-commitSkill
- git-create-prSkill
- gitflowSkill
- git-releaseSkill
- git-syncSkill
- i18n-checkSkill
- implement-featureSkill
- improve-skillSkill
- inject-docsSkill
- jira-cliSkill
- motion-studioSkill
- optimize-ai-setupSkill
- orchestrateSkill
- oss-launchSkill
- prd-to-issuesSkill
- product-design-specSkill
- product-design-tokensSkill
- product-prdSkill
- project-illustratorSkill
- project-plannerSkill
- refactorSkill
- renderSkill
- review-codeSkill
- review-depsSkill
- review-designSkill
- review-perfSkill
- review-planSkill
- review-securitySkill
- shipSkill
- stopslopSkill
- test-suiteSkill
- vrt-checkSkill
- wtfSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 7 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
7
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
- Distinctive: line 13
Create, check the status of, and validate database migrations across any framework.
- Distinctive: line 18
Never invent commands: Only run commands from the detection table in references/framework-commands.md or found in the project's own …
- Distinctive: line 34
If multiple frameworks are detected (e.g.
- Very specific: line 46
If --name <name> is given, use it.
- Very specific: line 55
Check naming conventions in existing migrations (Glob migrations/, db/migrate/) and match the project's pattern.
- Very specific: line 56
Run the framework-native create command from the reference table (use --autogenerate / schema-diff mode where the framework supports it, …
- Distinctive: line 57
Read the generated file back and show it to the user: don't just report that a command succeeded.
- Distinctive: line 59
Never auto-fix destructive operations or mixed data + schema changes: report them for the user's decision.
- Distinctive: line 64
Run the framework's status command and show applied migrations (with timestamps), pending migrations, and the current schema version, …
- Distinctive: line 86
Prefer transactional DDL where the database supports it, for atomicity.
“Common” is measured: kept by at least 6 in 10 of the 13 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
DB Migrate
Create, check the status of, and validate database migrations across any framework. Auto-detects the migration tool from project marker files and drives its native CLI: this skill never invents a migration command.
Ground rules
- Detect before acting. Scan for marker files (Phase 1) before running anything.
- Never invent commands. Only run commands from the detection table in references/framework-commands.md or found in the project's own docs/scripts.
- Flag destructive operations and never auto-fix them.
DROP TABLE,DROP COLUMN,TRUNCATE,DELETE FROMget a warning and require the user's explicit go-ahead: this skill reports, it does not silently rewrite or apply a migration containing one. - Report only what a command actually produced. File paths, migration names, and status output in the final summary must come from
ls/cat/the framework CLI's own output, never guessed or reconstructed from memory.
Workflow
Phase 1: Detect framework
ls alembic.ini prisma/schema.prisma knexfile.* flyway.conf flyway.toml \
db/migrate/ manage.py atlas.hcl typeorm.config.* ormconfig.* \
liquibase.properties 2>/dev/nullAlso check package.json (knex, db-migrate, sequelize, typeorm), pyproject.toml/requirements.txt (alembic, sqlalchemy), and Gemfile (activerecord) for framework dependencies when no marker file is conclusive.
If multiple frameworks are detected (e.g. a monorepo with both a Python and a Node service), ask the user which one they mean. If none is detected, ask the user to name it: don't guess a command for a framework you can't confirm.
Full detection table and per-framework commands: references/framework-commands.md, load it once the framework is identified, before running any create/status/rollback command.
Phase 2: Parse the request
Determine the operation from $ARGUMENTS or the user's phrasing:
create(default if unspecified): make a new migration filestatus: show pending vs. applied migrationsvalidate: check rollback coverage, naming convention, index coverage, destructive ops
If --name <name> is given, use it. Otherwise ask for a short, descriptive name before creating the file: don't invent one.
--dry-run shows what would be created/run without executing it.
Phase 3: Execute
Production guard. Before running any command that connects to a database (status, autogenerate/schema-diff create, shadow-database commands like prisma migrate dev, or anything that applies or rolls back), check where it points: the environment name (APP_ENV, RAILS_ENV, NODE_ENV, DJANGO_SETTINGS_MODULE), the DATABASE_URL or framework config host, and the target named in --env/profile flags. If any of it looks like production (prod, production, a non-local managed-cloud host), stop and ask the user to confirm before running. Commands that only write a file offline need no check.
create
- Check naming conventions in existing migrations (
Glob migrations/,db/migrate/) and match the project's pattern. - Run the framework-native create command from the reference table (use
--autogenerate/ schema-diff mode where the framework supports it, e.g. Alembic, Prisma). - Read the generated file back and show it to the user: don't just report that a command succeeded.
- Run the
validatechecks below on the new file, then fix what is fixable in place: add a missingdown/reverse, add aCREATE INDEXfor an unindexed foreign key, rename a file that breaks the naming pattern. Re-validate after each fix. Stop after 3 rounds, or sooner once clean, and report what still fails. - Never auto-fix destructive operations or mixed data + schema changes: report them for the user's decision.
- Remind the user to review the final diff.
status
Run the framework's status command and show applied migrations (with timestamps), pending migrations, and the current schema version, copied from that command's real output.
validate
Also runs automatically on a new file at the end of create. Check the target migration file(s) for:
- Rollback exists: every
up/forward change has a matchingdown/reverse (warn if missing). - Naming convention: matches the pattern already used in the migrations directory.
- Foreign-key indexes:
grep -iE "REFERENCES|foreign_key|FK_"and confirm a correspondingCREATE INDEXexists. - Destructive operations:
grep -iE "DROP TABLE|DROP COLUMN|TRUNCATE|DELETE FROM", flag every hit by line. - Mixed data + schema changes: warn if one file both alters structure and mutates rows, since these usually deploy and roll back better as two files.
Phase 4: Report
Summarize using only what Phases 1–3 actually produced:
- File path(s) touched
- Migration name and timestamp
- Warnings found (destructive ops with line numbers, missing rollback, missing index): omit the section entirely if there were none, don't write "no issues found" as a guess
- Next step commands (apply / rollback), taken verbatim from the detection table for the detected framework
Notes
- Review auto-generated migrations before applying: autogenerate can include unintended changes (e.g. Alembic missing custom types).
- Prefer transactional DDL where the database supports it, for atomicity. MySQL auto-commits DDL: flag this to the user when detected instead of assuming a transaction wraps it.
Worked examples
1. Create, framework auto-detected (Alembic)
$ ls alembic.ini → found
Framework: Alembic
$ alembic revision --autogenerate -m "add_users_email_index"
Generating migrations/versions/a1b2c3_add_users_email_index.py ... done
Created: migrations/versions/a1b2c3_add_users_email_index.py
upgrade(): op.create_index('ix_users_email', 'users', ['email'])
downgrade(): op.drop_index('ix_users_email', table_name='users')
Validated (round 1 of 3): rollback present, no destructive ops, no foreign keys.
Next: `alembic upgrade head` to apply, `alembic downgrade -1` to roll back.2. Status check (Prisma)
$ npx prisma migrate status
3 migrations found, 1 pending: 20260710120000_add_orders_table
Applied: 20260601090000_init, 20260615140000_add_users_table
Pending: 20260710120000_add_orders_table
Next: `npx prisma migrate deploy` to apply the pending migration.3. Validate, destructive op found (Knex)
$ grep -iE "DROP TABLE|DROP COLUMN|TRUNCATE|DELETE FROM" migrations/20260716_cleanup.js
12: knex.schema.dropTable('legacy_sessions')
WARNING: destructive operation at line 12 (dropTable).
Rollback (down()) is present but only recreates an empty table — dropped data is not recoverable from this migration alone.
This needs your explicit confirmation before it's treated as ready to apply.4. No framework detected
$ ls alembic.ini prisma/schema.prisma knexfile.* ... → none found
$ grep -l "knex\|sequelize\|typeorm" package.json → no match
I couldn't detect a migration framework from marker files or dependencies.
Which one are you using, or is this a brand-new project without one yet?5. Two frameworks detected in a monorepo
$ ls alembic.ini → found (api/)
$ ls prisma/schema.prisma → found (web/)
Both api/alembic.ini (Alembic) and web/prisma/schema.prisma (Prisma) are present.
Which service's migration do you want — api (Alembic) or web (Prisma)?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.

