data-migration-best-practices
Installation
SKILL.md
Data Migration Best Practices
Treat migration as a temporary production system with explicit correctness, capacity, observability, and retirement criteria. It changes persisted behavior and is not automatically a refactoring.
Workflow
- Define source authority, target contract, transformations, invariants, data classification, and tolerated downtime/staleness.
- Choose a stable snapshot boundary or high-water mark and start durable capture of live changes before they can escape the snapshot.
- Expand the target schema compatibly; keep old and new application versions interoperable during rolling deployment.
- Backfill in bounded, idempotent, resumable batches with deterministic progress and explicit bad-row handling.
- Apply captured deltas without allowing stale snapshot data to overwrite newer writes.
- Reconcile availability, counts, identities, values, and domain invariants against a declared watermark.
- Cut over only when freshness and discrepancy gates pass; monitor and retain a reversal or forward-repair path.
- Contract old fields, code paths, capture infrastructure, and temporary permissions only after an observation window.