db-migration-helper

db-migration-helper is a skill for Claude Code, Codex from wu529778790/shenzjd-skills. It costs 32 tokens per session (1,072 once invoked), scanned A, original, MIT.

A schema-change helper that compares application models with a database structure and produces migration instructions. A database migration changes tables or columns to match a new version of an application.

In plain words
What is it for?
Use it when models change and you need migrations for MySQL, PostgreSQL, or SQLite projects using tools such as Prisma, Alembic, TypeORM, Sequelize, or Rails.
Why use it?
It helps detect differences before deployment and prepares reversible SQL or framework-specific migrations instead of relying on manual changes.

Skill for Claude CodeCodex

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

Good fit Use it when models change and you need migrations for MySQL, PostgreSQL, or SQLite projects using tools such as Prisma, Alembic, TypeORM, Sequelize, or Rails.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wu529778790/shenzjd-skills/db-migration-helper
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 wu529778790/shenzjd-skills --skill db-migration-helper
Clone the repo
git clone --depth 1 https://github.com/wu529778790/shenzjd-skills

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-migration-helper

README.md
[![agentmods](https://agentmods.dev/badge/skills/wu529778790/shenzjd-skills/db-migration-helper/github.svg)](https://agentmods.dev/skills/wu529778790/shenzjd-skills/db-migration-helper)
Your own site
<a href="https://agentmods.dev/skills/wu529778790/shenzjd-skills/db-migration-helper"><img src="https://agentmods.dev/badge/skills/wu529778790/shenzjd-skills/db-migration-helper/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-migration-helper

Your own site · 80×15
<a href="https://agentmods.dev/skills/wu529778790/shenzjd-skills/db-migration-helper"><img src="https://agentmods.dev/badge/skills/wu529778790/shenzjd-skills/db-migration-helper.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,072 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
  • Socket pass 13 Aug 2026
  • Snyk fail 13 Aug 2026
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.00032 $0.01072
Opus 5 $0.00016 $0.00536
Sonnet 5 $0.00006 $0.00214
Haiku 4.5 $0.00003 $0.00107

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

Security

Grade A, and why

db-migration-helper 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 12d 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.

db-migration-helper/SKILL.md · 115 lines

How it starts

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

DB Migration Helper

分析 model 变更,生成安全的数据库迁移 SQL。

Overview

对比代码中的实体/模型定义与当前数据库 schema,检测结构变更(新增表、增删列、改类型),生成向前兼容的迁移 SQL。支持 MySQL、PostgreSQL、SQLite。

When to Use

  • User wants to create database migrations
  • User modified model/entity definitions
  • User mentions migration, schema change, or sync
  • User says "生成迁移" / "create migration"
  • User inputs /db-migration-helper

When NOT to Use:

  • User only wants to view database structure
  • User wants data migration (not schema)
  • User uses ORM auto-migration
  • User wants to generate seed data
  • User wants to backup/restore database

Core Pattern

Step 1: 检测项目类型和 ORM

检测文件 ORM/框架 迁移方式
prisma/schema.prisma Prisma 生成 SQL diff
alembic/ SQLAlchemy + Alembic 生成 Alembic migration
migrations/ 通用 扫描已有迁移推断
*.entity.ts / *.model.ts TypeORM / Sequelize 从装饰器提取
schema.rb / db/migrate/ Rails Rails migration

Step 2: 提取当前 Schema

# Prisma (v2.18+,旧命令 introspect 已更名为 db pull,统一用 db pull)
npx prisma db pull 2>/dev/null

# 通用 — 从代码提取
grep -r "CREATE TABLE\|@Entity\|@Table\|model " --include="*.ts" --include="*.py" --include="*.go" -l

提取:

  • 表名和列定义
  • 列类型、约束(NOT NULL、DEFAULT、UNIQUE)
  • 索引和外键

Step 3: 对比变更

对比代码中的 model 定义与已有 schema(或上一次迁移),检测:

变更类型 风险等级 说明
新增表 直接 CREATE TABLE
新增列(有 DEFAULT) ALTER TABLE ADD COLUMN
新增列(无 DEFAULT) 需要处理已有数据
删除列 可能丢失数据,需要确认
修改列类型 可能不兼容
新增索引 CREATE INDEX
删除索引 DROP INDEX

Step 4: 生成迁移文件

使用 templates/migration.sql 模板,生成:

  1. Up 迁移 — 正向变更 SQL
  2. Down 回滚 — 反向回滚 SQL
  3. 风险评估 — 标注高风险操作
-- Migration: 20260603_add_user_avatar
-- Risk: LOW

-- Up
ALTER TABLE users ADD COLUMN avatar_url VARCHAR(500);
CREATE INDEX idx_users_email ON users(email);

-- Down
DROP INDEX idx_users_email;
ALTER TABLE users DROP COLUMN avatar_url;

Quick Reference

/db-migration-helper                    # 检测变更,生成迁移
/db-migration-helper --dry-run          # 只预览 SQL 不执行
/db-migration-helper --name add_user    # 指定迁移名称

Read the full file on GitHub · 115 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 12d ago First seen · 115 lines · 32 tokens per session scan A a708a2b31505

Subscribe to this mod's changes

db-migration-helper is a skill published in the GitHub repository wu529778790/shenzjd-skills (0 stars, last pushed 4d ago), licensed MIT. It adds 32 tokens to every session and 1,072 once invoked, about $0.0002 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-31.