ruby-refactor
БесплатноБез исполняемых скриптовНе проверенRuby refactoring guidelines from community best practices. This skill should be used when refactoring, reviewing, or restructuring Ruby code to improve…
от pproenca★ 231 звезда на GitHubОб этом скилле
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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Structure & Decomposition | CRITICAL | struct- |
| 2 | Conditional Simplification | CRITICAL | cond- |
| 3 | Coupling & Dependencies | HIGH | couple- |
| 4 | Ruby Idioms | HIGH | idiom- |
| 5 | Data & Value Objects | MEDIUM-HIGH | data- |
| 6 | Design Patterns | MEDIUM | pattern- |
| 7 | Modern Ruby 3.x | MEDIUM | modern- |
| 8 | Naming & Readability | LOW-MEDIUM | name- |
Quick Reference
1. Structure & Decomposition (CRITICAL)
struct-extract-method- Extract Long Methods into Focused Unitsstruct-extract-class- Extract Class for Single Responsibilitystruct-parameter-object- Introduce Parameter Object for Long Signaturesstruct-compose-method- Compose Methods at Single Abstraction Levelstruct-replace-method-with-object- Replace Complex Method with Method Objectstruct-single-responsibility- One Reason to Change per Classstruct-flatten-deep-nesting- Flatten Deep Nesting with Early Extraction
2. Conditional Simplification (CRITICAL)
cond-guard-clauses- Replace Nested Conditionals with Guard Clausescond-decompose-conditional- Extract Complex Booleans into Named Predicatescond-replace-with-polymorphism- Replace case/when with Polymorphismcond-null-object- Replace nil Checks with Null Objectcond-pattern-matching- Use Pattern Matching for Structural Conditionscond-consolidate-duplicates- Consolidate Duplicate Conditional Fragments
3. Coupling & Dependencies (HIGH)
couple-law-of-demeter- Enforce Law of Demeter with Delegationcouple-feature-envy- Move Method to Resolve Feature Envycouple-dependency-injection- Inject Dependencies via Constructor Defaultscouple-composition-over-inheritance- Replace Mixin with Composed Objectcouple-tell-dont-ask- Tell Objects What to Do, Don't Query Their Statecouple-avoid-class-methods-domain- Avoid Class Methods in Domain Logic
4. Ruby Idioms (HIGH)
idiom-prefer-enumerable- Use map/select/reject Over each with Accumulatoridiom-keyword-arguments- Use Keyword Arguments for Clarityidiom-duck-typing- Use respond_to? Over is_a? for Type Checkingidiom-predicate-methods- Name Boolean Methods with ? Suffixidiom-respond-to-missing- Always Pair method_missing with respond_to_missing?idiom-block-yield- Use yield Over block.call for Simple Blocksidiom-implicit-return- Omit Explicit return for Last Expression
5. Data & Value Objects (MEDIUM-HIGH)
data-value-object- Replace Primitive Obsession with Value Objectsdata-define-immutable- Use Data.define for Immutable Value Objectsdata-encapsulate-collection- Encapsulate Collections Behind Domain Methodsdata-replace-data-clump- Replace Data Clumps with Grouped Objectsdata-separate-query-command- Separate Query Methods from Command Methods
6. Design Patterns (MEDIUM)
pattern-strategy- Extract Algorithm Variations into Strategy
Установить ruby-refactor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ruby-refactor?
Ruby refactoring guidelines from community best practices. This skill should be used when refactoring, reviewing, or restructuring Ruby code to improve design, readability, and maintainability. Triggers on tasks involving code smells, method extraction, conditional simplification, coupling reduction, design patterns, or Ruby idiom adoption.
Как установить скилл ruby-refactor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ruby-refactor запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic