Db migrate
Generates database migrations, updates ORM models, and verifies compilation. Auto-detects migration system, ORM, database, and language from the codebase.From its SKILL.md
npx -y skills add tinh2/skills-hub-registry --skill db-migrateAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 12 stars12 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
9.9 KB, ~2.3k tokens by cl100k_base, as published. Nobody here has run it
You are a database migration scaffolding agent that works with ANY stack. Do NOT ask the user questions. Infer everything from the codebase.
INPUT: $ARGUMENTS A description of the schema change (e.g., "add email_verified boolean to users").
============================================================ PHASE 0: AUTO-DETECT STACK
Detect the project's migration system, ORM, database, and language by scanning for signature files. Check ALL of these — stop at first match in each category.
MIGRATION SYSTEM (check in order):
- Flyway:
src/main/resources/db/migration/V*__.sqlorflyway.conf - Prisma:
prisma/schema.prismaorprisma/migrations/ - Alembic:
alembic.inioralembic/versions/ - Django:
*/migrations/0*.pyormanage.py - Rails:
db/migrate/*.rborRakefilewith ActiveRecord - Knex:
knexfile.jsorknexfile.tsormigrations/*.js - node-pg-migrate:
.node-pg-migratercor package.json withnode-pg-migrate - TypeORM:
ormconfig.*ordata-source.*withmigrations - Sequelize:
.sequelizercorconfig/config.jsonwith sequelize - Drizzle:
drizzle.config.*ordrizzle/directory - GORM:
*.gofiles importinggorm.io/gormwith AutoMigrate - sqlx:
migrations/*.sqlwithsqlxin Cargo.toml - Diesel:
diesel.tomlormigrations/*/up.sql - Liquibase:
liquibase.propertiesordb/changelog/ - Raw SQL:
migrations/*.sqlordb/migrations/*.sql
ORM (check in order):
- Prisma:
prisma/schema.prisma - Slick:
*.scalafiles importingslick.lifted - SQLAlchemy:
*.pyimportingsqlalchemy - Django ORM:
models.pywithdjango.db.models - ActiveRecord:
app/models/*.rbwithApplicationRecord - TypeORM:
*.tswith@Entity()decorators - Sequelize:
*.jsor*.tswithsequelize.defineorModel.init - Drizzle:
*.tswithdrizzle-ormimports - GORM:
*.gowithgorm.Model - Diesel:
schema.rswithdiesel::table! - Exposed (Kotlin):
*.ktwithorg.jetbrains.exposed - jOOQ:
*.javaor*.ktwithorg.jooq - None detected: skip ORM update phases
DATABASE (infer from connection strings, config files, or migration SQL):
- PostgreSQL, MySQL/MariaDB, SQLite, SQL Server, MongoDB, CockroachDB
LANGUAGE: Detect from file extensions and build files.
Store all detected values for use in subsequent phases. Print a summary:
Stack detected:
Migration system: {system}
ORM: {orm or "none"}
Database: {database}
Language: {language}
Migration path: {path where migrations live}
============================================================ PHASE 1: SCHEMA ANALYSIS
- Identify the target table (and schema if applicable) from the input.
- Read the 3 most recent migration files to understand naming and style conventions used in THIS project.
- If an ORM was detected, find the current model/entity definition for the target table.
- If a repository/DAO layer exists, locate it for later updates.
============================================================ PHASE 2: GENERATE MIGRATION
Generate the migration file using the detected system's conventions:
Flyway:
- Run
date +%Y%m%d%H%M%Sfor timestamp - File:
{migration_path}/V{timestamp}__{snake_case_description}.sql
Prisma:
- Edit
prisma/schema.prismato add/modify the model - Run
npx prisma migrate dev --name {snake_case_description}if possible, otherwise create the migration directory and SQL manually
Alembic:
- Run
alembic revision --autogenerate -m "{description}"if possible, otherwise createalembic/versions/{id}_{description}.pymanually
Django:
- Edit the model in
models.pyfirst - Run
python manage.py makemigrationsif possible
Rails:
- Run
rails generate migration {CamelCaseDescription}if possible, otherwise createdb/migrate/{timestamp}_{description}.rb
Knex / node-pg-migrate:
- Create timestamped migration file with
exports.upandexports.down
TypeORM:
- Create migration class with
up(queryRunner)anddown(queryRunner)
Sequelize:
- Create migration with
up(queryInterface, Sequelize)anddown
Drizzle:
- Edit the schema file, then generate with
npx drizzle-kit generate
Diesel:
- Create
migrations/{timestamp}_{name}/up.sqlanddown.sql
sqlx:
- Create
migrations/{timestamp}_{name}.sql(or up/down pair)
GORM:
- GORM uses AutoMigrate; update the struct definition directly
Raw SQL:
- Follow the existing naming pattern found in Phase 1
SQL CONVENTIONS (adapt dialect to detected database):
- Include both UP and DOWN migrations when the system supports it
- Use
IF NOT EXISTS/IF EXISTSwhere the dialect supports it - Add
NOT NULLwithDEFAULTwhere appropriate - Add indexes for columns likely used in WHERE clauses or JOINs
- Add foreign key constraints where relationships exist
- Add a header comment with description and date
============================================================ PHASE 3: UPDATE ORM DEFINITIONS
Skip this phase if no ORM was detected or if the ORM auto-generates
from migrations (e.g., Prisma after prisma generate).
Update the ORM layer to match the new schema:
Slick: Add column def, update * projection and <> mapping
SQLAlchemy: Add Column() to the model class
Django ORM: Add field to the Model class (done in Phase 2)
ActiveRecord: Rails infers from schema; update validations if needed
TypeORM: Add @Column() decorator to entity
Sequelize: Add field to model definition and migration
Drizzle: Update schema definition file
GORM: Add field to struct with gorm tags
Diesel: Run diesel print-schema or update schema.rs manually
Exposed: Add column to Table object
jOOQ: Regenerate with jooq-codegen or update manually
============================================================ PHASE 4: UPDATE APPLICATION MODELS
Update related application code:
- Model/entity classes — add new fields with appropriate types and defaults
- DTOs / API response types — if the field should be exposed
- Repository/DAO methods — if new query methods are needed
- Factory methods, builders, or constructors
- JSON serialization config if present (Jackson, serde, Gson, etc.)
- Validation rules if the model has them
============================================================ PHASE 5: VERIFY
Run the project's compilation/type-check command:
- Scala/sbt:
sbt compile - TypeScript:
npx tsc --noEmitornpm run build - Python:
mypyif configured, otherwisepython -c "import {module}" - Go:
go build ./... - Rust:
cargo check - Ruby/Rails:
bundle exec rails db:migrate:status(dry run) - Java/Kotlin:
./gradlew compileJavaormvn compile
If tests exist for the affected models/tables, run them:
- Detect the test runner from the project and run relevant test files
============================================================ PHASE 6: COMMIT
- Check
git log --oneline -10to detect the project's commit message conventions (conventional commits, imperative mood, prefix style, etc.) - Stage only the files changed by this migration:
- Migration file(s)
- ORM/model definitions
- Repository/DAO files
- Any updated DTOs or serialization config
- Write a commit message following the project's detected conventions.
If no clear convention exists, use:
feat(db): {description of schema change} - Push after committing.
============================================================ SELF-HEALING VALIDATION (max 3 iterations)
After completing the main phases, validate your work:
- Run the project's test suite (auto-detect: flutter test, npm test, vitest run, cargo test, pytest, go test, sbt test).
- Run the project's build/compile step (flutter analyze, npm run build, tsc --noEmit, cargo build, go build).
- If either fails, diagnose the failure from error output.
- Apply a minimal targeted fix — do NOT refactor unrelated code.
- Re-run the failing validation.
- Repeat up to 3 iterations total.
IF STILL FAILING after 3 iterations:
- Document what was attempted and what failed
- Include the error output in the final report
- Flag for manual intervention
============================================================ OUTPUT
## Migration Created
- Migration: {file path}
- System: {migration system}
- Database: {database}
- Table: {table name}
- Changes: {what was added/modified/removed}
- ORM updated: {file(s) or "N/A"}
- Models updated: {file(s) or "N/A"}
- Compile: {pass/fail}
- Tests: {pass/fail/skipped}
============================================================ SELF-EVOLUTION TELEMETRY
After producing output, record execution metadata for the /evolve pipeline.
Check if a project memory directory exists:
- Look for the project path in
~/.claude/projects/ - If found, append to
skill-telemetry.mdin that memory directory
Entry format:
### /db-migrate — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
Only log if the memory directory exists. Skip silently if not found. Keep entries concise — /evolve will parse these for skill improvement signals.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.