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.
npx skills add orlando-japan/claude-code-setting --skill db-migration-safetygit clone --depth 1 https://github.com/orlando-japan/claude-code-settingWrote 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.
[](https://agentmods.dev/skills/orlando-japan/claude-code-setting/db-migration-safety)<a href="https://agentmods.dev/skills/orlando-japan/claude-code-setting/db-migration-safety"><img src="https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/db-migration-safety/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.
<a href="https://agentmods.dev/skills/orlando-japan/claude-code-setting/db-migration-safety"><img src="https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/db-migration-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00037 | $0.01095 |
| Opus 5 | $0.00018 | $0.00548 |
| Sonnet 5 | $0.00007 | $0.00219 |
| Haiku 4.5 | $0.00004 | $0.00110 |
Grade A, and why
db-migration-safety 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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 111 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database migration safety
Every production database migration follows one rule: the old code and the new code must both work against both the old and the new schema, at every point in the rollout.
If that's not true, you're betting on deploy atomicity. Deploy atomicity doesn't exist.
The three-step pattern
For any non-trivial change:
- Expand — add the new thing, leaving the old in place.
- Migrate — shift reads and writes to the new thing. Backfill if needed.
- Contract — once nothing uses the old, remove it.
Each step ships as its own deploy. Each is independently reversible. Never combine expand and contract in one release.
Change cookbook
Add a nullable column
- Safe. One step. Deploy.
Add a NOT NULL column with a default
Dangerous on large tables — a naive ALTER TABLE ... NOT NULL DEFAULT x rewrites the table.
Safe version:
- Add the column nullable. Deploy.
- Backfill in batches (e.g., 1000 rows at a time with sleeps). Monitor replication lag.
- Change code to always write the new column.
- Add a
NOT NULLcheck constraint asNOT VALID(Postgres) or equivalent. - Run
VALIDATE CONSTRAINTin a low-traffic window. - In a later release, promote to a real
NOT NULLcolumn.
Rename a column
Almost never worth it.
If you must:
- Add the new column.
- Code writes to both old and new (dual-write).
- Backfill new from old.
- Code reads from new.
- Code stops writing to old.
- Much later, drop old.
Six deploys for a rename. Usually the new name isn't worth it. Consider a view as an alias.
Change a column type
Same as rename: add the new column, dual-write, backfill, switch reads, drop old.
For type widening (VARCHAR(50) → VARCHAR(200)), some databases support it in place. Check your specific DB.
Add an index
- Postgres:
CREATE INDEX CONCURRENTLY. Never the non-concurrent form in production. - MySQL:
ALGORITHM=INPLACE, LOCK=NONE(version-dependent — check). - Large indexes: schedule off-peak, monitor replication lag.
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.
- 9d ago First seen · 111 lines · 37 tokens per session scan A baa6c5986815
db-migration-safety is a skill published in the GitHub repository orlando-japan/claude-code-setting (2 stars, last pushed 3mo ago), licensed MIT. It adds 37 tokens to every session and 1,095 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.
Other skills, from other repositories
database-migration
Safe patterns for evolving database schemas in production with decision trees and troubleshooting guidance.
Database Migration Testing
Testing database migration scripts for correctness, rollback safety, data integrity, and zero-downtime migration patterns.
db-migrations
Use when a schema change must ship without downtime — NOT NULL, rename, type change, or backfilling millions of live rows — for the expand-contract sequence and the lock/batching discipline that keeps each step from freezing prod. NOT lock internals or EXPLAIN (that is postgresdb), NOT drizzle-kit mechanics (that is…
database-migration-patterns
Manage database schema changes safely with migration tools, zero-downtime strategies, and rollback procedures. Covers Alembic, SQL migrations, data migrations, and testing strategies. Triggers on database migration, schema changes, or Alembic configuration requests.
Migration Safety Review (framework-agnostic)
A framework-independent review guide for database and data migrations. A migration is a controlled change to database structure or existing data, such as adding, changing, or removing a column.
Data Model & DB Design Review
Ensure data model/DB designs cover constraints, integrity, indexes, migrations, rollback, and operational impacts.