refactor:rails
CommunityRefactor Rails code for cleaner apps
System Documentation
What problem does it solve?
Rails projects frequently accumulate fat controllers and models, making maintenance difficult and error-prone. This skill provides a structured approach to refactor by extracting business logic into service objects, using concerns for shared behavior, and applying query objects for complex database interactions, all while embracing Rails 8 and Ruby 3.3+ features.
Core Features & Use Cases
- DRY & SRP refactoring: Break controllers/models into focused classes; move business logic into services and queries.
- Pattern matching and Data classes: Modern Ruby techniques to simplify conditional logic and value objects.
- Use Case: Refactor a Fat OrdersController into Orders::CreateService, with app/services, app/models/concerns, and app/queries for complex fetches.
Quick Start
Apply this skill to a Rails project with fat controllers and models. Extract business logic into service objects under app/services, move shared logic into concerns, and replace complex queries with query objects, ensuring behavior stays externally visible.
Dependency Matrix
Required Modules
None requiredComponents
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: refactor:rails Download link: https://github.com/SnakeO/claude-debug-and-refactor-skills-plugin/archive/main.zip#refactor-rails Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.