rails-concern

rails-concern is a skill for Claude Code from ThibautBaissac/rails_ai_agents. It costs 84 tokens per session (1,811 once invoked), scanned A, original, MIT.

A Rails concern-generation skill for extracting shared behavior into reusable modules. A concern is a Ruby module used by multiple models or controllers.

In plain words
What is it for?
Creating and testing shared model or controller behavior such as validations, filtering, pagination, UUID callbacks, and authentication or authorization helpers.
Why use it?
It helps remove repeated code while keeping shared validations, scopes, callbacks, or helpers in one place. Tests written first clarify the behavior before extraction.

Skill for Claude Code

Written for Claude Code: paths in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Good fit Creating and testing shared model or controller behavior such as validations, filtering, pagination, UUID callbacks, and authentication or authorization helpers.

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

Any agent
npx skills add ThibautBaissac/rails_ai_agents --skill rails-concern
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 rails-concern

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/thibautbaissac/rails_ai_agents/rails-concern"><img src="https://agentmods.dev/badge/skills/thibautbaissac/rails_ai_agents/rails-concern.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,811 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00084 $0.01811
Opus 5 $0.00042 $0.00905
Sonnet 5 $0.00017 $0.00362
Haiku 4.5 $0.00008 $0.00181

Measured 13d ago against content hash a53e1ee5891e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

rails-concern 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 13d 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/skills/rails-concern/SKILL.md · 339 lines

How it starts

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

Rails Concern Generator (TDD)

Creates concerns (ActiveSupport::Concern modules) for shared behavior with specs first.

Quick Start

  1. Write failing spec testing the concern behavior
  2. Run spec to confirm RED
  3. Implement concern in app/models/concerns/ or app/controllers/concerns/
  4. Run spec to confirm GREEN

When to Use Concerns

Good use cases:

  • Shared validations across multiple models
  • Common scopes used by several models
  • Shared callbacks (e.g., UUID generation)
  • Controller authentication/authorization helpers
  • Pagination or filtering logic

Avoid concerns when:

  • Logic is only used in one place (YAGNI)
  • Creating "god" concerns with unrelated methods
  • Logic should be a service object instead

TDD Workflow

Step 1: Create Concern Spec (RED)

For Model Concerns, test via a model that includes it:

# spec/models/concerns/[concern_name]_spec.rb
RSpec.describe [ConcernName] do
  # Create a test class that includes the concern
  let(:test_class) do
    Class.new(ApplicationRecord) do
      self.table_name = "events"  # Use existing table
      include [ConcernName]
    end
  end

  let(:instance) { test_class.new }

  describe "included behavior" do
    it "adds the expected methods" do
      expect(instance).to respond_to(:method_from_concern)
    end
  end

  describe "#method_from_concern" do
    it "behaves as expected" do
      expect(instance.method_from_concern).to eq(expected_value)
    end
  end

  describe "class methods" do
    it "adds scope" do
      expect(test_class).to respond_to(:scope_name)
    end
  end
end

Alternative: Test through an actual model that uses the concern:

# spec/models/event_spec.rb
RSpec.describe Event, type: :model do
  describe "[ConcernName] behavior" do
    describe "#method_from_concern" do
      let(:event) { build(:event) }

      it "does something" do
        expect(event.method_from_concern).to eq(expected)
      end
    end
  end
end

For Controller Concerns, test via request specs:

Read the full file on GitHub · 339 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. 13d ago First seen · 339 lines · 84 tokens per session scan A a53e1ee5891e

Subscribe to this mod's changes

rails-concern is a skill published in the GitHub repository ThibautBaissac/rails_ai_agents (663 stars, last pushed 3mo ago), licensed MIT. It adds 84 tokens to every session and 1,811 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

rails-expert

Rails 7+ specialist that optimizes Active Record queries with includes/eagerload, implements Turbo Frames and Turbo Streams for partial page updates, configures Action Cable for WebSocket connections, sets up Sidekiq workers for background job processing, and writes comprehensive RSpec test suites. Use when building…

Jeffallan/claude-skills · 104 tokens

new

Create a new project to start development quickly.

clacky-ai/openclacky · 10 tokens

rails-conventions

Rootstrap Rails conventions. Use when writing, reviewing, or editing any Rails code — controllers, models, migrations, routes, views, mailers, initializers, locale files, or Rails config. Covers routing, ActiveRecord, migrations, i18n, time zones, mailers, assets, Bundler groups, and logging.

rootstrap/rails_api_base · 71 tokens

ruby-rails

Conventions and best practices for building web applications with Ruby on Rails. Use when scaffolding Rails apps or generators, designing ActiveRecord models and migrations, wiring up Hotwire/Turbo/Stimulus interactivity, setting up background jobs or caching, or writing RSpec/Minitest coverage for Rails code.

Mindrally/skills · 65 tokens

ruby-expert

Expert-level Ruby development with Rails, modern features, testing, and best practices. Use when the user mentions Ruby on Rails, RSpec, gem, Sinatra, or metaprogramming, or when the task involves Ruby 3+ Features, Object-Oriented, Functional Features, or Pattern Matching.

personamanagmentlayer/pcl · 64 tokens

rails-dev

Opinionated Rails conventions: rich models, concerns, CRUD-everything, state-as-records, minimal dependencies, Minitest with fixtures. Load this skill BEFORE any code-level thinking, not only before editing a file. It is required the moment a task touches Rails code in ANY way: designing or even just discussing a data…

tech-leads-club/agent-skills · 199 tokens