activerecord

activerecord is a skill for Claude Code from hoblin/claude-ruby-marketplace. It costs 180 tokens per session (2,009 once invoked), scanned A, original, MIT.

A reference guide for ActiveRecord, the database layer used by Ruby on Rails applications to read and change stored data through Ruby code.

In plain words
What is it for?
Writing migrations, adding columns or indexes, defining associations, validating models, using eager loading, and creating or optimising database queries.
Why use it?
It gives developers patterns for database changes, model relationships, validation, callbacks, and avoiding slow query behaviour such as N+1 queries.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the activerecord plugin — 1 skill shipped together

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 skills/hoblin/claude-ruby-marketplace/activerecord
Any agent
npx skills add hoblin/claude-ruby-marketplace --skill activerecord
Clone the repo
git clone --depth 1 https://github.com/hoblin/claude-ruby-marketplace

Made for: Claude Code.

Or install activerecord, the plugin that ships this one along with the rest of its 1 skill.

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 activerecord

README.md
[![agentmods](https://agentmods.dev/badge/skills/hoblin/claude-ruby-marketplace/activerecord.svg)](https://agentmods.dev/skills/hoblin/claude-ruby-marketplace/activerecord)
Your own site
<a href="https://agentmods.dev/skills/hoblin/claude-ruby-marketplace/activerecord"><img src="https://agentmods.dev/badge/skills/hoblin/claude-ruby-marketplace/activerecord.svg" alt="Measured on agentmods" height="20"></a>
Per session 180 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,009 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.00180 $0.02009
Opus 5 $0.00090 $0.01005
Sonnet 5 $0.00036 $0.00402
Haiku 4.5 $0.00018 $0.00201

Measured 6d ago against content hash 7d6a011fc493, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

activerecord 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 6d ago.

The scan reads SKILL.md. This mod also ships 28 executable files (examples/associations/association_extensions.rb, examples/associations/basic_associations.rb, examples/associations/counter_caches.rb, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

plugins/activerecord/skills/activerecord/SKILL.md · 268 lines

How it starts

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

ActiveRecord

This skill provides comprehensive guidance for working with ActiveRecord in Rails applications. Use for writing migrations, defining associations, optimizing queries, preventing N+1 issues, implementing validations, and following database best practices.

Quick Reference

CRUD Operations

# Create
user = User.create(name: "Alice", email: "[email protected]")
user = User.create!(...)  # Raises on failure

# Read
User.find(1)              # Raises RecordNotFound
User.find_by(email: "x")  # Returns nil if not found
User.where(active: true)  # Returns Relation

# Update
user.update(name: "Bob")
user.update!(...)         # Raises on failure

# Delete (callbacks run)
user.destroy

# Delete (no callbacks)
user.delete

Key Concepts

Concept Purpose
belongs_to Child side of association (has foreign key)
has_many / has_one Parent side of association
has_many :through Many-to-many via join model
includes / preload Eager loading (prevent N+1)
scope Named query builder
validates Model-level data validation
before_save / after_commit Lifecycle callbacks

Eager Loading Decision Tree

Need to access associated data?
├── NO → Use `joins` (filtering only)
└── YES → Need to filter/sort by association?
          ├── NO → Use `preload` (separate queries)
          └── YES → Large dataset with many associations?
                    ├── YES → Use `includes` with `references`
                    └── NO → Use `eager_load` (single JOIN)

Quick Comparison

Method Strategy Best For
includes Auto-choose Default choice
preload Separate queries Large datasets, no filtering
eager_load LEFT OUTER JOIN Filtering by association
joins INNER JOIN Filtering only, not accessing data
# N+1 problem
Post.all.each { |p| p.author.name }  # 1 + N queries

# Solution
Post.includes(:author).each { |p| p.author.name }  # 2 queries

Read the full file on GitHub · 268 lines

Files

What ships with it

34 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 268 lines · 180 tokens per session scan A 7d6a011fc493

Subscribe to this mod's changes

activerecord is a skill published in the GitHub repository hoblin/claude-ruby-marketplace (37 stars, last pushed yesterday), licensed MIT. It adds 180 tokens to every session and 2,009 once invoked, about $0.0009 per session on Opus 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-30.