safe-migrations

safe-migrations is a skill for Claude Code from sigistry/marketplace. It costs 98 tokens per session (888 once invoked), scanned A, original, MIT.

A guide for changing a live database schema safely with minimal downtime. Its expand-contract method adds new structures, moves data in batches, and removes old structures later.

In plain words
What is it for?
Use it to plan safe column, index, constraint, rename, and type changes with independently reversible deployment steps.
Why use it?
It helps avoid long database locks, table rewrites, and risky one-step changes while the application is running.

Skill for Claude Code

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

Part of the sql-safety-net plugin — 3 skills, 5 commands, 2 agents shipped together

Good fit Use it to plan safe column, index, constraint, rename, and type changes with independently reversible deployment steps.

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

Made for: Claude Code.

Or install sql-safety-net, the plugin that ships this one along with the rest of its 3 skills, 5 commands, 2 agents.

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/sigistry/marketplace/safe-migrations/github.svg)](https://agentmods.dev/skills/sigistry/marketplace/safe-migrations)
Your own site
<a href="https://agentmods.dev/skills/sigistry/marketplace/safe-migrations"><img src="https://agentmods.dev/badge/skills/sigistry/marketplace/safe-migrations/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 safe-migrations

Your own site · 80×15
<a href="https://agentmods.dev/skills/sigistry/marketplace/safe-migrations"><img src="https://agentmods.dev/badge/skills/sigistry/marketplace/safe-migrations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 888 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.00098 $0.00888
Opus 5 $0.00049 $0.00444
Sonnet 5 $0.00020 $0.00178
Haiku 4.5 $0.00010 $0.00089

Measured 7d ago against content hash 6b398df31b22, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 7d 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.

plugins/sql-safety-net/skills/safe-migrations/SKILL.md · 45 lines

How it starts

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

Safe Migrations

Purpose

Provide a standardized, static methodology for turning a hazardous schema migration into a safe, reversible, zero-downtime change, without a database connection. The core idea: most outages come from a DDL statement that takes a long-held ACCESS EXCLUSIVE (Postgres) or table-copy (MySQL) lock and blocks all traffic while it rewrites the table. The fix is almost always the same shape, so this skill encodes it once.

The Expand-Contract (Parallel-Change) Principle

Never change a schema object in place while the app runs. Instead, evolve in additive steps so old and new code both work at every moment:

  1. Expand: add the new structure (nullable column, new index built concurrently, NOT VALID constraint) without touching existing behavior.
  2. Migrate: backfill data in bounded batches; dual-write from the app so old and new stay consistent.
  3. Contract: once all deploys read the new structure, remove the old one in a later deploy.

Each step is independently deployable and reversible. A rename or type change is never one migration, it is a sequence spanning multiple deploys.

The Golden Rules

  • Add columns nullable; never NOT NULL DEFAULT <volatile> in one shot on a large table.
  • Build indexes concurrently (Postgres) or in place, lock-free (MySQL); otherwise use an online-DDL tool.
  • Add constraints as NOT VALID first, then VALIDATE in a separate statement (short lock, then a scan that does not block writes).
  • Backfill in batches with a bound and a throttle, never one unbounded UPDATE.
  • Set lock_timeout so a migration that cannot acquire its lock fails fast instead of queuing behind long transactions and blocking everything behind it.
  • Every migration ships a working DOWN; splits ship in the correct order.

Quick Hazard Reference

Operation Postgres lock Safe alternative
ADD COLUMN (nullable, no default) Brief ACCESS EXCLUSIVE, metadata-only Safe as-is
ADD COLUMN NOT NULL DEFAULT <volatile> Full rewrite under ACCESS EXCLUSIVE Nullable add → backfill → NOT VALID check → validate
CREATE INDEX SHARE (blocks writes) CREATE INDEX CONCURRENTLY
ALTER COLUMN TYPE Full rewrite under ACCESS EXCLUSIVE New column → dual-write → backfill → swap
ADD FOREIGN KEY SHARE ROW EXCLUSIVE, scans child ... NOT VALID then VALIDATE CONSTRAINT
SET NOT NULL ACCESS EXCLUSIVE + full scan Backing CHECK ... NOT VALID + validate, then set
Rename / drop column ACCESS EXCLUSIVE + breaks old code Multi-deploy expand-contract

Read the full file on GitHub · 45 lines

Files

What ships with it

3 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. 7d ago First seen · 45 lines · 98 tokens per session scan A 6b398df31b22

Subscribe to this mod's changes

safe-migrations is a skill published in the GitHub repository sigistry/marketplace (3 stars, last pushed today), licensed MIT. It adds 98 tokens to every session and 888 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-09-03.

Related

Other skills, from other repositories

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

safe-migrations

Zero-downtime schema and data migration discipline — expand → migrate → contract, never destructive in the release that ships the code, backfills as jobs, every step reversible. INVOKE PROACTIVELY when creating or editing a migration in any framework, writing ALTER TABLE / index / enum / constraint changes, planning a…

PrabhdeepSingh/claude-plugins · 100 tokens

elasticsearch

Interact with Elasticsearch and Kibana via REST API using curl. Use when querying, indexing, managing indices, checking cluster health, writing aggregations, deploying dashboards, or troubleshooting Elasticsearch. Requires cluster URL and API key. Covers: search (Query DSL), CRUD operations, index management…

NikiforovAll/claude-code-rules · 97 tokens

docker-dev-environment

Use when setting up local development services or running the project locally. Establishes the "stateful services in Docker, app runs native" pattern with Postgres, Redis, MinIO, and Mailpit.

martian56/claude-engineer · 46 tokens

top-design

Create award-winning, immersive web experiences at the level of Awwwards-featured agencies. Use when the user mentions "Awwwards quality", "make my site stunning", "scroll animations", "parallax storytelling", "cinematic web design", "portfolio site", or "brand experience". Also trigger when elevating a standard…

wondelai/skills · 113 tokens

traction-eos

Implement the Entrepreneurial Operating System (EOS) to align vision and execution across a company. Use when the user mentions "EOS", "Entrepreneurial Operating System", "V/TO", "quarterly rocks", "Level 10 meetings", "accountability chart", "IDS process", "my company feels chaotic", "we keep having the same…

wondelai/skills · 147 tokens