Agent skill

Managing Database Migrations

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Process use when you need to work with database migrations. An agent skill from jeremylongshore/tons-of-skills-marketplace.

MITAuto-check passedDatabases

Install Managing Database Migrations

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-migrations -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace managing-database-migrations --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/managing-database-migrations .claude/skills/managing-database-migrations && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
managing-database-migrations
GitHub stars
2.8k
Token cost
~1.7k tokens
SKILL.md length
843 words
Files
4 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Process use when you need to work with database migrations. An agent skill from jeremylongshore/tons-of-skills-marketplace.

  • Works in 10 steps: Capture the current schema state before… → Define the desired schema change… → Generate a versioned migration file… → …
  • You need to work with database migrations
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Calls pg_dump and npx

What it does

Managing Database Migrations is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database migrations. This skill provides schema migration management with comprehensive guidance and automation. Trigger with phrases like "create migration", "run migrations", or "manage schema versions".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in Databases, covering Database migrations. It works with Prisma, PostgreSQL, SQL and MySQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • You need to work with database migrations
  • With phrases like create migration
  • Manage schema versions

Example prompts

  • “create migration”
  • “run migrations”
  • “manage schema versions”
  • “/managing-database-migrations”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Capture the current schema state before making changes. Run pg_dump --schema-only -f schema_before.sql (PostgreSQL) or mysqldump --no-data…
  2. Define the desired schema change clearly: specify table name, column additions/removals/modifications, constraint changes, and index…
  3. Generate a versioned migration file following the framework's naming convention
  4. Write the UP migration (forward change) with these safety practices
  5. Write the DOWN migration (rollback) that exactly reverses the UP migration. For column additions, the DOWN drops the column. For table…
  6. Validate the migration on staging by running the full migration sequence
  7. For zero-downtime migrations on production, follow the expand-contract pattern
  8. Handle large table migrations (>10M rows) with online DDL tools: pg_repack for PostgreSQL, pt-online-schema-change for MySQL, or gh-ost…
  9. Update the migration history table and verify the migration version matches expectations. Run flyway info or alembic current to confirm.
  10. Document the migration in a changelog with: migration version, description, tables affected, estimated execution time, rollback procedure…

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(psql:*)
    • Bash(mysql:*)
    • Bash(mongosh:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/, which the agent can run.

    Shell commands in SKILL.md call:

    • pg_dump
    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • documentation.red-gate.com
    • alembic.sqlalchemy.org
    • prisma.io
    • reorg.github.io
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Managing Database Migrations loads about 1.7k tokens when it runs, and up to ~1.8k if it reads all its reference files. Until then it costs about 68 tokens; SKILL.md has 843 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 843 words, ~1,744 tokens.

Download SKILL.mdSave it as .claude/skills/managing-database-migrations/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
managing-database-migrations
description
Process use when you need to work with database migrations. This skill provides schema migration management with comprehensive guidance and automation. Trigger with phrases like "create migration", "run migrations", or "manage schema versions".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)
compatibility
Designed for Claude Code
version
1.23.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, migration, database-migrations

Database Migration Manager

Overview

Create, validate, and execute database schema migrations with full rollback support across PostgreSQL, MySQL, and MongoDB.

Prerequisites

  • Database credentials with DDL permissions (CREATE, ALTER, DROP TABLE)
  • Migration framework installed and configured (Flyway, Alembic, Prisma, Knex, or raw SQL versioning)
  • Version control for migration files (Git repository)
  • Access to a staging database matching production schema for testing migrations
  • psql or mysql CLI for executing and verifying migrations
  • Current schema baseline documented or captured via pg_dump --schema-only

Instructions

  1. Capture the current schema state before making changes. Run pg_dump --schema-only -f schema_before.sql (PostgreSQL) or mysqldump --no-data > schema_before.sql (MySQL) to create a reference point.

  2. Define the desired schema change clearly: specify table name, column additions/removals/modifications, constraint changes, and index updates. Document whether the change is additive (safe) or destructive (requires data migration).

  3. Generate a versioned migration file following the framework's naming convention:

    • Flyway: V20240115_001__add_status_column_to_orders.sql
    • Alembic: alembic revision --autogenerate -m "add status column to orders"
    • Prisma: Edit schema.prisma then npx prisma migrate dev --name add_status_to_orders
    • Knex: npx knex migrate:make add_status_to_orders
  4. Write the UP migration (forward change) with these safety practices:

    • Add new columns as nullable first, then backfill, then set NOT NULL
    • Use IF NOT EXISTS for CREATE operations to make migrations idempotent
    • Add explicit transaction wrapping: BEGIN; ... COMMIT;
    • Include comments explaining the business reason for each change
  5. Write the DOWN migration (rollback) that exactly reverses the UP migration. For column additions, the DOWN drops the column. For table renames, the DOWN renames back. For data transformations, the DOWN must restore original data (store it in a backup column or table if needed).

  6. Validate the migration on staging by running the full migration sequence:

    • Apply the UP migration and verify schema matches expectations
    • Run the application test suite against the migrated schema
    • Apply the DOWN migration and verify the schema returns to its original state
    • Re-apply the UP migration to confirm idempotency
  7. For zero-downtime migrations on production, follow the expand-contract pattern:

    • Phase 1 (expand): Add new column/table without removing old ones. Deploy application code that writes to both old and new.
    • Phase 2 (migrate): Backfill new column/table from old data in batches.
    • Phase 3 (contract): Deploy application code that reads only from new. Drop old column/table in a future migration.
  8. Handle large table migrations (>10M rows) with online DDL tools: pg_repack for PostgreSQL, pt-online-schema-change for MySQL, or gh-ost for MySQL. These tools create a shadow table, replicate changes, then swap atomically.

  9. Update the migration history table and verify the migration version matches expectations. Run flyway info or alembic current to confirm.

  10. Document the migration in a changelog with: migration version, description, tables affected, estimated execution time, rollback procedure, and any required application deployments.

Output

  • Migration files (UP and DOWN) in the target framework's format
  • Pre-flight validation script checking prerequisites before migration execution
  • Data backfill scripts for non-nullable column additions on existing tables
  • Rollback runbook with step-by-step instructions for reverting in production
  • Migration changelog entry documenting the change for team reference
Show full SKILL.md (344 more words)Show less

Error Handling

ErrorCauseSolution
Migration fails with lock timeoutLong-running queries blocking DDL locks on the target tableSet lock_timeout = '5s' to fail fast; retry during low-traffic period; use pg_repack for lock-free operations
Column cannot be dropped because of dependent viewsViews or materialized views reference the column being removedDrop or recreate dependent views first; use CASCADE only after verifying all dependents are acceptable to drop
NOT NULL constraint violation during migrationExisting rows have NULL values in a column being made NOT NULLAdd a backfill step: UPDATE table SET column = default_value WHERE column IS NULL before adding NOT NULL
Migration version conflictTwo developers created migrations with the same version numberUse timestamp-based versioning; resolve by renaming one migration and re-running
Rollback fails because data was inserted after UP migrationNew data in added columns has no place to go in the old schemaDesign rollback to handle new data (backup column, log discarded data); accept that some rollbacks are data-lossy

Examples

Adding a status enum column to an orders table: Generate a migration that: (1) creates the enum type CREATE TYPE order_status AS ENUM ('pending', 'shipped', 'delivered'), (2) adds column ALTER TABLE orders ADD COLUMN status order_status, (3) backfills UPDATE orders SET status = 'delivered' WHERE shipped_at IS NOT NULL, (4) sets NOT NULL ALTER TABLE orders ALTER COLUMN status SET NOT NULL. Rollback drops the column and enum type.

Splitting a monolith users table into users and profiles: Expand phase adds profiles table and triggers to sync data. Migrate phase copies existing profile data in batches of 10,000 rows. Contract phase drops profile columns from users table after application code is updated.

Renaming a column without downtime: Create a migration that adds the new column, adds a trigger to sync writes between old and new columns, backfills existing data, deploys application code using the new column name, then drops the old column and trigger in a follow-up migration.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts, references, assets) in skills/.curated/managing-database-migrations of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Managing Database Migrations next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Managing Database Migrations compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Managing Database Migrations this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.7kAutomated safety check: PassMIT
Database Migrations SQL Migrationsrmyndharis/antigravity-skills1.7k3 repos~577Automated safety check: NotesMIT
DB Migrationhiromaily/go-crypto-wallet128—~652Automated safety check: PassMIT
Database Migrationsaffaan-m/ECC276k3 repos~1.9kAutomated safety check: PassMIT
Database MarchatCod-e-Codes/marchat137—~985Automated safety check: PassMIT
DB Review312362115/claude107—~1.8kAutomated safety check: PassMIT

Similar skills

  • Database Migrations SQL Migrations

    rmyndharis/antigravity-skills

    SQL database migrations with zero-downtime strategies for PostgreSQL, MySQL, SQL Server

    1.7k GitHub starsUsed in 3 repos~577 tokens
    DatabasesAuto-check: notes
  • DB Migration

    hiromaily/go-crypto-wallet

    Database schema and migration workflow. An agent skill from hiromaily/go-crypto-wallet.

    128 GitHub stars~652 tokensUpdated 5 mo ago
    DatabasesAuto-check passed
  • 数据库迁移最佳实践,涵盖模式变更、数据迁移、回滚以及零停机部署,适用于PostgreSQL、MySQL及常用ORM(Prisma、Drizzle、Django、TypeORM、golang-migrate)。

    276k GitHub starsUsed in 3 repos~1.9k tokens
    DatabasesAuto-check passed
  • Database Marchat

    Cod-e-Codes/marchat

    Changes marchat SQL schema and queries across SQLite, PostgreSQL, and MySQL using dialect helpers.

    137 GitHub stars~985 tokensUpdated 7 days ago
    DatabasesAuto-check passed
  • DB Review

    312362115/claude

    数据库代码审查 + Migration 安全检查. An agent skill from 312362115/claude.

    107 GitHub stars~1.8k tokensUpdated 4 mo ago
    DatabasesAuto-check passed
  • Şema değişiklikleri, veri migration'ları, rollback'ler ve PostgreSQL, MySQL ve yaygın ORM'ler (Prisma, Drizzle, Django, TypeORM, golang-migrate) arasında sıfır kesinti deployment'ları için…

    276k GitHub starsUsed in 1 repo~2.4k tokens
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Categories

Questions about Managing Database Migrations

What does Managing Database Migrations do?

Process use when you need to work with database migrations. An agent skill from jeremylongshore/tons-of-skills-marketplace. Managing Database Migrations is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database migrations.

When should I use Managing Database Migrations?

Managing Database Migrations fits situations like: you need to work with database migrations; with phrases like create migration; manage schema versions.

How do I install Managing Database Migrations in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-migrations -a claude-code`. Or copy the skill folder (skills/.curated/managing-database-migrations in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/managing-database-migrations in your project. Claude Code loads it when a task matches its description.

How do I install Managing Database Migrations in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-migrations -a codex`. Or copy the skill folder (skills/.curated/managing-database-migrations in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/managing-database-migrations in your project. Codex loads it when a task matches its description.

Can I use Managing Database Migrations in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-migrations -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/managing-database-migrations, .gemini/skills/managing-database-migrations, .github/skills/managing-database-migrations and .opencode/skills/managing-database-migrations in your project.

What does Managing Database Migrations need to run?

Going by SKILL.md and its folder, Managing Database Migrations needs the command-line tools its instructions call (pg_dump and npx). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Managing Database Migrations access the network?

SKILL.md names 5 domains. As links in the text: documentation.red-gate.com, alembic.sqlalchemy.org, prisma.io, reorg.github.io and github.com. This is read from the text; nothing was executed.

Is Managing Database Migrations safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Managing Database Migrations use?

Managing Database Migrations is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Managing Database Migrations use?

About 1.7k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18 tokens, read only when the agent opens those files.

What are the alternatives to Managing Database Migrations?

Skills that share tags, products or a category with Managing Database Migrations: Database Migrations SQL Migrations (rmyndharis/antigravity-skills, 1.7k stars), DB Migration (hiromaily/go-crypto-wallet, 128 stars), Database Migrations (affaan-m/ECC, 276k stars) and Database Marchat (Cod-e-Codes/marchat, 137 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Managing Database Migrations?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.