agentleFS
emiliodominguezemiliodominguez/flow-skills/skills/flow-data-migrate/SKILL.md

flow-data-migrate

Skill1 starsChanged 47 days agoMITView on GitHub

Database schema and data migrations. Use when changing stored data, adding constraints or running a live backfill. Hands off to `flow-review` or `flow-orchestrate`.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not choose engine-specific syntax or promise a completion time from assumed capabilities or throughput.

    line 17
  2. Distinctive:

    Check actual lock and rewrite behavior.

    line 32
  3. Distinctive:

    Verify the recovery mechanism on a disposable copy, including preservation or reconciliation of writes since the backup.

    line 36
  4. Distinctive:

    Check the actual constraint state and application behavior, plus load, errors and lag.

    line 55
  5. Distinctive:

    Remove old storage and compatibility support only after all dependent consumers retire and the agreed recovery window closes.

    line 56
  6. Very specific:

    Use flow-review for the migration diff or flow-orchestrate for dependent rollout phases.

    line 73

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Data migration

Change persisted data while keeping every supported reader and writer correct. A completed job is not proof of a completed migration. Code-only transformations belong to flow-migrate.

Phase 1: Establish the data contract

  • Inspect the actual engine and version, schema, migration mechanism, volume, indexes, constraints and all readers and writers, including older deployments and background jobs. Do not choose engine-specific syntax or promise a completion time from assumed capabilities or throughput. Measure a representative batch before estimating.
  • Define the source of truth, transformation version, invariants, invalid-row policy and acceptance queries. Preserve identifiers, precision and null semantics. A placeholder value cannot make missing or invalid data correct merely by satisfying a constraint.
  • Establish the authorized environment and terminal action. Preparing a migration does not authorize running it on live data. Reuse authorization already given.

Phase 2: Make compatibility and recovery explicit

  • Separate expand, backfill, cutover and contract. Record which application versions can read and write each intermediate schema; keep the old representation until its consumers retire.
  • Specify how writes during the backfill reach both representations. Dual writes only in new application code do not cover old writers. Define conflict detection and retry without overwriting newer values, and a final catch-up under the chosen consistency boundary.
  • Check actual lock and rewrite behavior. Use bounded transactions where supported; some operations cannot run in a transaction. Set measured batch limits, lock/wait limits, load signals and pause thresholds from the environment's operating budget.
  • Name a recovery path per phase: application rollback, data repair, forward fix or restore. Verify the recovery mechanism on a disposable copy, including preservation or reconciliation of writes since the backup. A down migration is not proof that lost data can be recovered.

Phase 3: Execute a resumable transformation

  • Rehearse against representative disposable data, including malformed values and concurrent updates. Implement idempotent batches with stable traversal, a defined population boundary and durable checkpoints. Advance a checkpoint only with or after its batch commits.
  • Record committed, failed, skipped and retried rows; reconcile them against the population. An interrupted or ambiguous batch is inspected before retry. Retry limits and pause state survive restarts. Avoid storing sensitive row payloads in progress logs.
  • Exercise interruption and restart, repeated execution, concurrent old/new writes and a failed batch. Verify these cases before proceeding to an authorized live run.

Phase 4: Reconcile and cut over

  • Compare source and target values using the pinned transformation, not just non-null counts or a dashboard's success flag. Account for concurrent writes, rejects and omitted rows.
  • Enforce constraints and switch readers only after compatibility and reconciliation pass. Check the actual constraint state and application behavior, plus load, errors and lag.
  • Remove old storage and compatibility support only after all dependent consumers retire and the agreed recovery window closes. Record the verified revision, data boundary, queries, unresolved rows and the next phase that is actually safe to run.

Anti-patterns

  • One large update with no measured load budget or durable restart point.
  • Treating an initial copy as current while older instances still write the source.
  • Requiring a transaction or reversible down migration regardless of engine capabilities.
  • Dropping old data because the new column is populated or the deployment began.

Done when

  • The requested phase is complete with value-level reconciliation and compatibility evidence.
  • Restart and recovery were exercised; remaining failures and unrun live steps are explicit.
  • Destructive contraction has its own satisfied prerequisites and existing authorization.

Use flow-review for the migration diff or flow-orchestrate for dependent rollout phases; when unavailable, perform the equivalent review or record the remaining phase contract.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.