agentleFS
PradnyeshpPradnyeshp/Claude-Skills/.claude/skills/db-migrate/SKILL.md

db-migrate

Skill2 starsChanged 4 months agoMITView on GitHub

Generate a database schema migration from a described change — add a table/column, alter a type, add an index or constraint — using the project's migration tool, with a safe up and down. Use when the user says "create a migration", "add a column to the database", "generate a schema migration", "alter this table", "add an index", or "migrate the database schema".

19 other projects use a version of this.

Adopted by

Most recently taken up by

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.
  • bibektimilsina00Skill

    react-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

  • bibektimilsina00Skill

    you-might-not-need-a-callback

    Analyze and fix useCallback anti-patterns in your code

    Also in 3 projects that use this

  • MicrosoftSkill

    cleanup

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 7 projects that use this

  • VercelSkill

    deploy

    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

  • SentrySkill

    commit

    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

  • +3 more from bibektimilsina00

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always include a working down/rollback, or explicitly flag and explain any irreversible step instead of faking one.

    line 30
  2. Very specific:

    Treat the target as having production data: no implicit data loss, and surface NOT-NULL/default/backfill and locking concerns.

    line 31
  3. Distinctive:

    Don't run the migration against any database unless the user explicitly asks — generate the file and give the command to apply it.

    line 32
  4. Distinctive:

    After writing, summarize the change, the up/down behavior, any data/locking risk, and the model code that must be updated to match.

    line 33

“Common” is measured: kept by at least 6 in 10 of the 14 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Migration tooling signals

!ls -d migrations db/migrate prisma alembic.ini knexfile.* 2>/dev/null

!grep -rilE "knex|prisma|sequelize|typeorm|alembic|flyway|liquibase|django|ActiveRecord|migrate" package.json pyproject.toml Gemfile 2>/dev/null | head

Instructions

Generate a database migration for the change described in $ARGUMENTS. If the change is ambiguous (which table, nullability, default, type), ask before generating — a wrong migration against a real database is costly to undo.

Method

  1. Detect the migration tool and convention. From the signals above, identify the framework (Prisma, Knex, TypeORM, Sequelize, Alembic, Django, Rails/ActiveRecord, Flyway, Liquibase) and read an existing migration to match its file naming, timestamp/sequence format, and style. Prefer the tool's own generator (prisma migrate dev, alembic revision, rails g migration, knex migrate:make) so the file lands correctly — show the command.
  2. Read the current schema for the affected table(s) so the change is consistent with existing columns, types, and constraints. Don't guess the current shape.
  3. Write both directions. Provide a correct up and a real down that exactly reverses it (drop the column/table/index you added). If a change is genuinely irreversible (dropping a column with data), say so explicitly rather than writing a lossy down silently.
  4. Make it safe to run on a populated table. Adding a NOT NULL column needs a default or a backfill-then-constrain sequence; renaming/dropping needs a thought-out path. Call out locking/downtime risks on large tables (e.g. index creation) and prefer concurrent/online variants where the database supports them.
  5. Keep code models in sync. Note (or update, if the project co-locates them) the ORM model/entity/type that must change to match — a migration that drifts from the model breaks the app.

Rules

  1. Generate against the real current schema and the project's actual tool — never hand-write a migration in a format the project doesn't use.
  2. Always include a working down/rollback, or explicitly flag and explain any irreversible step instead of faking one.
  3. Treat the target as having production data: no implicit data loss, and surface NOT-NULL/default/backfill and locking concerns.
  4. Don't run the migration against any database unless the user explicitly asks — generate the file and give the command to apply it.
  5. After writing, summarize the change, the up/down behavior, any data/locking risk, and the model code that must be updated to match.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.