migration-zero-downtime

migration-zero-downtime is a skill for Claude Code, Codex from cass-2003/local-workflow-skill. It costs 163 tokens per session (3,226 once invoked), scanned A, original, MIT.

A practical guide to changing database structure while a live application keeps running. It explains how to add, change, move, and remove tables or columns in safe, compatible steps.

In plain words
What is it for?
Use it to plan zero-downtime migrations, move existing data in batches, add indexes to large tables, review migration pull requests, and prepare rollback steps.
Why use it?
It helps avoid taking the database offline, locking large tables, or breaking older and newer application versions during a deployment.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to plan zero-downtime migrations, move existing data in batches, add indexes to large tables, review migration pull requests, and prepare rollback steps.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/migration-zero-downtime
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 cass-2003/local-workflow-skill --skill migration-zero-downtime
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

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 migration-zero-downtime

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/migration-zero-downtime/github.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/migration-zero-downtime)
Your own site
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/migration-zero-downtime"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/migration-zero-downtime/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 migration-zero-downtime

Your own site · 80×15
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/migration-zero-downtime"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/migration-zero-downtime.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 163 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,226 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.00163 $0.03226
Opus 5 $0.00081 $0.01613
Sonnet 5 $0.00033 $0.00645
Haiku 4.5 $0.00016 $0.00323

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

Security

Grade A, and why

migration-zero-downtime 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.

skills/engineering-core/ours/migration-zero-downtime/SKILL.md · 313 lines

How it starts

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

Zero-Downtime Migration Skill — 零停机 schema 变更

何时使用

  • 给生产数据库加列 / 删列 / 改类型 / 加索引
  • 大表(千万 / 亿级)改 schema 想避免锁表
  • 拆库 / 合库 / 改主键
  • 评审 PR 中的 migration 是否安全
  • 部署多副本应用时新旧版本短暂共存的兼容设计

一、核心原则:Expand-Contract(扩展-收缩)

任何 schema 变更都拆成最小前向兼容步骤,应用与 schema 多版本共存

应用 v1 (旧)        应用 v2 (新)
   │                   │
   └──── 同时运行 ─────┘
   │                   │
   └──需要 schema 同时支持两个版本──┘

标准 6 步

[1] expand schema:    加新结构(向后兼容,旧 app 不受影响)
[2] backfill data:    历史数据迁移
[3] dual write:       app v2 同时写新旧(v2 部署)
[4] read switch:      app v3 改读新结构(v3 部署)
[5] stop dual write:  app v4 只写新(v4 部署)
[6] contract:         移除旧结构

每步独立部署 + 验证 + 必要时可回滚。

二、典型场景剧本

场景 1:加非空列

直接 ALTER TABLE x ADD COLUMN c TEXT NOT NULL DEFAULT 'x' —— PostgreSQL 11+ 元数据级(瞬间),但 MySQL 5.7 / 老版本会重写整表。

保险做法(任何 DB 都安全):

-- 步骤 1: 加列允许 NULL
ALTER TABLE users ADD COLUMN locale TEXT;

-- 步骤 2: backfill(分批避免长事务)
UPDATE users SET locale = 'en' WHERE locale IS NULL AND id BETWEEN 1 AND 10000;
-- ... 循环

-- 步骤 3: 应用 v2 部署:新写入填值
INSERT INTO users (..., locale) VALUES (..., 'en');

-- 步骤 4: 加 NOT NULL(验证无 NULL 后)
ALTER TABLE users ALTER COLUMN locale SET NOT NULL;

-- 步骤 5(可选): 加默认值
ALTER TABLE users ALTER COLUMN locale SET DEFAULT 'en';

场景 2:重命名列

绝对不要直接 ALTER TABLE ... RENAME COLUMN。中间窗口旧 app 找不到列直接崩。

[1] 加新列 new_name(兼容)
[2] 应用 v2: dual write — 同时写 old_name 和 new_name
[3] backfill: UPDATE ... SET new_name = old_name WHERE new_name IS NULL
[4] 应用 v3: 读 new_name(旧 fallback 读 old_name)
[5] 应用 v4: 只读写 new_name
[6] 删除 old_name

场景 3:删列

[1] 应用 v2: 不再写该列(保留读,避免 SELECT * 崩)
[2] 应用 v3: 不再读该列(彻底切断引用)
[3] 等所有版本下线(关键!)
[4] ALTER TABLE x DROP COLUMN old

SELECT * 是隐藏炸弹:删列前先把所有 SELECT * 改成显式列列表。

场景 4:改列类型

-- ❌ 直接 ALTER COLUMN TYPE 大表锁
ALTER TABLE orders ALTER COLUMN amount TYPE BIGINT;

-- ✅ 加新列
ALTER TABLE orders ADD COLUMN amount_v2 BIGINT;
-- dual write
-- backfill: UPDATE orders SET amount_v2 = amount::BIGINT;
-- 切读
-- 删旧列

Read the full file on GitHub · 313 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. 7d ago First seen · 313 lines · 163 tokens per session scan A d26ef5143df0

Subscribe to this mod's changes

migration-zero-downtime is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 163 tokens to every session and 3,226 once invoked, about $0.0008 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

create-pr

Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for prisma-next. Use when the user wants to create a pull request, open a PR, or submit changes for review.

prisma/orm · 47 tokens

schema-exploration

Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database. Use when the user asks about database schema, table structure, column types, what tables exist, ERD, foreign keys, or how entities relate.

langchain-ai/deepagents · 57 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

supabase

Supabase / PostgREST Row-Level-Security playbook — pull the anon (or leaked servicerole) key out of the frontend JS, map tables from the auto-generated OpenAPI spec, test anonymous RLS READ disclosures (PII/secret leaks), and anonymous RLS WRITE abuse (insert/update/delete — e.g. forging…

PentesterFlow/agent · 120 tokens

nornicdb-cypher-queries

Pick fast, predictable Cypher query shapes in NornicDB — point lookups, batch retrieval, pagination, search, traversal, batched UNWIND/MERGE writes, cleanup, multi-tenant isolation. Use when writing or reviewing Cypher whose latency or throughput matters; maps user intent to the executor's hot-path query templates.

orneryd/NornicDB · 79 tokens

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 229 tokens