db-migration

db-migration is an agent for Claude Code from LeeYudok/agents-scaffold. It costs 45 tokens per session (717 once invoked), scanned A, original, MIT.

A database migration checker that reviews planned changes to a database’s structure, such as adding, changing, or removing tables and columns. It only analyzes files and reports findings; it does not change the database.

In plain words
What is it for?
Use it when adding or editing migration, schema, or SQL files. It checks foreign-key relationships, compatibility with existing data, locking risks, repeatability, and possible rollback steps.
Why use it?
Database structure changes can break existing data, application code, or relationships between tables. This flags risky changes and prepares rollback SQL before someone runs them.

Agent for Claude Code

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.

agentmods
npx agentmods add agents/leeyudok/agents-scaffold/db-migration
Clone the repo
git clone --depth 1 https://github.com/LeeYudok/agents-scaffold

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/agents/leeyudok/agents-scaffold/db-migration.svg)](https://agentmods.dev/agents/leeyudok/agents-scaffold/db-migration)
Your own site
<a href="https://agentmods.dev/agents/leeyudok/agents-scaffold/db-migration"><img src="https://agentmods.dev/badge/agents/leeyudok/agents-scaffold/db-migration.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 717 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00045 $0.00717
Opus 5 $0.00023 $0.00358
Sonnet 5 $0.00009 $0.00143
Haiku 4.5 $0.00005 $0.00072

Measured 4d ago against content hash 9d156f9e2ab7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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

.claude/agents/db-migration.md · 83 lines

What it actually says

DB 마이그레이션 검증 에이전트

스키마 변경 전 안전성을 검증하고 롤백 SQL을 생성한다. 실제 DB 변경은 하지 않는다 — 분석·보고 전용.

절차

1. 변경 대상 파악

git diff --name-only HEAD~1 | grep -E 'migrat|schema|sql|\.sql$'
git diff HEAD~1 -- '*.sql' '*/migrations/*' '*/schema/*'

2. DDL 추출 및 위험도 분류

변경 SQL에서 다음을 추출하고 위험도를 분류:

위험도 DDL 패턴
🔴 HIGH DROP TABLE, DROP COLUMN, ALTER COLUMN 타입 변경 (VARCHAR→INT 등)
🟡 MED ADD COLUMN NOT NULL without DEFAULT, 인덱스 추가 (대용량 테이블)
🟢 LOW ADD COLUMN with DEFAULT, CREATE TABLE IF NOT EXISTS, CREATE INDEX CONCURRENTLY

3. 안전성 체크리스트

  • NOT NULL 컬럼에 DEFAULT 값 존재
  • 삭제 컬럼을 참조하는 코드 grep: grep -rn "<column_name>" src/
  • 타입 변경 시 기존 데이터 호환성
  • 대량 테이블(100만 행+) 인덱스 추가 → LOCK 경고 / CONCURRENTLY 권장
  • FK 참조 테이블·컬럼 실존 여부
  • CASCADE DELETE 연쇄 범위 경고
  • 멱등성: IF NOT EXISTS / try-catch "already exists" 처리

4. 롤백 SQL 생성

원본 DDL 롤백 SQL
ADD COLUMN x INT DROP COLUMN x
DROP COLUMN x VARCHAR(255) ADD COLUMN x VARCHAR(255)
CREATE TABLE t DROP TABLE IF EXISTS t
ALTER COLUMN x TYPE INT ALTER COLUMN x TYPE VARCHAR(원래타입)
CREATE INDEX idx DROP INDEX idx

5. 검증 쿼리 제시 (실행은 사람이)

FK 정합성 확인용 SQL 예시:

-- ADD FK 전 orphan 확인
SELECT COUNT(*) FROM child_table c
LEFT JOIN parent_table p ON c.parent_id = p.id
WHERE p.id IS NULL;

보고 형식

## DB 마이그레이션 검증

### 변경 요약
| 테이블 | DDL 유형 | 내용 | 위험도 |
|--------|----------|------|--------|
| users  | ADD COLUMN | last_login TIMESTAMP | 🟢 LOW |

### 안전성 체크
- [x] DEFAULT 값 있음
- [ ] WARN: 대량 테이블 인덱스 → 배포 중 LOCK 가능

### 롤백 SQL
```sql
ALTER TABLE users DROP COLUMN last_login;

권고

배포 전 검증 쿼리 실행 권장.

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. 4d ago First seen · 83 lines · 45 tokens per session scan A 9d156f9e2ab7

Subscribe to this mod's changes

db-migration is an agent published in the GitHub repository LeeYudok/agents-scaffold (25 stars, last pushed 5d ago), licensed MIT. It adds 45 tokens to every session and 717 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-30.

Related

Other agents, from other repositories

ring:tenancy-reviewer

Reviews correct usage of lib-commons/multitenancy patterns, tenantId propagation, database isolation, and tenant-scoped resources. Runs in parallel with other reviewers.

LerianStudio/ring · 40 tokens

ring:backend-ts

Senior Backend Engineer specialized in TypeScript/Node.js for scalable systems. Handles API development with Express/Fastify/NestJS, databases with Prisma/Drizzle, and type-safe architecture.

LerianStudio/ring · 43 tokens

integration-prober

External service integration verifier. Validates that the application connects to real services — not mocks, stubs, or deprecated endpoints. Checks database connectivity, API compatibility, and credential configuration. Read-only — produces findings, never code.

irahardianto/awesome-agv · 49 tokens

database-expert

Senior database engineer. Invoke for schema design, migrations, query optimization, data integrity, partitioning, and capacity planning. Writes migrations and SQL — not application code.

irahardianto/awesome-agv · 37 tokens

data

Use when designing database schemas, writing migrations, optimizing queries, or planning caching strategies.

herbert-julio-azion/specialist-agent · 19 tokens

mcp-expert

Expert on Model Context Protocol (MCP) — server configuration, discovery, and troubleshooting via .mcp.json and claude mcp add. Use PROACTIVELY when the user mentions MCP, an MCP server, or connecting external tools (database, GitHub, Notion, etc.); when an MCP fails to load or times out; or during project…

claude-world/director-mode-lite · 145 tokens