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.
git clone --depth 1 https://github.com/andyw8/rails_rulesWrote 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/rules/andyw8/rails_rules/1002-rails-models)<a href="https://agentmods.dev/rules/andyw8/rails_rules/1002-rails-models"><img src="https://agentmods.dev/badge/rules/andyw8/rails_rules/1002-rails-models/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.
<a href="https://agentmods.dev/rules/andyw8/rails_rules/1002-rails-models"><img src="https://agentmods.dev/badge/rules/andyw8/rails_rules/1002-rails-models.svg" alt="Reviewed on agentmods" width="80" 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.00682 |
| Opus 5.5 | $0.00000 | $0.00273 |
| Sonnet 5.5 | $0.00000 | $0.00136 |
| Haiku 4.5 | $0.00000 | $0.00068 |
Grade A, and why
1002-rails-models 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.
How it starts
The opening of the file, as written. The whole thing — 106 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rails Model Standards
Context
- In Ruby on Rails 8.0 models
- Use modern Rails patterns like store_accessor, concerns, and modules
- Add YARD documentation
Requirements
- Add YARD documentation to all methods
- Use positional arguments in enums
- Include a separate module for specific roles, validations, or other functionality
- Define constants at the top of the file
- Use has_prefix_id for models with UUIDs
- Use strong typing with attribute declarations
- Use normalizes for attribute normalization
- Include Searchable concern for models that need search
- Use counter_cache for belongs_to relationships that need counts
- Use store_accessor for models with JSON columns
- Use acts_as_tenant for multi-tenant models
- Include validation for uploaded files with resizable_image
- Pass models to jobs, not IDs (they will be serialized)
- Use strong typing in models with
attributedeclarations
Examples
class Plan < ApplicationRecord has_prefix_id :plan
INTERVALS = [:month, :year].freeze
Store JSON attributes in the details column
@return [Array] List of features for this plan
store_accessor :details, :features, :stripe_tax
Define default attributes
attribute :currency, default: "usd"
Normalize attributes before saving
normalizes :currency, with: ->(currency) { currency.downcase }
Validations
validates :name, :amount, :interval, presence: true validates :currency, presence: true, format: {with: /\A[a-zA-Z]{3}\z/, message: "must be a 3-letter ISO currency code"} validates :interval, inclusion: INTERVALS validates :trial_period_days, numericality: {only_integer: true} validates :unit_label, presence: {if: :charge_per_unit?}
Scopes
scope :hidden, -> { where(hidden: true) } scope :visible, -> { where(hidden: [nil, false]) } scope :monthly, -> { where(interval: :month) } scope :yearly, -> { where(interval: :year) } scope :sorted, -> { order(amount: :asc) }
Returns a list of features for this plan
@return [Array] List of features
def features Array.wrap(super) end
Checks if this plan has a trial period
@return [Boolean] True if the plan has a trial
def has_trial? trial_period_days > 0 end
Checks if this plan is a monthly plan
@return [Boolean] True if the plan is monthly
def monthly? interval == "month" end end
</example>
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.
- 1mo ago First seen · 106 lines · 0 tokens per session scan A e97b5897bef4
1002-rails-models is a cursor rule published in the GitHub repository andyw8/rails_rules (4 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 682 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-31.
Other cursor rules, from other repositories
migrations
Rails migrations — generator, version prefix, reversibility, indexes, FKs, column naming.
drizzle-patterns
Drizzle ORM patterns and database conventions.
python-app
Here's how the python application is organized.
prisma
Prisma database patterns and conventions for Next.js and TypeScript projects.
ruby-style
Ruby coding style aligned with project RuboCop config.
sqlalchemy-patterns
SQLAlchemy models, queries, relationships.