safe-migrations

safe-migrations is a skill for Claude Code from slbug/claude-ruby-grape-rails. It costs 55 tokens per session (2,026 once invoked), scanned A, original, MIT.

A guide for making Rails database migrations safer during deployments. It covers large-table changes, gradual schema updates, batched data backfills, and differences between Active Record and Sequel migrations.

In plain words
What is it for?
Use it to plan column or table changes, index creation, renames, type changes, NOT NULL constraints, backfills, and multi-step releases.
Why use it?
It helps reduce table locks, failed deployments, downtime, and data problems when changing a production database.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the ruby-grape-rails plugin — 52 skills, 19 agents, 17 hooks shipped together

Good fit Use it to plan column or table changes, index creation, renames, type changes, NOT NULL constraints, backfills, and multi-step releases.

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

Made for: Claude Code.

Or install ruby-grape-rails, the plugin that ships this one along with the rest of its 52 skills, 19 agents, 17 hooks.

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/slbug/claude-ruby-grape-rails/safe-migrations/github.svg)](https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/safe-migrations)
Your own site
<a href="https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/safe-migrations"><img src="https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/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/slbug/claude-ruby-grape-rails/safe-migrations"><img src="https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/safe-migrations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,026 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00055 $0.02026
Opus 5.5 $0.00022 $0.00810
Sonnet 5.5 $0.00011 $0.00405
Haiku 4.5 $0.00006 $0.00203

Measured 1mo ago against content hash 9dafb2ca9974, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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/ruby-grape-rails/skills/safe-migrations/SKILL.md · 271 lines

How it starts

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

Safe Migrations

Scope Check First

This skill is Active Record-first unless the touched package clearly uses Sequel.

Before giving migration advice, identify which migration system owns the file:

  • class ... < ActiveRecord::Migration[...] → Active Record migration
  • Sequel.migration do → Sequel migration
  • mixed repos may contain both

If the repo is modular or mixed-ORM:

  • identify the owning package first
  • do not generate Rails migration templates for Sequel packages
  • do not assume one global migration strategy for the whole repository

Iron Laws

  1. Never drop columns/tables while code references them
  2. Never add column with default on large tables (PG < 11, MySQL)
  3. Never add index non-concurrently on large tables
  4. Never change column type on large tables
  5. Never rename without multi-step process
  6. Always backfill in batches

The Three-Step Deployment Process

Deploy 1: Add new structure (nullable, no default)
Deploy 2: Update code; backfill data; switch reads
Deploy 3: Remove old structure; add constraints

Locking Behavior Note

Warnings like "locks table" are generalizations — actual locking behavior varies by database:

Database Concurrent Indexes DDL Transaction Safety Notes
PostgreSQL 11+ CONCURRENTLY supported disable_ddl_transaction! required Best for zero-downtime
PostgreSQL < 11 CONCURRENTLY supported Same as above Adding column with default locks table
MySQL 8.0+ No concurrent option pt-online-schema-change for large tables InnoDB has different locking model
MySQL 5.7 No concurrent option Use percona toolkit More locking on DDL
SQLite N/A (file-based) Locks entire database Development/test only

Always consult your database documentation for exact locking behavior. See references/database-specific.md for detailed guidance.

Safe Patterns

Adding a Column

Read the full file on GitHub · 271 lines

Files

What ships with it

4 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. 1mo ago First seen · 271 lines · 55 tokens per session scan A 9dafb2ca9974

Subscribe to this mod's changes

safe-migrations is a skill published in the GitHub repository slbug/claude-ruby-grape-rails (7 stars, last pushed 16d ago), licensed MIT. It adds 55 tokens to every session and 2,026 once invoked, about $0.0002 per session on Opus 5.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

omh-relational-db

This is an OMH relational-db workflow skill, projected for Agent Skills hosts (Claude Code, Codex, Cursor, opencode, OpenClaw, pi).

rlaope/oh-my-hermes · 100 tokens

redteam-sqli-detail-pack

Domain routing and boundary guidance for authorized SQL injection testing, including union-based, blind, error-based, stacked query, and second-order SQL injection variants. Use when a task belongs to the SQL injection domain and needs scope, evidence, pivot, or exit criteria.

Netw0rkNoob/VulnClaw · 59 tokens

api-canvas

DataCanvas primitive reference — a Tier 3 SQL/analytical workspace for tabular MCP servers, backed by DuckDB. Use when registering tables from upstream APIs, running ad-hoc SQL across them, and exporting results. Covers the acquire → register → query → export flow, per-table TTL, the token-sharing pattern for…

cyanheads/obsidian-mcp-server · 85 tokens

api-mirror

Stand up a persistent, self-refreshing local mirror of a bulk upstream dataset with the MirrorService (@cyanheads/mcp-ts-core/mirror). Use when a server wraps a large or slow API and should query a synced local index (embedded SQLite + FTS5) instead of paginating the live API per request.

cyanheads/obsidian-mcp-server · 68 tokens

data-governance

Use this skill when designing or reviewing data governance: schema ownership, PII handling, retention, lineage, access policy, and migration safety for services and data stores. Triggers: user says "data governance", "PII", "schema ownership", "retention policy", "data lineage", "migration safety".

WrongStack/WrongStack · 68 tokens

backup-recovery

Design and verify backups and restoration for owned databases, files and application state. Use when preparing recovery, migrating data or testing backups; protect the source and prove restore into an isolated destination before calling recovery ready.

WrongStack/WrongStack · 45 tokens