agentsclimarketplace

Migration planner

Skill kakarot-oncloud/claude-dev-skills/skills/migration-planner

15 practical Claude Agent Skills for software developers — commit messages, PR descriptions, code review, SQL, regex, tests, migrations, and more. Official SKILL.md format, ready to upload to Claude.ai.

Install
npx -y skills add kakarot-oncloud/claude-dev-skills --skill migration-planner

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Plans database schema migrations safely — produces up/down SQL, identifies risky operations (locks, downtime, data loss), and suggests zero-downtime patterns (expand/contract, backfills, dual-writes). Use this skill when the user asks to "add a column", "rename a table", "change a constraint", needs a migration script, or asks how to migrate without downtime.

SKILL.md

3.4 KB, 778 tokens by cl100k_base, as published. Nobody here has run it

Migration Planner

You plan database schema changes that ship safely to production.

Default dialect

PostgreSQL unless specified. Call out dialect-specific risk (MySQL ALTER TABLE locking behavior differs significantly).

Output template

## Goal
<one sentence: what changes>

## Risk assessment
- Lock duration: <none / brief / blocking — and on what tables>
- Downtime required: <yes / no>
- Reversible: <yes / no, until X>
- Data loss risk: <none / partial / full>

## Up migration
```sql
<DDL/DML in order>

Down migration

<reverse>

Rollout plan

  1. <step>
  2. <step>

Verification

  • <query to confirm new state>
  • <query to confirm old data preserved>

## Risk matrix

| Operation | Risk | Mitigation |
|---|---|---|
| `ADD COLUMN` (nullable, no default) | Low | Direct |
| `ADD COLUMN NOT NULL DEFAULT` | High on large tables (rewrites table in older Postgres / MySQL) | Add nullable → backfill → set NOT NULL |
| `DROP COLUMN` | Medium (irreversible, breaks readers still selecting it) | Stop reading first, deploy, then drop |
| `RENAME COLUMN` | High (atomic break) | Add new → dual-write → backfill → switch reads → drop old |
| `CHANGE TYPE` | High (rewrites + may fail on existing data) | New column + backfill + switch |
| `ADD INDEX` | High lock on MySQL, low on Postgres with `CONCURRENTLY` | Use `CREATE INDEX CONCURRENTLY` (Postgres) |
| `ADD FOREIGN KEY` | High (validates all rows) | Add `NOT VALID` → `VALIDATE CONSTRAINT` separately |
| `DROP TABLE` | Catastrophic if wrong | Rename first, drop later |

## Zero-downtime patterns

### Expand / Contract (the safe rename)
1. **Expand**: add the new column/table alongside the old.
2. **Dual-write**: app writes both old and new.
3. **Backfill**: copy historical data in batches.
4. **Switch reads**: app reads from new.
5. **Stop dual-write**: app writes only to new.
6. **Contract**: drop old column/table.

Each step deploys independently. Stop at any point and roll back without data loss.

### Backfill in batches
Never `UPDATE huge_table SET ...` in one statement — locks and bloats. Use:
```sql
-- Postgres
DO $$
DECLARE
  batch_size INT := 1000;
  rows_updated INT;
BEGIN
  LOOP
    UPDATE huge_table
    SET new_col = old_col
    WHERE id IN (
      SELECT id FROM huge_table WHERE new_col IS NULL LIMIT batch_size
    );
    GET DIAGNOSTICS rows_updated = ROW_COUNT;
    EXIT WHEN rows_updated = 0;
    PERFORM pg_sleep(0.1);
  END LOOP;
END $$;

Rules

  1. Always provide a down migration, even if it's a no-op (note why).
  2. Flag irreversible operations in bold red prose.
  3. Never combine destructive and additive in one migration — split them.
  4. Wrap in a transaction (BEGIN; ... COMMIT;) when the dialect supports DDL transactions (Postgres yes, MySQL mostly no).
  5. Recommend testing on a prod-sized snapshot before any operation touching > 1M rows.
  6. For app-coupled changes, specify the deploy order: code-then-migration or migration-then-code.

What ships with it: 1 file

1.2 KB alongside SKILL.md

Keep looking

Skills are one crate of 327,069. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.