refactor-patterns

Guide code refactoring with patterns, SOLID principles, and code smell solutions.

1|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/ChenYCL/claude-skills-collection --skill refactor-patterns-chenycl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-patterns
Source: https://github.com/ChenYCL/claude-skills-collection/tree/main/refactor-patterns
Command: npx skills add https://github.com/ChenYCL/claude-skills-collection --skill refactor-patterns-chenycl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers improve existing code by providing guidance on common refactoring patterns, code smells, and SOLID principles, leading to cleaner, more maintainable, and robust software.

Core Features & Use Cases

  • Code Smell Identification & Solutions: Learn to recognize and fix issues like long functions, duplicated code, and primitive obsession.
  • Design Pattern Application: Understand how to apply patterns like Extract Method and Strategy to improve code structure.
  • SOLID Principles Explained: Grasp the five principles of SOLID for better object-oriented design.
  • Use Case: When faced with a complex, hard-to-understand function, use this Skill to identify potential refactorings and apply techniques like "Extract Method" to simplify it.

Quick Start

Use the refactor-patterns skill to explain the 'Feature Envy' code smell and provide a JavaScript example.

Frequently Asked Questions about refactor-patterns

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

FAQPage Schema
How do I identify code smells and apply the right refactoring patterns?

Code smells like long functions and primitive obsession are identified by analyzing structural issues, then resolved using refactoring patterns like Extract Method or Value Objects to improve maintainability.

What is the best way to refactor duplicated code and long functions?

The best way to refactor duplicated code and long functions is applying techniques like Extract Method to simplify complex blocks, breaking them into smaller, understandable units for better software quality.

How does the SOLID principles guide object-oriented design refactoring?

SOLID principles guide object-oriented design refactoring by enforcing five rules that promote robust architecture, using patterns like Polymorphism and Strategy to replace complex conditional logic.

When do I need to use refactoring techniques like Extract Method or Value Objects?

You need refactoring techniques like Extract Method or Value Objects when facing hard-to-understand functions or primitive obsession, applying design patterns to simplify and clarify the existing codebase.

Can I fix primitive obsession and feature envy without breaking existing software logic?

Yes, you can fix primitive obsession and feature envy by applying Value Objects and moving methods to their correct target classes, ensuring the refactoring preserves the original software behavior.

Why does my codebase suffer from maintainability issues despite passing tests?

Codebases suffer from maintainability issues despite passing tests due to hidden code smells like primitive obsession and design violations, requiring SOLID principles and structural refactoring to resolve.