refactoring-to-patterns

Identify recurring design problems and apply refactoring patterns to improve code quality.

12|1|Updated Jun 4, 2013
One-click install
npx skills add https://github.com/bostonaholic/dotfiles --skill refactoring-to-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring-to-patterns
Source: https://github.com/bostonaholic/dotfiles/tree/main/claude/skills/refactoring-to-patterns
Command: npx skills add https://github.com/bostonaholic/dotfiles --skill refactoring-to-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Recognize recurring design problems and apply proven refactoring patterns to improve code quality.

Core Features & Use Cases

  • Identify classic refactoring patterns such as Compose Method, Replace Conditional with Polymorphism, Form Template Method, Introduce Null Object, and State/Strategy migrations.
  • Use cases include cleaning up long methods, reducing complex conditionals, and enabling easier extension and maintenance.
  • Real-world example: transform a monolithic method into focused, well-named helper methods with clear abstractions.

Quick Start

Identify a long method and apply at least two refactoring patterns to restructure it into simpler, well-named components.

Frequently Asked Questions about refactoring-to-patterns

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

FAQPage Schema
How do I refactor long methods and complex conditionals in a large codebase?

You can refactor long methods using patterns like Compose Method to break them into focused, well-named helpers, and Replace Conditional with Polymorphism to simplify complex logic for easier maintenance.

What is the Replace Conditional with Polymorphism refactoring pattern?

Replace Conditional with Polymorphism is a refactoring pattern that moves complex conditional logic into polymorphic classes, enabling easier extension and reducing fragile class hierarchies in medium to large codebases.

When should I use the Form Template Method refactoring pattern?

Use Form Template Method when you have similar methods across class hierarchies that can share a common structure, allowing subclasses to override specific steps while maintaining consistent algorithm flow.

How do I eliminate code smells like complex conditionals and fragile class hierarchies?

Eliminate code smells by identifying recurring design problems and applying proven refactoring patterns such as Introduce Null Object, State/Strategy migrations, and Compose Method to improve code quality.

Can I refactor a monolithic method into smaller components without changing behavior?

Yes, you can transform a monolithic method into focused, well-named helper methods with clear abstractions using the Compose Method pattern, restructuring it into simpler components while preserving behavior.

Does this refactoring approach work for medium to large codebases with fragile class hierarchies?

Yes, these refactoring patterns are specifically applicable to medium to large codebases, addressing scenarios such as long methods, complex conditionals, and fragile class hierarchies with practical examples.