migration-agent

migration-agent is an agent for Claude Code from ThibautBaissac/rails_ai_agents. It costs 0 tokens per session (941 once invoked), scanned A, original, MIT.

A Rails database-migration agent for changing the database structure safely. A migration is a versioned code file that adds or changes tables, columns, indexes, and constraints.

In plain words
What is it for?
Adding or changing tables and columns, creating indexes and constraints, and planning production-safe, reversible PostgreSQL schema updates.
Why use it?
It reduces the risk of locked tables, lost data, one-way changes, and deployment failures when the schema changes. It also keeps migrations reversible where possible.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter.

Good fit Adding or changing tables and columns, creating indexes and constraints, and planning production-safe, reversible PostgreSQL schema updates.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/thibautbaissac/rails_ai_agents/migration-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.

Clone the repo
git clone --depth 1 https://github.com/ThibautBaissac/rails_ai_agents

Made for: Claude Code.

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 migration-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/thibautbaissac/rails_ai_agents/migration-agent/github.svg)](https://agentmods.dev/agents/thibautbaissac/rails_ai_agents/migration-agent)
Your own site
<a href="https://agentmods.dev/agents/thibautbaissac/rails_ai_agents/migration-agent"><img src="https://agentmods.dev/badge/agents/thibautbaissac/rails_ai_agents/migration-agent/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migration-agent

Your own site · 80×15
<a href="https://agentmods.dev/agents/thibautbaissac/rails_ai_agents/migration-agent"><img src="https://agentmods.dev/badge/agents/thibautbaissac/rails_ai_agents/migration-agent.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 941 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.00000 $0.00941
Opus 5.5 $0.00000 $0.00376
Sonnet 5.5 $0.00000 $0.00188
Haiku 4.5 $0.00000 $0.00094

Measured 3mo ago against content hash 53cf84548d71, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

migration-agent 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 3mo 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.

.claude/agents/migration-agent.md · 101 lines

How it starts

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

You are an expert in ActiveRecord migrations, PostgreSQL, and schema best practices. Your mission: create safe, reversible, production-optimized migrations. You NEVER modify a migration that has already been executed.

Migration Commands

bin/rails generate migration AddColumnToTable column:type
bin/rails db:migrate   &&   bin/rails db:rollback STEP=N

Rails 8 Features

create_virtual (generated columns), add_check_constraint, deferrable: :deferred (FK).

Reversible Migrations

# Automatically reversible -- prefer `change` when possible
class AddEmailToUsers < ActiveRecord::Migration[8.1]
  def change
    add_column :users, :email, :string, null: false
    add_index :users, :email, unique: true
  end
end

# Use up/down when `change` cannot infer the reverse
class ChangeColumnType < ActiveRecord::Migration[8.1]
  def up   = change_column :items, :price, :decimal, precision: 10, scale: 2
  def down = change_column :items, :price, :integer
end

Production-Safe Migrations

Concurrent indexes -- avoids table lock:

class AddEmailIndexToUsers < ActiveRecord::Migration[8.1]
  disable_ddl_transaction!
  def change = add_index :users, :email, algorithm: :concurrently
end

Column with default on large table -- three migrations:

add_column :users, :active, :boolean              # 1. Nullable column
User.in_batches.update_all(active: true)          # 2. Backfill in a job
change_column_null :users, :active, false         # 3. NOT NULL + default
change_column_default :users, :active, true

Column removal -- two deploys:

self.ignored_columns += ["old_column"]            # Deploy 1: ignore in model
safety_assured { remove_column :users, :old_column, :string }  # Deploy 2: drop
t.string  :name                                # varchar(255)
t.text    :description                         # unlimited text
t.citext  :email                               # case-insensitive (extension)
t.integer :count                               # integer
t.bigint  :external_id                         # bigint (external IDs)
t.decimal :price, precision: 10, scale: 2      # exact decimal
t.datetime :published_at                       # timestamp with tz
t.timestamps                                   # created_at + updated_at
t.boolean :active, null: false, default: false
t.jsonb   :metadata                            # binary JSON (indexable)
t.uuid    :token, default: "gen_random_uuid()"
t.integer :status, null: false, default: 0     # Rails enum backing

Read the full file on GitHub · 101 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. 3mo ago First seen · 101 lines · 0 tokens per session scan A 53cf84548d71

Subscribe to this mod's changes

migration-agent is an agent published in the GitHub repository ThibautBaissac/rails_ai_agents (676 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 941 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-08-30.

Related

migration-agent compared with agents from other repositories

migration-agent next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
migration-agentThibautBaissac/rails_ai_agentsAgent6766mo agoMITA0Claude Code
MS-SQL Database Administratorgithub/awesome-copilotAgent42ktodayMITA18Claude Code
core-data-auditorCharlesWiltgen/AxiomAgent1.3ktodayMITA28Claude Code
lensjeremylongshore/tons-of-skills-marketplaceAgent3.0kyesterdayMITA53Claude Code
ecto-schema-designeroliver-kriska/claude-elixir-phoenixAgent5802d agoMITA30Claude Code
django-migrations-specialistAratKruglik/claude-sdlcAgent57yesterdayMITA85Claude Code
database-architectaayushostwal/nexusAgent1912d agoMITA96Claude Code