db-migration-writer

db-migration-writer is an agent for Claude Code from Hainrixz/claude-db. It costs 78 tokens per session (1,017 once invoked), scanned A, original, MIT.

A restricted agent that applies database fixes only after a user confirms them. It creates backups, writes reversible timestamped migrations, and checks each change.

In plain words
What is it for?
Applying proposed schema or data fixes, generating reversible migrations, backing up files, and rechecking the resulting database changes.
Why use it?
It limits database edits to approved changes and provides a way to recover them if needed.

Agent for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_DATA} variable. Also seen: model in frontmatter.

Part of the claude-db plugin — 36 skills, 6 agents, 1 hook shipped together

Good fit Applying proposed schema or data fixes, generating reversible migrations, backing up files, and rechecking the resulting database changes.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/hainrixz/claude-db/db-migration-writer
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.

Clone the repo
git clone --depth 1 https://github.com/Hainrixz/claude-db

Made for: Claude Code.

Or install claude-db, the plugin that ships this one along with the rest of its 36 skills, 6 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for db-migration-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/hainrixz/claude-db/db-migration-writer.svg)](https://agentmods.dev/agents/hainrixz/claude-db/db-migration-writer)
Your own site
<a href="https://agentmods.dev/agents/hainrixz/claude-db/db-migration-writer"><img src="https://agentmods.dev/badge/agents/hainrixz/claude-db/db-migration-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 78 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,017 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00078 $0.01017
Opus 5 $0.00039 $0.00508
Sonnet 5 $0.00016 $0.00203
Haiku 4.5 $0.00008 $0.00102

Measured 7d ago against content hash d8069831b388, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

db-migration-writer 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 7d 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-writer.md · 62 lines

How it starts

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

db-migration-writer

You are the single write-capable agent in claude-db. You apply confirmed fixable: auto and accepted fixable: proposed fixes exactly as previewed in fix_preview, and you generate reversible migrations for schema changes — nothing more, nothing less. You run only after the user has explicitly confirmed the diffs via /claude-db:fix, and you are guarded by the plugin hooks. You never originate fixes; you execute approved ones.

Role

For each assigned finding's confirmed fix:

  1. Pre-flight git check. Inspect the working tree (git status --porcelain). If it is dirty, refuse to write and return the finding as warn with the reason in evidence.observed — unless the caller passed --force. No-git-repo branch: git status --porcelain exits 128 outside a repo — treat "no repo" as writable (there is nothing to dirty) and proceed; backups still go to the plugin data dir.
  2. Back up first. Before the first edit to any file, copy it to ${CLAUDE_PLUGIN_DATA}/backups/<timestamp>/ preserving its relative path. One timestamped backup dir per run.
  3. Apply the change. Use Edit/Write to apply the approved fix_preview exactly. Do not improvise, reformat, or add content beyond the previewed change.
    • For schema changes, always write a NEW timestamped migration file (e.g. <unix_or_iso_ts>_<slug>.sql) — never overwrite or rewrite an existing migration. Each migration must be reversible: include both the forward step and a down/rollback, or an explicit, justified note when reversal is impossible. Prefer non-locking, additive forms (CREATE INDEX CONCURRENTLY, ADD COLUMN nullable then backfill) for auto fixes.
  4. Be idempotent. If the fix is already present (the index exists, the constraint is already declared, the migration already shipped), make no change and report pass — re-running must never duplicate, corrupt, or double-apply.
  5. Re-verify. Re-run the finding's verification.reproduce (e.g. node scripts/lint-migration.mjs <file> --json, or an index_check against $DATABASE_URL) and record the assertion's pass/fail in the returned finding.

Read the full file on GitHub · 62 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. 7d ago First seen · 62 lines · 78 tokens per session scan A d8069831b388

Subscribe to this mod's changes

db-migration-writer is an agent published in the GitHub repository Hainrixz/claude-db (19 stars, last pushed 2mo ago), licensed MIT. It adds 78 tokens to every session and 1,017 once invoked, about $0.0004 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.

Related

Other agents, from other repositories

db-sql-expert

Elite SQL expert specializing in advanced query patterns, execution plan optimization, and DBA-level database performance tuning across PostgreSQL, MySQL/MariaDB, SQL Server, and Oracle.

andisab/swe-marketplace · 41 tokens

MS-SQL Database Administrator

Work with Microsoft SQL Server databases using the MS SQL extension.

github/awesome-copilot · 18 tokens

core-data-auditor

Use this agent when the user mentions Core Data review, schema migration, production crashes, or data safety checking. Automatically scans Core Data code for the 5 most critical safety violations - schema migration risks, thread-confinement errors, N+1 query patterns, production data loss risks, and performance issues…

CharlesWiltgen/Axiom · 261 tokens

lens

Turns raw data into actionable decisions — dashboards, metric definitions, SQL analytics, funnel and cohort analysis across BI platforms. Use when designing a dashboard, defining KPIs, or running funnel analysis. Trigger with "design a dashboard", "analyze our funnel".

jeremylongshore/tons-of-skills-marketplace · 53 tokens

ecto-schema-designer

Ecto schema architect - designs migrations, data models, and query patterns. Use proactively when planning database structure for new features.

oliver-kriska/claude-elixir-phoenix · 30 tokens

django-migrations-specialist

Database specialist for Django, runs in the "database" extra phase after development. Finalizes model field types and Meta indexes/constraints, runs makemigrations, reviews generated SQL with sqlmigrate, runs migrate, verifies with migrate --check. Do NOT use for: application logic (django-architect), tests…

AratKruglik/claude-sdlc · 85 tokens