refactoring

Apply Fowler's refactoring catalog to restructure code without changing observable behavior.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/vnovakovits/claude-skills --skill refactoring-vnovakovits
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: refactoring
Source: https://github.com/vnovakovits/claude-skills/tree/main/plugins/engineering-practices/skills/refactoring
Command: npx skills add https://github.com/vnovakovits/claude-skills --skill refactoring-vnovakovits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate structural debt — long methods, duplicated logic, primitive obsession — that slows every future change. This Skill gives Claude a disciplined, test-backed method for improving code structure in small, safe steps instead of risky big-bang rewrites. ## Core Features & Use Cases - Code Smell Diagnosis: Maps 25+ recognized smells (Long Function, Feature Envy, Shotgun Surgery, Data Clumps) to the specific refactorings that resolve them. - Named Refactorings Catalog: Provides mechanics for Extract Function, Move Method, Replace Conditional with Polymorphism, Introduce Parameter Object, and dozens more, each as a sequence of reversible micro-steps. - Discipline Guardrails: Enforces the two-hats rule (never mix feature work with refactoring), the Rule of Three, and explicit when-NOT-to-refactor criteria. - Use Case: Ask Claude to clean up a 200-line method before adding a feature. It identifies the smells, applies Extract Function and Decompose Conditional step by step, and keeps the test suite green after every move. ## Quick Start Ask Claude to refactor a long method in your current file using Fowler's catalog while keeping all tests passing.

Frequently Asked Questions about refactoring

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

FAQPage Schema
How do I refactor a long method safely?▼

Break it down with Extract Function: copy a coherent fragment into a new function named after its intent, pass local variables as parameters, return modified values, then replace the original fragment with a call. Run tests after each step and use your IDE's automated Extract Method where available.

What are code smells and how do I fix them?▼

Code smells are recognizable patterns indicating design problems, such as Long Function, Duplicated Code, Feature Envy, and Primitive Obsession. Each smell maps to specific refactorings — for example, Feature Envy is resolved with Move Function, and Primitive Obsession with Replace Primitive with Object.

When should I not refactor code?▼

Skip refactoring code you are about to throw away, code without test coverage, or code frozen just before a release. For untested legacy code, first write characterization tests to lock in current behavior, then refactor under that safety net.

Can I refactor and add features in the same commit?▼

No. Mixing refactoring with behavior changes in one commit makes it impossible to tell which change broke a test and prevents independent review or revert. Wear one hat at a time: refactor with tests staying green, then switch to the feature hat.

Which IDE tools automate refactorings?▼

Most modern IDEs automate Rename, Extract Method, Inline, Move, and Change Signature with guaranteed behavior preservation. For .NET use ReSharper, Rider, or Visual Studio; for Java use IntelliJ IDEA; most language servers provide at least Rename and Extract.