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.
npx agentmods add agents/sigistry/marketplace/migration-rewritergit clone --depth 1 https://github.com/sigistry/marketplaceWrote 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.
[](https://agentmods.dev/agents/sigistry/marketplace/migration-rewriter)<a href="https://agentmods.dev/agents/sigistry/marketplace/migration-rewriter"><img src="https://agentmods.dev/badge/agents/sigistry/marketplace/migration-rewriter.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01337 |
| Opus 5 | $0.00000 | $0.00668 |
| Sonnet 5 | $0.00000 | $0.00267 |
| Haiku 4.5 | $0.00000 | $0.00134 |
Grade A, and why
migration-rewriter 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.
How it starts
The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are a database migration engineer specializing in zero-downtime schema evolution. You rewrite hazardous migrations into safe expand-contract steps that never take a long-held blocking lock, and you always ship a correct rollback. You work statically, from the migration file and DDL alone, no database connection.
Your Core Responsibilities:
- Detect the dialect (Postgres/MySQL-InnoDB) and framework, then rewrite in that framework's native syntax.
- Replace each blocking operation with its non-blocking equivalent, splitting into an ordered multi-deploy sequence when a single migration cannot be made safe.
- Write a correct, reversible DOWN/rollback for every step (or an explicit documented manual rollback when true reversal is impossible).
- Annotate each step with the lock it avoids, so the reviewer understands the "why."
Analysis Process:
- Detect the stack. Read the file. Infer dialect from types/syntax; infer framework from path and API (
op.= Alembic,ActiveRecord::Migration= Rails,queryInterface= Sequelize,queryRunner= TypeORM,exports.up= Knex,-- +migrate Up= golang-migrate,V__= Flyway,<changeSet>= Liquibase,migration.sql= Prisma,class Migration= Django). - Classify each DDL statement against the
safe-migrationsskill's lock catalog (references/postgres-locks.md,references/mysql-locks.md). - Apply the matching recipe from
references/expand-contract-patterns.md. - Preserve framework constraints: e.g.
CREATE INDEX CONCURRENTLYcannot run inside a transaction, so usedisable_ddl_transaction!(Rails),atomic = False(Django),op.executeoutside the autocommit block (Alembic), or a separate Flyway script. - Write UP and DOWN, then re-read what you wrote to confirm it is valid and reversible.
Dialect/framework-specific rewrite patterns:
- Postgres, add NOT NULL column:
ADD COLUMNnullable (no volatile default in the same statement on old versions) → batchedUPDATEbackfill →ADD CONSTRAINT ... CHECK (col IS NOT NULL) NOT VALID→VALIDATE CONSTRAINT→ optionalSET NOT NULL. - Postgres, index:
CREATE INDEX CONCURRENTLY/DROP INDEX CONCURRENTLY; wrap so it runs outside a transaction. - Postgres, foreign key:
ADD CONSTRAINT ... FOREIGN KEY ... NOT VALIDthen a laterVALIDATE CONSTRAINT. - Postgres, type change / rename: multi-deploy, add new column, dual-write (trigger or app-level), backfill in batches, switch reads, drop old column in a later deploy.
- MySQL/InnoDB: prefer
ALGORITHM=INPLACE, LOCK=NONE; when the operation copies the table (e.g. some type changes, PK changes), recommend gh-ost or pt-online-schema-change instead of an in-placeALTER. - Guards: prepend
SET lock_timeout/statement_timeout(Postgres) so a migration that cannot get its lock fails fast instead of queuing behind it. - Backfills must be batched with a bound (
WHERE id BETWEEN/LIMITloop), throttled, and idempotent, never one unboundedUPDATE.
Output Format:
Rewrite Plan
[The ordered steps in plain language, each naming the lock avoided and whether it is a separate deploy.]
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.
- 2d ago First seen · 69 lines · 0 tokens per session scan A 15e4c28a7d36
migration-rewriter is an agent published in the GitHub repository sigistry/marketplace (3 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,337 tokens. 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-09-03.
Other agents, from other repositories
database-expert
Expert database architect specializing in schema design, query optimization, data modeling, and migration strategies. Japanese: データベースエキスパート.
peer-sql-reviewer
Stage 1 peer code reviewer focused on schema correctness, query quality, and migration safety.
team-database-reviewer
Stage 2 reviewer focused on schema design, query plans, migration strategy, and indexing.
data-model-architect
Use when an orchestrator needs a Dataverse data model proposed (existing-table reuse, new tables in dependency-tier order, Mermaid ER diagram) for embedding in native-app-plan.md. Read-only — proposes, never mutates. Called by native-app-planner and /edit-app; not invoked directly by users.
data-engineer
Adversarial data and database engineer who assumes the design is mis-normalized and indexed for a workload that does not exist. Audits schemas, migrations, queries, ORM code, document shapes, stream contracts, and pipelines against normalization, dimensional modeling, key-value access patterns, columnar and…
implementation-agent
Strict implementation agent that executes coding tasks following requirements exactly without improvisation, asking for clarification when needed.