db-migrator

db-migrator is a skill for Claude Code, Codex from laolaoshiren/claude-code-skills-zh. It costs 19 tokens per session (1,086 once invoked), scanned A, original, MIT.

A database change helper that compares the code-defined database structure with its migration history and creates scripts for updating it. A database migration is a controlled change to tables, fields, indexes, or relationships.

In plain words
What is it for?
Use it when adding, changing, or removing database tables and fields. It identifies Alembic, Prisma, Flyway, Django, or Rails projects and generates the matching migration and rollback files.
Why use it?
It reduces the risk of manually writing incomplete database changes or forgetting how to undo them. It also points out concerns such as locking large tables, moving existing data, and compatibility with older application versions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding, changing, or removing database tables and fields. It identifies Alembic, Prisma, Flyway, Django, or Rails projects and generates the matching migration and rollback files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laolaoshiren/claude-code-skills-zh/db-migrator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laolaoshiren/claude-code-skills-zh --skill db-migrator
Clone the repo
git clone --depth 1 https://github.com/laolaoshiren/claude-code-skills-zh

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for db-migrator

README.md
[![agentmods](https://agentmods.dev/badge/skills/laolaoshiren/claude-code-skills-zh/db-migrator/github.svg)](https://agentmods.dev/skills/laolaoshiren/claude-code-skills-zh/db-migrator)
Your own site
<a href="https://agentmods.dev/skills/laolaoshiren/claude-code-skills-zh/db-migrator"><img src="https://agentmods.dev/badge/skills/laolaoshiren/claude-code-skills-zh/db-migrator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for db-migrator

Your own site · 80×15
<a href="https://agentmods.dev/skills/laolaoshiren/claude-code-skills-zh/db-migrator"><img src="https://agentmods.dev/badge/skills/laolaoshiren/claude-code-skills-zh/db-migrator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,086 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 3 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium MCP Rug Pull · line 75
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
  • medium MCP Rug Pull · line 82
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
  • medium MCP Rug Pull · line 85
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.01086
Opus 5 $0.00010 $0.00543
Sonnet 5 $0.00004 $0.00217
Haiku 4.5 $0.00002 $0.00109

Measured 11d ago against content hash 81a40b4d2bb5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

db-migrator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/db-migrator/SKILL.md · 142 lines

How it starts

The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.

数据库迁移助手

触发条件

当用户要求数据库迁移、生成 migration、schema 变更、数据库升级时激活此技能。

工作流程

第 1 步:识别框架

扫描项目文件,判断使用的 ORM/迁移框架:

  • alembic.ini / alembic/ → Alembic
  • prisma/schema.prisma → Prisma
  • pom.xml 含 flyway → Flyway
  • manage.py + settings.py → Django
  • Gemfile + db/migrate/ → Rails

第 2 步:分析 Schema 变更

  • 对比 models 定义与现有迁移历史
  • 识别新增/修改/删除的表和字段
  • 检测索引、约束、外键变更

第 3 步:生成迁移脚本

根据框架生成对应的迁移文件,并同时生成回滚脚本。

第 4 步:风险评估

  • 大表 DDL 变更(锁表风险)
  • 数据迁移需求
  • 向后兼容性

迁移模板

Alembic (Python)

"""add email column to users

Revision ID: abc123
"""
from alembic import op
import sqlalchemy as sa

def upgrade():
    op.add_column('users', sa.Column('email', sa.String(255), nullable=True))
    op.create_index('ix_users_email', 'users', ['email'], unique=True)

def downgrade():
    op.drop_index('ix_users_email')
    op.drop_column('users', 'email')

Flyway (Java)

-- V2__add_email_to_users.sql
ALTER TABLE users ADD COLUMN email VARCHAR(255);
CREATE UNIQUE INDEX ix_users_email ON users(email);

-- 回滚脚本 (单独文件 U2__rollback_add_email.sql)
-- 逆向操作

Prisma (Node.js)

// schema.prisma 变更
model User {
  id    Int     @id @default(autoincrement())
  name  String
  email String? @unique  // 新增字段
}
# 默认仅生成迁移,不执行数据库变更
npx prisma migrate dev --name add-email-to-users --create-only

检查生成的 SQL、连接目标和备份后,再由用户确认执行:

# 开发环境应用迁移
npx prisma migrate dev

# 生产环境应用已审核并提交的迁移
npx prisma migrate deploy

Django (Python)

# users/migrations/0002_add_email.py
from django.db import migrations, models

class Migration(migrations.Migration):
    dependencies = [('users', '0001_initial')]

    operations = [
        migrations.AddField(
            model_name='user',
            name='email',
            field=models.EmailField(unique=True, null=True),
        ),
    ]

unique=True 已由 Django 生成唯一约束和对应索引,不要再创建重复索引。

Rails (Ruby)

# db/migrate/20260617_add_email_to_users.rb
class AddEmailToUsers < ActiveRecord::Migration[7.0]
  def change
    add_column :users, :email, :string
    add_index :users, :email, unique: true
  end
end
rails db:migrate         # 执行迁移
rails db:rollback        # 回滚上一次
rails db:rollback STEP=3 # 回滚最近 3 次

Read the full file on GitHub · 142 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 142 lines · 19 tokens per session scan A 81a40b4d2bb5

Subscribe to this mod's changes

db-migrator is a skill published in the GitHub repository laolaoshiren/claude-code-skills-zh (832 stars, last pushed yesterday), licensed MIT. It adds 19 tokens to every session and 1,086 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

cnpg

Create and operate CloudNativePG (CNPG) Postgres databases on Kubernetes the GitOps/Flux way - on managed cloud (GKE + GCS via Workload Identity) OR self-hosted (K3s/bare-metal + any S3-compatible store via a credentials secret). Covers Cluster + ScheduledBackup manifests, barman WAL archiving, pgvector, PITR…

vanducng/skills · 155 tokens

miudb

Query, inspect, and manage saved database connections through the Go miudb CLI. Use when the user asks to run SQL, list schemas, add native connections, smoke-test connections, inspect tunnel-backed databases, or produce agent-readable JSON from SQLite, Postgres, MySQL, Snowflake, or BigQuery.

vanducng/skills · 69 tokens

redis-patterns

Redis data structure patterns, caching strategies, distributed locks, rate limiting, pub/sub, and connection management for production applications. Use when adding caching, a distributed lock, rate limiting, or pub/sub with Redis, or when key design needs review.

userInner/SKILLS · 53 tokens

dbdesign

Design and review production database schemas, data models, ERDs, migration plans, and storage patterns. Use for OLTP schema design, OLAP/star-schema modeling, fact/dimension tables, indexes, constraints, partitioning, multi-tenant data models, CSV/JSON-to-table design, schema review, migration risk review, and…

vanducng/skills · 98 tokens

launch-tweet

Draft a launch tweet or short thread for a solo product launch on X / Twitter. Use when the user is shipping something (new product, major feature, side project) and asks for a launch post, "help me announce X", or mentions Product Hunt / Show HN / X launch.

rockscy/solo-skills · 63 tokens

postmortem-solo

Run a lightweight, blame-free postmortem after an incident, failed launch, or missed deadline — for one person. Use when the user says "that didn't go well", "the launch flopped", "we had an outage", "I missed my deadline", or wants to learn from a recent failure.

rockscy/solo-skills · 68 tokens