agentleFS
rpraharajrpraharaj/ai-engineer/skills/data-change/SKILL.md

data-change

Skill1 starsChanged 15 days agoMITView on GitHub

Plan and apply a schema, API, or data migration using expand-then-contract. Use when adding or changing columns, indexes, events, protobuf or OpenAPI shapes, or backfills, and when ready-to-merge sees a contract change. Do not expand and contract in the same change.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read AGENTS.md if present.

    line 14
  2. Very specific:

    When invoked by a review or ready-to-merge, assess the existing plan, migration, and evidence only.

    line 18
  3. Very specific:

    Look for (first match that already exists): prisma/migrations, alembic, Django migrations/, db/migrate, supabase/migrations, flyway, goose, …

    line 24
  4. Distinctive:

    If none exist and the user really needs a schema change, stop and say so.

    line 26
  5. Distinctive:

    If the user asked for a rename or drop, split the work:

    line 36
  6. Distinctive:

    Write this (reply is enough unless the user asked for a file):

    line 50
  7. Distinctive:

    Prefer additive, reversible operations the existing migrations use.

    line 69
  8. Distinctive:

    Do not run a destructive migration against a shared or production database unless the user explicitly asked and the plan says so.

    line 70
  9. Distinctive:

    Do not commit unless asked.

    line 83

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

Change stored or published shape without breaking current readers. Do not mix a destructive contract change with the code that requires the new shape.

Read AGENTS.md if present.

Mode

When invoked by a review or ready-to-merge, assess the existing plan, migration, and evidence only; do not write or execute migrations. In implementation mode, apply only the authorized current step. Reuse the caller's scope through engineering-bar Shared procedures.

Detect how this repo migrates

From existing folders and manifests, use the tool already here. Do not add a new migrator.

Look for (first match that already exists): prisma/migrations, alembic, Django migrations/, db/migrate, supabase/migrations, flyway, goose, liquibase, knex, TypeORM/SQLAlchemy migrations, sqlx, golang-migrate, raw SQL next to existing SQL migrations, OpenAPI/protobuf/avro/json-schema generators this repo already runs.

If none exist and the user really needs a schema change, stop and say so. Do not invent a framework.

Classify the step

KindExamplesThis change may
Expandadd nullable column, add table, add index concurrently if the DB allows, add field to a response, add event field with a defaultyes
Backfillpopulate the new column/field for old rowsyes, after expand is deployed or in the same expand if it is online-safe and bounded
Contractdrop column, make NOT NULL, rename, remove field, change meaningnot in the same change as the code that still needs the old shape, and not with expand

If the user asked for a rename or drop, split the work:

  1. Expand (add the new name, write both)
  2. Later change: readers use the new name
  3. Later change: contract (drop the old)

Say that plan and only implement the step they are on (default: expand).

Contract prerequisites

Before contraction, require evidence that expand is deployed, the backfill is complete and checked, and all supported readers and writers have migrated (including jobs and external consumers). Verify old fields no longer receive writes. Document a rollback that does not redeploy code requiring the removed shape. If any of these are unknown, contraction is unverified and must not run. An accepted versioned breaking API change still needs an explicit consumer and rollout plan.

Plan before files

Write this (reply is enough unless the user asked for a file):

## Data change plan
- Tool:
- Step: expand | backfill | contract
- Online?: <locks, rewrite risk, estimated size>
- Expand:
- Backfill: <bounded batches / pause / how to resume, or n/a>
- Contract (later):
- Rollback:
- Verification: <query or test that proves old and new readers work>

Destructive contract in the same change as expand is a fail. Unbounded backfill on a large table without batches is a fail.

Apply (only the current step)

  • Match existing migration naming, directory, and review comments in this repo.
  • Prefer additive, reversible operations the existing migrations use.
  • Do not run a destructive migration against a shared or production database unless the user explicitly asked and the plan says so.
  • For API/event contracts, keep old fields until the contract step; add new ones alongside.
  • Load engineering-bar (paths in that skill). For a backfill job, also load production-pass and apply only Timeouts, Bounds, and Visibility. Do not let production-pass start a new migration plan.

Prove with this repo's tests (write-tests if a migration test pattern exists) plus the verification query/check from the plan.

Done

  1. Mode (assessment or implementation), plan, and step assessed or executed; report missing evidence as unverified
  2. Files added
  3. Commands run (including migrate/test only when authorized) and results
  4. What must happen in a later change (contract, leftover dual-write)

Do not commit unless asked.

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.