concern

Generate reusable Rails concerns with ActiveSupport::Concern and RSpec specs.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/reckerswartz/resume_builder --skill concern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: concern
Source: https://github.com/reckerswartz/resume_builder/tree/main/.devin/skills/concern
Command: npx skills add https://github.com/reckerswartz/resume_builder --skill concern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creates reusable Rails concerns to share behavior across models or controllers, reducing duplication and improving maintainability.

Core Features & Use Cases

  • Provides scaffolding for ActiveSupport::Concern modules with included blocks for validations, callbacks, scopes, and class methods.
  • Demonstrates how to write unit tests with RSpec to drive the development of concerns before implementation.
  • Shows patterns for both model and controller concerns to promote consistent behavior across an application.

Quick Start

Create a new concern module and write its specs first, following the TDD workflow.

Frequently Asked Questions about concern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share validations and callbacks across multiple Rails models?

Rails concerns allow you to share validations and callbacks across multiple models by creating ActiveSupport::Concern modules with included blocks. This reduces code duplication and improves maintainability across your Rails application.

What is the best way to test Rails concerns with RSpec?

Testing Rails concerns with RSpec involves writing unit specs first to drive development before implementation. This test-driven workflow ensures shared behaviors like validations and scopes function correctly before integration into models or controllers.

When should I use ActiveSupport::Concern in my Rails app?

Use ActiveSupport::Concern when you need to share behavior across models or controllers and want DRY code. It is ideal for extracting shared validations, scopes, callbacks, and helpers into reusable modules to maintain consistency.

Can I use concerns to share behavior across Rails controllers?

Yes, Rails concerns can share behavior across controllers. The approach provides patterns for both model and controller concerns, enabling you to extract shared helpers and logic into modules for consistent application behavior.

How does a TDD workflow work when generating Rails concerns?

A TDD workflow for Rails concerns starts by creating a new concern module and writing its RSpec specs first. You then implement the ActiveSupport::Concern logic to pass those tests, ensuring shared behavior is validated before deployment.

Are Rails concerns suitable for reducing code duplication in large applications?

Rails concerns are highly suitable for large applications requiring DRY code. They reduce duplication by centralizing shared validations, scopes, and callbacks into reusable modules, improving maintainability across multiple classes.