db-migrate
Creates, checks the status of, and validates database migrations by auto-detecting the project's migration framework (Alembic, Prisma, Knex, Django…
Skill by mgiovani
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mgiovani-db-migrate
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/db-migrate
What's inside
- Skill name
db-migrate- Description
- 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.
- License
- MIT
- Metadata
- author: mgiovani · summary: Create and validate database migrations, then manage them across any framework · version: 2.0.0
- Instructions
- 133 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- evals.json · evals/
- trigger-eval.json · evals/
- framework-commands.md · references/
SKILL.md (first lines)
# 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](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 FROM` get 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
```bash
ls alembic.ini prisma/schema.prisma knexfile.* flyway.conf flyway.toml \
db/migrate/ manage.py atlas.hcl typeorm.config.* ormconfig.* \
liquibase.properties 2>/dev/null
```
Also 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](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 file
- `status`: show pending vs. applied migrations
- `validate`: 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
1. Check naming conventions in existing migrations (`Glob migrations/`, `db/migrate/`) and match the project's pattern.
2. Run the framework-native create command from the reference table (use `--autogenerate` / schema-diff mode where the framework supports it, e.g. Alembic, Prisma).
3. Read the generated file back and show it to the user: don't just report that a command succeeded.
4. Run the `validate` checks below on the new file, then fix what is fixable in place: add a missing `down`/reverse, add a `CREATE INDEX` for 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.
5. Never auto-fix destructive operations or mixed data + schema changes: report them for the user's decision.
6. 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:
1. Rollback exists: every `up`/forward change has a matching `down`/reverse (warn if missing).
2. Naming convention: matches the pattern already used in the migrations directory.
3. Foreign-key indexes: `grep -iE "REFERENCES|foreign_key|FK_"` and confirm a corresponding `CREATE INDEX` exists.
4. Destructive operations: `grep -iE "DROP TABLE|DROP COLUMN|TRUNCATE|DELETE FROM"`, flag every hit by line.
5. 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 matchFrom mgiovani/cc-arsenal, MIT.
More from mgiovani/cc-arsenal
- 0.631score
git-commit
mgiovani
Generate a conventional commit message (conventionalcommits.org) from the staged/unstaged diff and create the commit.
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
agent-browser
mgiovani
Headless browser automation CLI optimized for AI agents: drives a real browser via accessibility-tree snapshots and @e1-style refs for ~93% less context than…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
anything-to-skill
mgiovani
Turns a docs site, local folder, PDF or book, YouTube video, playlist or channel, or a topic into a source-grounded, token-efficient agent skill (hub…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
codex-imagegen
mgiovani
Generates images and polished raster art (logos, mascots, hero images, icons, characters, sprite sheets, illustrations, product mockups) by driving Codex…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
ci-generate
mgiovani
Generate a production-ready CI/CD pipeline config (GitHub Actions, GitLab CI, CircleCI, or Jenkins) by discovering the project's actual stack, test/build…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
create-rule
mgiovani
Create a new memory/instruction rule for whatever AI coding tool a project actually uses, a CLAUDE.md entry or .claude/rules/*.md file for Claude Code, an…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
create-skill
mgiovani
Create a new agent skill (or Claude Code slash command) from a plain-language description, using live spec fetching, pattern research, and an approval-gated…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
docker-init
mgiovani
Generates production-ready docker-compose.yml and Dockerfile(s) for a project by scanning its manifest files (package.json, pyproject.toml, Gemfile, go.mod…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
docs-check
mgiovani
Read-only audit of documentation against the current codebase, flags stale docs, missing sections, broken links, and hallucinated claims (wrong file…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
docs-diagram
mgiovani
Generate a Mermaid diagram (ER, architecture, deployment, or security) by reading the actual codebase and writing it to docs/.
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
docs-update
mgiovani
Refresh existing docs (architecture, onboarding, data-model, deployment, security, contributing) so they match the current codebase, verifying every claim…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
env-setup
mgiovani
Scans a codebase for environment variable usage to generate or sync .env.example, validate .env completeness against what the code actually reads, and detect…
SkillAFreshness: A★ 8Claude Code +9
Signals
- Stars
- 8
- Forks
- 1
- Open issues
- 6
- Last commit (this folder)
- Oct 5, 2026 (23 days ago)
- Last release
- Oct 7, 2026 (22 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 2.0.0
- License
- MIT
- Repository
- github.com/mgiovani/cc-arsenal
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from mgiovani
- 0.631score
docs-diagram
mgiovani
Generate a Mermaid diagram (ER, architecture, deployment, or security) by reading the actual codebase and writing it to docs/.
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
agent-browser
mgiovani
Headless browser automation CLI optimized for AI agents: drives a real browser via accessibility-tree snapshots and @e1-style refs for ~93% less context than…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
anything-to-skill
mgiovani
Turns a docs site, local folder, PDF or book, YouTube video, playlist or channel, or a topic into a source-grounded, token-efficient agent skill (hub…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
codex-imagegen
mgiovani
Generates images and polished raster art (logos, mascots, hero images, icons, characters, sprite sheets, illustrations, product mockups) by driving Codex…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
create-rule
mgiovani
Create a new memory/instruction rule for whatever AI coding tool a project actually uses, a CLAUDE.md entry or .claude/rules/*.md file for Claude Code, an…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
ci-generate
mgiovani
Generate a production-ready CI/CD pipeline config (GitHub Actions, GitLab CI, CircleCI, or Jenkins) by discovering the project's actual stack, test/build…
SkillAFreshness: A★ 8Claude Code +9
Cite this page
db-migrate skill. Agent Mart. https://agentmart.dev/skills/mgiovani-db-migrate (last updated 2026-10-24)