migration-strategist
Skill7 starsChanged 43 days agoMITView on GitHub
Plan zero-downtime database schema migrations with the expand-contract pattern: additive migration, dual-write application release, batched backfill, cutover, contract migration, and rollback. Use when the user renames or splits columns, changes types, restructures tables in a live database, or asks how to migrate without downtime.
In this repository83 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-enforcerSkill
- access-policy-designerSkill
- adaptive-guardSkill
- agent-reviewerSkill
- anti-ai-slop-designSkill
- api-mock-designerSkill
- api-observability-plannerSkill
- app-store-reviewerSkill
- ask-first-act-laterSkill
- assumption-checkerSkill
- auth-flow-designerSkill
- b2b-founder-roadmapSkill
- brand-name-labSkill
- breaking-change-detectorSkill
- changelog-generatorSkill
- checkpoint-guardianSkill
- claude-style-codingSkill
- claw-integration-designSkill
- context-compressorSkill
- contract-first-designerSkill
- coolify-orchestratorSkill
- crash-analystSkill
- data-lineage-tracerSkill
- data-maskerSkill
- deep-link-architectSkill
- design-intelligenceSkill
- design-md-enforcerSkill
- ecosystem-apiSkill
- ecosystem-databaseSkill
- ecosystem-mobileSkill
- ecosystem-orchestrationSkill
- ecosystem-productSkill
- ecosystem-reasoningSkill
- ecosystem-securitySkill
- ecosystem-webSkill
- error-recoverySkill
- fth-design-crafterSkill
- geo-auditorSkill
- geo-optimizerSkill
- index-advisorSkill
- jev-orchestratorSkill
- mastermind-loggerSkill
- memory-ledgerSkill
- mobile-perf-auditorSkill
- mobile-security-auditorSkill
- multi-brain-debateSkill
- multi-brain-expertsSkill
- multi-brain-scoreSkill
- multi-brainSkill
- offline-sync-designerSkill
- onboarding-designerSkill
- output-criticSkill
- parallel-plannerSkill
- pgbouncer-architectSkill
- plan-hardenerSkill
- plan-implement-verify-recoverSkill
- proje-analizcisiSkill
- project-analyzerSkill
- project-focus-firstSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Before designing, make sure you have the inputs below.
- Very specific: line 23
When asked "How do I rename this column?" or "How do I split this table?", standard ALTER TABLE RENAME breaks the app.
- Distinctive: line 24
Always enforce a backward-compatible migration strategy:
- Very specific: line 29
Add (Expand): Add the new column full_name (nullable initially).
- Very specific: line 31
Backfill: Write a script or background job to populate full_name using name for old rows.
- Distinctive: line 77
Every Migration plan must include a clear rollback path if Step 2 or Step 4 fails.
- Very specific: line 89
Confirm Before Running: Never execute a migration or backfill against a shared or production database without explicit user approval …
- Very specific: line 90
Constraints Last: Add NOT NULL, UNIQUE, or Foreign Keys only at the very end of the backfill process.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migration Strategist Protocol
This skill focuses on taking a database from State A to State B without causing downtime, locks, or data loss in production. Direct ALTER TABLE operations on large tables are dangerous and often require a multi-step rollout.
Core assumption: You cannot lock the table. You cannot break the old version of the application while the new version is deploying.
0. Context Intake
Before designing, make sure you have the inputs below. Read the previous workflow step's artifact first if it exists. Ask only for what is missing, in a single message, and state any assumption you make instead of blocking.
- Current and target schema, or
schema-diff-output.json. - Table sizes, write traffic, and acceptable lock time.
- Deployment model (rolling deploys, number of app versions live at once) and migration tool (Prisma, Flyway, Alembic, raw SQL).
1. The Zero-Downtime Pipeline
When asked "How do I rename this column?" or "How do I split this table?", standard ALTER TABLE RENAME breaks the app.
Always enforce a backward-compatible migration strategy:
The Expand & Contract Pattern (4 Steps)
For breaking changes (e.g., renaming a column name to full_name):
- Add (Expand): Add the new column
full_name(nullable initially). - Dual Write: Deploy application code that writes to BOTH
nameandfull_name, but reads fromname. - Backfill: Write a script or background job to populate
full_nameusingnamefor old rows. - Switch & Drop (Contract): Change the app to read/write ONLY
full_name. After successful deployment, run a final migration to dropname.
2. Output Format (The Plan)
Provide a numbered timeline mapping Application Code states vs Database changes.
Outputs. In file mode — the user wants artifacts, or this skill runs as a step of an ecosystem workflow — write both files below to docs/database-report/. In inline mode — a quick question — answer in the chat and end with the JSON below as a Handoff block instead of creating files.
- Human-Readable Markdown (
docs/database-report/migration-strategist-report.md)
### 🕰️ Step 1: Database Expand (Migration 1)
- Add `full_name` column.
- SQL: `ALTER TABLE users ADD COLUMN full_name VARCHAR(255);`
### 💻 Step 2: Application Release (v1.1)
- Code updates to write to BOTH `name` and `full_name`.
- Read from `name`.
### 🔄 Step 3: Data Backfill Script
- SQL: `UPDATE users SET full_name = name WHERE full_name IS NULL;`
- Action: Run this out-of-band in batches of 10,000 to avoid long locks.
### 💻 Step 4: Application Release (v1.2)
- Code updates to read/write ONLY to `full_name`.
### ✂️ Step 5: Database Contract (Migration 2)
- SQL: `ALTER TABLE users DROP COLUMN name;`
- Action: Execute only when v1.1 is fully retired from traffic.- Machine-Readable JSON (
docs/database-report/migration-strategist-output.json)
{
"skill": "migration-strategist",
"steps": [
{"phase": "expand", "target_table": "users", "action": "add_column", "details": "full_name"},
{"phase": "app_release_1", "action": "dual_write"},
{"phase": "backfill", "query": "UPDATE users SET full_name = name"},
{"phase": "app_release_2", "action": "read_write_new_only"},
{"phase": "contract", "target_table": "users", "action": "drop_column", "details": "name"}
]
}3. Rollback Strategy
Every Migration plan must include a clear rollback path if Step 2 or Step 4 fails. How do we reverse it?
- "If v1.2 fails, rollback to v1.1. Data is still dual-written to
name, so reverting the code is safe."
When to Skip
- The database is empty or not yet in production, where a direct migration is acceptable.
Guardrails
- No
DEFAULTon new columns for large tables: In some older SQL versions, adding a column with a default value locks and rewrites the entire table. Use nullable + background backfill. - Data Type Casting: Be explicitly careful about data truncation passing from State A to State B.
- Confirm Before Running: Never execute a migration or backfill against a shared or production database without explicit user approval (
@checkpoint-guardianwhen installed). Produce the plan and scripts; let the user trigger them. - Constraints Last: Add
NOT NULL,UNIQUE, or Foreign Keys only at the very end of the backfill process.
🔗 Next Steps & Handoffs
<!-- BEGIN GENERATED: handoffs (generated from the ecosystem workflow map by build_ecosystems.py — do not edit by hand) -->Ecosystem: @ecosystem-database — Database Domain.
Workflows:
- Database Evolution Flow (
db-evolution, step 2 of 3): next →@checkpoint-guardian.
Direct handoffs:
@breaking-change-detector— The schema change alters a public API contract.
Handoff contract: pass results to the next skill through docs/database-report/migration-strategist-output.json with the fields skill, workflow, created_at, inputs, summary, and next (the handoff contract of @ecosystem-database). If a next skill is not installed, continue with its step from the ecosystem map, or install it with npx skills add fatih-developer/fth-skills --skill <name> after the user agrees.
<!-- END GENERATED: handoffs -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

