models

models is a cursor rule for Cursor from muraaano/cursor-project-rules-on-rails. It costs 0 tokens per session (433 once invoked), scanned A, original, MIT.

A set of Rails rules for organizing models and application domain logic. Models represent data or business events, while PORO means a plain Ruby class without framework inheritance.

In plain words
What is it for?
Use it when creating Rails models, event objects, validations, or multi-record updates that must remain consistent.
Why use it?
It clarifies where validation and business operations belong and requires related data updates to happen together in a database transaction.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

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.

agentmods
npx agentmods add rules/muraaano/cursor-project-rules-on-rails/models
Clone the repo
git clone --depth 1 https://github.com/muraaano/cursor-project-rules-on-rails

Made for: Cursor.

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 models

README.md
[![agentmods](https://agentmods.dev/badge/rules/muraaano/cursor-project-rules-on-rails/models.svg)](https://agentmods.dev/rules/muraaano/cursor-project-rules-on-rails/models)
Your own site
<a href="https://agentmods.dev/rules/muraaano/cursor-project-rules-on-rails/models"><img src="https://agentmods.dev/badge/rules/muraaano/cursor-project-rules-on-rails/models.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 433 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00433
Opus 5 $0.00000 $0.00217
Sonnet 5 $0.00000 $0.00087
Haiku 4.5 $0.00000 $0.00043

Measured 5d ago against content hash 2f01d6d4edf8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

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 5d 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.

.cursor/rules/models.mdc · 42 lines

What it actually says

Modelの実装規約

基本方針

  • アプリケーションのドメインロジックを扱う処理は、Modelに実装する
  • Modelは app/models に配置する
  • ファイル名はクラス名のスネークケースとする
  • データベースアクセスするテーブルがある場合は、RailsのActiveRecord(実際にはApplicationRecord)を継承したクラスとする
  • テーブルがない場合は、PORO(Pure Old Ruby Object)かイベント型モデルを選択する
  • 複数のモデルに関連した一連のイベントをまとめる場合は、イベント型モデルとする
  • イベントではない場合は、PORO(特に継承をしないクラス)とする
  • validationが不要な場合で、イベント型モデルにする理由がない場合はPOROを採用する。
    • I/Fが簡素化でき、メモリなどのコストも低いため。

イベント型モデル

  • ApplicationEventModel を継承して作成する
  • クラス名は、イベント名の名詞とし、末尾に Event をつける
    • 例: MoveEvent
  • I/FはRailsのApplicationModelに準ずる(https://railsguides.jp/active_model_basics.html)
    • 例: valid?, save

validation

  • カスタムvalidatorの実装はなるべく控え、既存のvalidator(numericalityなど)を使う

トランザクション

  1. データの整合性を保つために、関連するデータの更新は必ずトランザクション内で行う

    ApplicationRecord.transaction do
      # データの更新処理
    end
    
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. 5d ago First seen · 42 lines · 0 tokens per session scan A 2f01d6d4edf8

Subscribe to this mod's changes

models is a cursor rule published in the GitHub repository muraaano/cursor-project-rules-on-rails (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 433 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.