database-migrations

database-migrations is a skill for Claude Code, Codex from vanara-agents/skills. It costs 62 tokens per session (1,840 once invoked), scanned A, original, Apache-2.0.

A guide to changing a live database's tables and columns safely while an application is still running. It explains backward-compatible changes, gradual data updates, and reversible steps.

In plain words
What is it for?
Use it when adding or changing database fields, moving existing data, creating indexes, enforcing required values, or planning a large rename or type change.
Why use it?
It helps avoid downtime, blocked requests, broken older application versions, and migrations that are difficult to undo.

Skill for Claude CodeCodex

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

Good fit Use it when adding or changing database fields, moving existing data, creating indexes, enforcing required values, or planning a large rename or type change.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/vanara-agents/skills/database-migrations/github.svg)](https://agentmods.dev/skills/vanara-agents/skills/database-migrations)
Your own site
<a href="https://agentmods.dev/skills/vanara-agents/skills/database-migrations"><img src="https://agentmods.dev/badge/skills/vanara-agents/skills/database-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 database-migrations

Your own site · 80×15
<a href="https://agentmods.dev/skills/vanara-agents/skills/database-migrations"><img src="https://agentmods.dev/badge/skills/vanara-agents/skills/database-migrations.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,840 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.00062 $0.01840
Opus 5.5 $0.00025 $0.00736
Sonnet 5.5 $0.00012 $0.00368
Haiku 4.5 $0.00006 $0.00184

Measured 3mo ago against content hash b9be1c6e17f3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

database-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 3mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/check-migration-reversible.mjs), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/database-migrations/SKILL.md · 138 lines

How it starts

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

Database Migrations

A migration runs against live data while old code may still be serving traffic. The dangerous moment is never the steady state before or after — it's the in-between, when the schema has changed but not every app instance has. Design every change to be correct during that window. Heavy detail lives in references/; copy-paste material in examples/; a runnable safety check in scripts/.

Mental model

Two things deploy on different clocks: your schema (one atomic change) and your code (rolled out instance-by-instance over minutes). A migration is safe only if both the old and new code work against both the old and new schema for the overlap window. That single rule explains almost every practice below.

Concern Safe answer
What changed the smallest possible step
When old code sees it it must still work (backward-compatible)
Locks held none long enough to block traffic
If it goes wrong a tested, reversible path back
Big rename/retype expand → migrate → contract, across deploys

1. Additive-first

Prefer additive, backward-compatible changes. Adding a nullable column, adding a table, or adding an index never breaks code that doesn't know about it. Destructive changes (drop/rename column, change type, add NOT NULL) break the old code still running mid-deploy, so they must be sequenced — see §3.

-- SAFE: old code ignores the new column; new code can start using it.
ALTER TABLE users ADD COLUMN email_verified_at timestamptz NULL;

-- UNSAFE in one step: old code still INSERTs rows without this column.
ALTER TABLE users ADD COLUMN email_verified_at timestamptz NOT NULL;

2. Never hold a long lock

Most outages from migrations are lock waits, not data loss. A statement that rewrites a table or takes an ACCESS EXCLUSIVE lock blocks every read/write behind it, and that queue backs up into your connection pool within seconds.

  • Add columns as nullable (or with a constant default — on modern Postgres a constant default is metadata-only and does not rewrite the table; a volatile default does).
  • Build indexes with CREATE INDEX CONCURRENTLY (no table rewrite, no write lock — but it can't run inside a transaction).
  • Backfill in batches with short transactions, not one giant UPDATE that locks every row.
  • Set a lock_timeout so a migration that can't get its lock fails fast instead of stalling traffic.

Read the full file on GitHub · 138 lines

Files

What ships with it

6 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. 3mo ago First seen · 138 lines · 62 tokens per session scan A b9be1c6e17f3

Subscribe to this mod's changes

database-migrations is a skill published in the GitHub repository vanara-agents/skills (9 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 62 tokens to every session and 1,840 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-08-31.

Related

database-migrations compared with skills from other repositories

database-migrations next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
database-migrationsvanara-agents/skillsSkill93mo agoApache-2.0A62Claude Code, Codex
ecto-patternsoliver-kriska/claude-elixir-phoenixSkill5803d agoMITA51Claude Code
phoenix-contextsoliver-kriska/claude-elixir-phoenixSkill5803d agoMITA46Claude Code
ecto-n1-checkoliver-kriska/claude-elixir-phoenixSkill5803d agoMITA49Claude Code, Codex
ecto-constraint-debugoliver-kriska/claude-elixir-phoenixSkill5803d agoMITA36Claude Code
055-design-parallel-changejabrena/plinthSkill4703d agoApache-2.0A94Claude Code, Codex
313-frameworks-spring-db-migrations-flywayjabrena/plinthSkill4703d agoApache-2.0A120Claude Code, Codex