mcpField
R
ruby-refactor

ruby-refactor

github.com/pproencaDevelopment218293 installsUpdated 11w ago
Repository

About ruby-refactor

ruby-refactor is a community-maintained guide for refactoring Ruby applications. Its prioritized rules help developers and coding agents improve code structure, simplify conditionals, and apply Ruby idioms.

Key features

  1. 0145 prioritized rules in 8 categories
  2. 02Guidance on decomposition and conditionals
  3. 03Rules for coupling and dependencies
  4. 04Ruby idioms and value objects
  5. 05Modern Ruby 3.x patterns

Use cases

  1. 01Refactoring long methods or classes
  2. 02Simplifying nested conditional logic
  3. 03Reducing coupling between components

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill ruby-refactor

After installing, type/ruby-refactorin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
README.md
assets/templates/
_template.md
references/
_sections.md
cond-consolidate-duplicates.md
cond-decompose-conditional.md
cond-guard-clauses.md
cond-null-object.md
cond-pattern-matching.md
cond-replace-with-polymorphism.md
couple-avoid-class-methods-domain.md
couple-composition-over-inheritance.md
couple-dependency-injection.md
couple-feature-envy.md
couple-law-of-demeter.md
couple-tell-dont-ask.md
data-define-immutable.md
data-encapsulate-collection.md
data-replace-data-clump.md
data-separate-query-command.md
data-value-object.md
idiom-block-yield.md
idiom-duck-typing.md
idiom-implicit-return.md
idiom-keyword-arguments.md
idiom-predicate-methods.md
idiom-prefer-enumerable.md
idiom-respond-to-missing.md
modern-deconstruct-keys.md

Details

From the project README

Community Ruby Refactoring Best Practices

Comprehensive refactoring guide for Ruby applications, maintained by the community. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Refactoring Ruby code to reduce complexity and improve design
  • Extracting methods, classes, or value objects from large units
  • Simplifying complex conditionals and deep nesting
  • Reducing coupling between classes and modules
  • Adopting idiomatic Ruby patterns and modern Ruby 3.x features

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Structure & DecompositionCRITICALstruct-
2Conditional SimplificationCRITICALcond-
3Coupling & DependenciesHIGHcouple-
4Ruby IdiomsHIGHidiom-
5Data & Value ObjectsMEDIUM-HIGHdata-
6Design PatternsMEDIUMpattern-
7Modern Ruby 3.xMEDIUMmodern-
8Naming & ReadabilityLOW-MEDIUMname-

Quick Reference

1. Structure & Decomposition (CRITICAL)
2. Conditional Simplification (CRITICAL)
3. Coupling & Dependencies (HIGH)
4. Ruby Idioms (HIGH)
5. Data & Value Objects (MEDIUM-HIGH)
6. Design Patterns (MEDIUM)
7. Modern Ruby 3.x (MEDIUM)
8. Naming & Readability (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

Comments

Markdown supported