rails:refactor

Community

Refactor Rails code into services & concerns

Authorfabn
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Identifies fat controllers, god models, repeated query chains, complex form handling, and display logic in Ruby on Rails projects and provides structured extraction patterns to reduce complexity, improve testability, and enforce single responsibility.

Core Features & Use Cases

  • Service Extraction: Move controller and model business logic into focused service objects that follow project initialization and call conventions.
  • Concern Extraction: Isolate cohesive model behavior into ActiveSupport::Concern modules for clarity and reuse.
  • Query/Form/Presenter Patterns: Replace repeated query chains with query objects, encapsulate multi-model form handling into form objects, and move display logic into DelegateClass wrappers or presenters.
  • Test & Verification Guidance: Create or update specs, run affected test suites, and lint new code to ensure behavior is preserved.
  • Use Case: Convert a 45-line OrdersController#create that handles validation, payment, and notifications into a slim controller and an OrderCreationService with accompanying specs.

Quick Start

Ask to refactor OrdersController#create by extracting an OrderCreationService, list files to create and modify, and provide the before/after code changes.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: rails:refactor
Download link: https://github.com/fabn/claude-plugins/archive/main.zip#rails-refactor

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.