safe-migrations

safe-migrations is a skill for Claude Code from PrabhdeepSingh/claude-plugins. It costs 100 tokens per session (2,251 once invoked), scanned A, original, MIT.

A method for changing database structure and data safely while old and new versions of an application run together. It uses three stages: add the new structure, move or copy data, then remove the old structure.

In plain words
What is it for?
It helps plan and review database migrations, data backfills, column or index changes, enum updates, and constraint changes without requiring a single risky release.
Why use it?
It prevents rolling deployments and rollbacks from breaking when application versions expect different database columns, indexes, values, or rules.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the sonu plugin — 26 skills, 3 commands shipped together

Good fit It helps plan and review database migrations, data backfills, column or index…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/prabhdeepsingh/claude-plugins/safe-migrations
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 PrabhdeepSingh/claude-plugins --skill safe-migrations
Clone the repo
git clone --depth 1 https://github.com/PrabhdeepSingh/claude-plugins

Made for: Claude Code.

Or install sonu, the plugin that ships this one along with the rest of its 26 skills, 3 commands.

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 safe-migrations

README.md
[![agentmods](https://agentmods.dev/badge/skills/prabhdeepsingh/claude-plugins/safe-migrations.svg)](https://agentmods.dev/skills/prabhdeepsingh/claude-plugins/safe-migrations)
Your own site
<a href="https://agentmods.dev/skills/prabhdeepsingh/claude-plugins/safe-migrations"><img src="https://agentmods.dev/badge/skills/prabhdeepsingh/claude-plugins/safe-migrations.svg" alt="Measured on agentmods" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,251 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.00100 $0.02251
Opus 5 $0.00050 $0.01125
Sonnet 5 $0.00020 $0.00450
Haiku 4.5 $0.00010 $0.00225

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

Security

Grade A, and why

safe-migrations 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 6d 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.

sonu/skills/safe-migrations/SKILL.md · 116 lines

How it starts

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

Safe migrations — the schema change and the safe path to it are different artifacts

The single most expensive junior mistake in backend work: writing the migration for the final state instead of the safe path to it. ALTER TABLE users RENAME COLUMN email TO email_address looks correct — and it is correct, for a world where the deploy is instantaneous. Real deploys are rolling: for minutes (or hours, or days if the deploy fails), old code and new schema run against each other. The rename ships, old pods still SELECT email, and production is down before the deploy finishes. Every rule below exists because the database outlives and overlaps every version of the code that touches it.

How to apply this

Before writing any migration, answer one question: "will the previous release's code still work against the schema this migration produces?" If no, the migration must be split into stages. Then walk the change through the expand → migrate → contract sequence, and run the self-check before shipping.


1. The core law: every migration is compatible one release in each direction

During a rolling deploy, blue/green switch, or a failed-deploy rollback, the schema meets both the old and the new code. So:

  • The schema after the migration must work with the previous release's code (deploy in progress, or rolled back).
  • The current code must work with the pre-migration schema only if your platform runs code before migrations — know your ordering; most run migrations first.

This is the invariant everything else derives from. A migration that requires the new code to already be everywhere is a migration that requires downtime — and nobody scheduled any.

2. Expand → migrate → contract

Any breaking change (rename, drop, type change, moving data) decomposes into three phases across separate releases:

  1. Expand — add the new thing alongside the old: a new nullable column, a new table, a new index. Purely additive; old code doesn't notice.
  2. Migrate — teach the code to write to both old and new (dual-write), backfill existing rows (section 4), then switch reads to the new location. Each of these can be its own deploy; each is individually reversible.
  3. Contract — only after a full release cycle where nothing reads or writes the old location: drop it. The drop ships alone, in a release that changes nothing else about that data.

Read the full file on GitHub · 116 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. 6d ago First seen · 116 lines · 100 tokens per session scan A 8f8759eea3cc

Subscribe to this mod's changes

safe-migrations is a skill published in the GitHub repository PrabhdeepSingh/claude-plugins (3 stars, last pushed today), licensed MIT. It adds 100 tokens to every session and 2,251 once invoked, about $0.0005 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

java-cache

Use when the user asks to add caching, configure Redis or Caffeine cache, use @Cacheable/@CacheEvict/@CachePut, optimize repeated database or API calls, or review existing Spring Boot cache configuration.

ducpm2303/claude-java-plugins · 46 tokens

java-jpa

Reviews Spring Data JPA for N+1 queries, fetch strategies, projections, and Specifications. Use when user asks to "review JPA", "check for N+1", "JPA performance", "review my entities", "check fetch strategy", or "review my repositories".

ducpm2303/claude-java-plugins · 57 tokens

ddia-systems

Design data systems by understanding storage engines, replication, partitioning, transactions, and consistency models. Use when the user mentions "database choice", "which database should I use", "SQL or NoSQL", "replication lag", "partitioning strategy", "consistency vs availability", "stream processing", "ACID…

wondelai/skills · 138 tokens

symfony:doctrine-events

React to Doctrine entity lifecycle in Symfony with attribute listeners (#[AsDoctrineListener]/#[AsEntityListener], ORM 3) and lifecycle callbacks.

dev-toolings/superpowers-symfony · 35 tokens

symfony:doctrine-batch-processing

Process large datasets with Doctrine (ORM 3 toIterable, flush+clear, bulk DQL) and memory management.

dev-toolings/superpowers-symfony · 32 tokens

symfony:doctrine-fetch-modes

Optimize Doctrine fetching with DTO hydration (SELECT NEW; partial removed in ORM 3), lazy loading, query hints, and DBAL 4 access.

dev-toolings/superpowers-symfony · 38 tokens