rails-model

rails-model is an agent for Claude Code from ag0os/rails-dev-plugin. It costs 344 tokens per session (940 once invoked), scanned A, original, MIT.

An ActiveRecord specialist for Rails models, the Ruby on Rails code that represents database records and their relationships. It handles associations, validations, database structure, and migrations, which change the database schema.

In plain words
What is it for?
Use it when creating or reviewing Rails models, associations, validations, scopes, callbacks, migrations, indexes, foreign keys, or schema changes.
Why use it?
It helps keep model code, database tables, indexes, and tests consistent when data relationships or rules change.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; mentions CLAUDE.md.

Part of the rails-dev-plugin plugin — 19 skills, 11 agents shipped together

Good fit Use it when creating or reviewing Rails models, associations, validations, scopes, callbacks, migrations, indexes, foreign keys, or schema changes.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/ag0os/rails-dev-plugin/rails-model
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/ag0os/rails-dev-plugin

Made for: Claude Code.

Or install rails-dev-plugin, the plugin that ships this one along with the rest of its 19 skills, 11 agents.

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 rails-model

README.md
[![agentmods](https://agentmods.dev/badge/agents/ag0os/rails-dev-plugin/rails-model/github.svg)](https://agentmods.dev/agents/ag0os/rails-dev-plugin/rails-model)
Your own site
<a href="https://agentmods.dev/agents/ag0os/rails-dev-plugin/rails-model"><img src="https://agentmods.dev/badge/agents/ag0os/rails-dev-plugin/rails-model/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 rails-model

Your own site · 80×15
<a href="https://agentmods.dev/agents/ag0os/rails-dev-plugin/rails-model"><img src="https://agentmods.dev/badge/agents/ag0os/rails-dev-plugin/rails-model.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 344 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 940 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.00344 $0.00940
Opus 5.5 $0.00138 $0.00376
Sonnet 5.5 $0.00069 $0.00188
Haiku 4.5 $0.00034 $0.00094

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

Security

Grade A, and why

rails-model 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 1mo 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/rails-model.md · 63 lines

How it starts

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

You are an ActiveRecord and database specialist responsible for implementing models, associations, and migrations.

Execution Workflow

Creating a New Model

  1. Detect model conventions: a. Scan app/models/ and db/schema.rb to understand existing relationships and table structure b. Read app/models/application_record.rb for shared concerns and includes c. Glob app/models/concerns/ to see existing concern naming and structure d. Note whether models use namespaces (e.g., Insurance::Policy vs flat Policy) e. Check CLAUDE.md for project intent that may override detected conventions
  2. Design the schema — columns, types, null constraints, defaults
  3. Generate or write the migration with proper indexes (foreign keys, uniquely queried columns)
  4. Implement the model — associations (with dependent: and inverse_of:), validations, scopes
  5. Add any necessary callbacks (use sparingly — prefer service objects for side effects)
  6. Write or update tests for the new model

Adding or Modifying Associations

  1. Determine the relationship type (belongs_to, has_many, has_many :through, polymorphic)
  2. Write a migration to add the foreign key column and index if needed
  3. Declare the association on both sides with dependent: and inverse_of:
  4. Update any existing queries that should use the new association
  5. Verify with rails console or tests that eager loading works

Writing Migrations

  1. Always use change for reversible operations; use up/down only when change cannot infer the reverse
  2. Add null: false constraints for required columns
  3. Add composite indexes for commonly paired query conditions
  4. Run rails db:migrate and rails db:rollback to verify reversibility

Reviewing an Existing Model

  1. Check that database constraints match model validations
  2. Identify missing indexes on foreign keys or frequently filtered columns
  3. Look for N+1 risks — suggest includes/preload where appropriate
  4. Flag callbacks that contain business logic better suited for a service object

Read the full file on GitHub · 63 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. 1mo ago First seen · 63 lines · 0 tokens per session scan A 5c344291aee2

Subscribe to this mod's changes

rails-model is an agent published in the GitHub repository ag0os/rails-dev-plugin (5 stars, last pushed 4mo ago), licensed MIT. It adds 344 tokens to every session and 940 once invoked, about $0.0014 per session on Opus 5.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-31.

Related

Other agents, from other repositories

rails-expert

Build scalable Rails applications with modern patterns and best practices. Implements service objects, background jobs, and API design. Use PROACTIVELY for Rails development, performance optimization, or architectural decisions.

davepoon/buildwithclaude · 42 tokens

ef-core-specialist

Database expert for Entity Framework Core — DbContext design, efficient LINQ queries, migrations, interceptors, compiled queries, and data access optimization. Use for schema changes and migrations, query performance issues (N+1, missing indexes), entity configuration, or any database-layer work.

codewithmukesh/dotnet-claude-kit · 61 tokens

ruby-pro

Write idiomatic Ruby code with metaprogramming, Rails patterns, and performance optimization. Specializes in Ruby on Rails, gem development, and testing frameworks. Use PROACTIVELY for Ruby refactoring, optimization, or complex Ruby features.

echoVic/blade-code · 52 tokens

rails-reviewer

Rails code reviewer and QA. MUST BE USED to verify any Rails change before it is declared done. Checks N+1 queries, mass-assignment safety, fat-controller smells, missing validations, and runs rspec/rails test + rubocop.

toffyui/ccteams · 53 tokens

dnp-ef-migration-planner

🗄️ EF Core migration safety — validates migration chain, detects data loss risks, ensures correct DbContext targeting.

zdanovichnick/dotnet-pilot · 33 tokens

web-researcher

Fetches and extracts information from focused web sources efficiently. Optimized for official Ruby, Rails, Grape, Sidekiq, and gem documentation.

slbug/claude-ruby-grape-rails · 35 tokens