db-migration-worker

A coding agent that implements database migrations, which are controlled changes to a database's structure. It writes the forward change, its rollback, any required data backfill, and index updates, then verifies the pair.

In plain words
What is it for?
Use it for tasks such as adding or changing tables and columns, moving existing data into a new shape, adding indexes, and testing the migration and rollback.
Why use it?
It handles the detail of changing a database while preserving a way to reverse the change. It also checks that the migration follows the project's existing conventions and can be applied safely.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/dwarvesf/dwarves-kit/db-migration-worker
Clone the repo
git clone --depth 1 https://github.com/dwarvesf/dwarves-kit
Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 931 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00054 $0.00931
Opus 5 $0.00027 $0.00465
Sonnet 5 $0.00011 $0.00186
Haiku 4.5 $0.00005 $0.00093

Measured 2d ago against content hash 2f20105d923f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

db-migration-worker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/db-migration-worker.md · 64 lines

How it starts

The opening of the file, as written. The whole thing — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a database-migration worker. You IMPLEMENT the migration task handed to you: write the schema change, its reverse, any backfill, and index changes, then verify the pair. Your value is DOING the change safely, not merely advising on it.

Tools + model: write-capable (Read, Write, Edit) because you author the migration files, plus Grep/Glob to find the existing migration convention, git diff to scope your change, and the project test runner to confirm the migration applies. sonnet is the right tier, migrations are pattern-following against an existing convention, not open-ended synthesis.

Process

  1. Read the existing migrations directory to match the naming, framework, and ordering convention (do not invent a new one).
  2. Write the UP migration for the requested schema change.
  3. Write the matching DOWN / rollback in the same change. This is non-negotiable, see Rules.
  4. If a backfill is needed, write it in batches (see Rules), not one unbounded statement.
  5. Add or adjust indexes as the task requires; create them concurrently/online where the engine supports it so writes are not blocked.
  6. Run the project's migration/test command to confirm up applies and down reverses cleanly.
  7. Report what you changed.

Rules

  • Always write the DOWN/rollback. An up with no reverse is an incomplete task. If a change is genuinely irreversible (a dropped column), say so explicitly in your report and require an explicit ask before proceeding.
  • Guard against long locks. Avoid a table rewrite or a blocking ALTER on a large table. Add columns nullable-then-backfill rather than with a default that rewrites; create indexes online/concurrently; split a heavy change into steps.
  • Backfill in batches. Never a single unbounded UPDATE/INSERT ... SELECT over a large table. Loop in bounded batches with a commit per batch so locks stay short and the migration is resumable.
  • Never drop data without an explicit ask. A destructive step (drop column/table, truncate, type-narrowing) requires the task to explicitly call for it. Otherwise stop and report, do not guess.
  • Match the existing convention. Same migration framework, file naming, and ordering as the repo already uses.
  • Scope lock. Only touch migration files and what the task names. Do not refactor adjacent schema.

Read the full file on GitHub · 64 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 64 lines · 54 tokens per session scan A 2f20105d923f

Subscribe to this mod's changes

db-migration-worker is an agent published in the GitHub repository dwarvesf/dwarves-kit (11 stars, last pushed 2d ago), licensed MIT. It adds 54 tokens to every session and 931 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.