/fde-data:db-change-managementfrom fde-data
Guides zero-downtime schema changes on live production databases using expand/contract patterns, lock analysis, and deploy coordination. Use before any migration on a system that must stay up.
Ships in fde-data. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Schema change against something that has to stay up.
Schema change is treated as ordinary application change and behaves nothing like it. The failure modes are different, and none of them show up in a test suite.
The characteristic incident: a migration that took forty milliseconds on a developer's laptop and eleven minutes on a forty-million-row production table, holding a lock the whole time, while every request queued behind it. The migration was correct. The test passed. The site was down.
The second characteristic incident is ordering. The application deploys before the column exists, or the old code is still running when the column is dropped. Both are avoidable by construction, and both are common because the deploy pipeline treats schema and application as one step when they are two.
Resolve <workspace> before reading or writing artifacts: use FDE_WORKSPACE if set (report an unavailable explicit path rather than falling back), otherwise the charter's recorded Location (look in .fde/ and ../*-fde/), then an existing .fde/ or ../<repo>-fde/. If none exists, run core fde-orient; do not create a second workspace. All artifact paths below use that location. Follow core workspace conventions for headers; preserve existing sections when appending.
<workspace>/traces/data-model.md or data-archaeology — you need to know the eras and the real shape<workspace>/06-blast-radius-*.md — ring 5 especially, who else reads this table00b-access.md. Do not classify the lock from staging.Staging is not production, and the difference is the whole risk.
Start with engine catalog statistics or an approved read replica for row-count and size estimates. Exact counts and distribution queries may scan a large table: agree a query budget, enforce a statement timeout, and avoid busy periods before running them on production. Read references/engine-notes.md for the detected engine; verify behavior against that engine and version's documentation before choosing an operation.
Establish: row count, table size, index count, write rate, whether it's replicated, and whether long-running transactions or reporting queries touch it. A table read by a nightly batch has a window where a migration is far cheaper.
Twelve thousand rows and forty million rows are different problems requiring different techniques. Guessing which one you have is the mistake.
This determines everything. Behavior varies by engine and version, so verify against your engine's documentation rather than assuming — but the shape is consistent:
| Operation | Usually |
|---|---|
| Add nullable column, no default | Cheap — metadata only on modern engines |
| Add column with a default | Historically a full table rewrite; cheap on recent Postgres/MySQL. Version matters enormously. |
| Add index | May block writes; online/concurrent options and their limitations are engine-specific |
| Add NOT NULL to existing column | Full scan to validate |
| Add foreign key | Scan plus lock on both tables |
| Drop column | Usually cheap, but irreversible |
| Change column type | Usually a rewrite; frequently the most expensive operation there is |
| Rename | Cheap, and breaks every reader instantly |
Metadata-only does not mean lock-free. Establish the lock mode, maximum wait, and transaction duration separately from rewrite cost. Keep DDL transactions short and enforce bounded lock and statement timeouts; a queued exclusive lock can disrupt traffic even when the operation itself is quick. Engine examples live in references/engine-notes.md.
Rename deserves its own warning: it is technically trivial and operationally severe, because it breaks all consumers at the moment it lands with no compatibility window. Use expand/contract instead.
The pattern that makes zero-downtime change possible. Never change a thing; add the new thing, migrate to it, then remove the old one — across separate deploys.
To rename amount to amount_minor:
amount_minor, nullable. Old code unaffected.amount_minor for existing rows, in batches (step 4).amount_minor. Both still written.amount, only after confirming nothing reads it.Slow, and each step is independently safe and reversible. Step 6 often waits weeks, and that's correct — the cost of leaving a dead column is nearly zero, and the cost of dropping one something still reads is an outage.
Every step must leave old and new code both working, because during a rolling deploy both are running simultaneously. That constraint is what makes the pattern work, and violating it is the most common way a "zero-downtime" migration causes downtime.
A single UPDATE over forty million rows holds a lock, blows up the transaction log, and lags replicas.
Batch it: bounded chunks by primary key, a pause between batches, resumable from where it stopped, and monitored for replication lag. It should be safe to stop and restart at any point.
Watch replica lag specifically. A backfill that outruns replication makes read replicas stale, which breaks reporting and any read-your-writes assumption — usually presenting as a mysterious application bug rather than as a database problem.
Write it down; it belongs in the runbook.
The rolling-deploy constraint again: for a period, both versions run. Every ordering decision must hold under that.
For each migration: can it be reversed, how long does that take, and what happens to rows written in the meantime?
Where a migration is irreversible, it is a one-way door and must be marked as such in deploy-runbook. Everything before it should be verified before crossing.
Run the migration against a copy with realistic volume and measure how long it takes. This is the only way to know, and it is exactly the discovery you want to make in advance.
Where no production-shaped copy exists, say so, and treat the timing as [unverified] in release-readiness. Do not extrapolate from staging — the relationship between a thousand rows and forty million is not linear in the way people assume.
Append to <workspace>/runbooks/deploy-<change>.md, and summarize in the change log:
## Schema change — <description>
**Table:** `orders` · **Rows:** 40.2M · **Size:** 12 GB · **Replicated:** yes, 2 replicas
**Engine:** <engine and exact version, with evidence>
### Steps
| # | Deploy | Operation | Expected duration | Lock | Reversible |
|---|---|---|---|---|---|
| 1 | schema | Add nullable currency column | measured in rehearsal | Verify engine/version; bounded lock wait, short transaction | App can roll back leaving column |
| 2 | app | dual-write currency | — | — | yes |
| 3 | data | backfill, 10k batches, 200ms pause | ~90 min, resumable | Update/row locks; commit each batch, bounded timeout | n/a |
| 4 | app | read from currency | — | — | yes |
| 5 | schema | *(deferred 30d)* drop legacy column | measured in rehearsal | Verify engine/version and bound wait | **NO — one-way door** |
### Rehearsal
Run against a 40M-row copy on <date>: step 3 took 94 min, peak replica lag 4s. ✅
### Monitoring during backfill
- Replica lag < 30s — abort and pause if exceeded
- Lock waits on `orders` — abort if any statement waits > 5s
### Rollback
Steps 1–4 reversible by reverting the deploy; the column can remain. Step 5 is irreversible
and is scheduled separately, after confirming no reader remains.
Testing on a small table. The relationship between a thousand rows and forty million is not what people assume.
A single-statement backfill. Lock, transaction log, replica lag, and no way to stop it.
Ignoring replica lag. Presents as a mysterious application bug, not a database problem.
Renaming a column. Trivial to write, breaks every consumer at once. Expand and contract instead.
Schema and application in one deploy. During a rolling deploy both versions run. Every step must work for both.
Dropping a column in the same release that stops using it. No compatibility window, no way back.
Assuming a default value is cheap. Version-dependent. Historically a full rewrite. Check your engine.
"We'd restore from backup." Only a plan if someone has tested it and knows the RTO.
Not rehearsing at volume. The duration is the risk, and it's knowable in advance.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub rpraharaj/forward-deployed-engineer --plugin fde-data3 skills in this plugin
/data-archaeologyReconstruct an undocumented data model from whatever exists - migrations, DDL, ORM definitions, and most reliably the queries actually issued - then surface the gap between the schema's stated intent and its real use. Use when a schema is undocumented, when the domain model is unclear, before a migration or reporting change, when column names do not match their contents, or when you need to know what the data actually looks like rather than what the schema claims. The schema tells you what is allowed; the data tells you what happens./data-pipeline-workBuild or change ETL, ELT, warehouse, and reporting pipelines where the failure modes are silent - data quality decay, late-arriving and duplicate records, backfill and reprocessing, idempotency, lineage, and reconciliation against a source of truth. Use for analytics and reporting engagements, when a pipeline produces wrong numbers, when a job needs backfilling or reprocessing, or when a downstream report disagrees with the source system. Pipelines fail differently from services - they usually keep running and produce wrong answers.Other plugins' skills for the same job