db-migration-safety

db-migration-safety is a skill for Claude Code, Codex from orlando-japan/claude-code-setting. It costs 37 tokens per session (1,095 once invoked), scanned A, original, MIT.

Guidance for changing a production database safely, including adding columns or indexes and moving existing data. It uses a staged approach: add the new structure, move the application and data, then remove the old structure.

In plain words
What is it for?
Use it before production schema changes, data backfills, or other migrations that need safe deployment and rollback planning.
Why use it?
It reduces downtime and keeps old and new application versions compatible during a rollout. Each stage can be deployed and reversed separately.

Skill for Claude CodeCodex

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

Good fit Use it before production schema changes, data backfills, or other migrations that need safe deployment and rollback planning.

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

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-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/db-migration-safety/github.svg)](https://agentmods.dev/skills/orlando-japan/claude-code-setting/db-migration-safety)
Your own site
<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.

agentmods 80×15 button for db-migration-safety

Your own site · 80×15
<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>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,095 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.
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.00037 $0.01095
Opus 5 $0.00018 $0.00548
Sonnet 5 $0.00007 $0.00219
Haiku 4.5 $0.00004 $0.00110

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

Security

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.

templates/extra/skills/db-migration-safety/SKILL.md · 111 lines

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:

  1. Expand — add the new thing, leaving the old in place.
  2. Migrate — shift reads and writes to the new thing. Backfill if needed.
  3. 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:

  1. Add the column nullable. Deploy.
  2. Backfill in batches (e.g., 1000 rows at a time with sleeps). Monitor replication lag.
  3. Change code to always write the new column.
  4. Add a NOT NULL check constraint as NOT VALID (Postgres) or equivalent.
  5. Run VALIDATE CONSTRAINT in a low-traffic window.
  6. In a later release, promote to a real NOT NULL column.

Rename a column

Almost never worth it.

If you must:

  1. Add the new column.
  2. Code writes to both old and new (dual-write).
  3. Backfill new from old.
  4. Code reads from new.
  5. Code stops writing to old.
  6. 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.

Read the full file on GitHub · 111 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. 9d ago First seen · 111 lines · 37 tokens per session scan A baa6c5986815

Subscribe to this mod's changes

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.

Related

Other skills, from other repositories

database-migration

Safe patterns for evolving database schemas in production with decision trees and troubleshooting guidance.

bobmatnyc/claude-mpm-skills · 19 tokens

Database Migration Testing

Testing database migration scripts for correctness, rollback safety, data integrity, and zero-downtime migration patterns.

PramodDutta/qaskills · 25 tokens

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…

ericrisco/rsc-harness · 90 tokens

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.

organvm-iv-taxis/a-i--skills · 56 tokens

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.

s977043/river-review · 89 tokens

Data Model & DB Design Review

Ensure data model/DB designs cover constraints, integrity, indexes, migrations, rollback, and operational impacts.

s977043/river-review · 28 tokens