rails-concern

Scaffold reusable ActiveSupport::Concern modules for shared Rails model or controller behavior.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill rails-concern-nschneble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-concern
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/rails-concern
Command: npx skills add https://github.com/nschneble/rails-superstack --skill rails-concern-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generates Rails concerns to share behavior across models or controllers using a test-driven development approach.

Core Features & Use Cases

  • Creates ActiveSupport::Concern modules for shared behavior with specs-first.
  • Provides templates and guidance for model concerns and controller concerns.
  • Encourages DRY code and reusable modules across apps, teams, and projects.

Quick Start

Write a failing spec for the Rails concern, then implement the concern and run the test suite until all specs pass.

Frequently Asked Questions about rails-concern

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

FAQPage Schema
How do I extract shared behavior into Rails concerns using TDD?

To generate Rails concerns using TDD, write a failing RSpec for the desired ActiveSupport::Concern module first, implement the module, and run the test suite until all specs pass.

When should I use ActiveSupport::Concern for modularization in Rails?

Use ActiveSupport::Concern for modularization when multiple models or controllers share behavior, encapsulating validations, scopes, callbacks, or authorization helpers into reusable modules.

What is the best way to organize Rails concerns for controllers and models?

Organize Rails concerns by placing model modules under app/models/concerns and controller modules under app/controllers/concerns, following ActiveSupport conventions for code organization.

Can I use RSpec to test Rails concerns before implementation?

Yes, you can use RSpec to test Rails concerns before implementation by following a spec-first workflow where you define expected behavior in a failing test, then generate the concern to satisfy it.

Does this approach scaffold both model and controller concerns?

Yes, this approach scaffolds both model and controller concerns, providing templates and guidance for creating reusable ActiveSupport::Concern modules under their respective app directories.