refactoring_patterns

Applies refactoring patterns to restructure code without changing its behavior.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/jvsandhu/agentic-skills --skill refactoring-patterns-jvsandhu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring_patterns
Source: https://github.com/jvsandhu/agentic-skills/tree/main/skills/refactoring_patterns
Command: npx skills add https://github.com/jvsandhu/agentic-skills --skill refactoring-patterns-jvsandhu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Legacy codebases accumulate code smells like long methods, duplicated logic, and deep conditionals that slow down development and increase bug risk. This Skill provides a disciplined, test-first workflow for restructuring code safely without altering its behavior. ## Core Features & Use Cases - Code Smell Diagnosis: Maps common smells (Long Method, Large Class, Feature Envy, Data Clumps) to the correct refactoring pattern such as Extract Method or Move Method. - Pattern Library: Includes concrete before/after examples for Extract Method, Replace Conditional with Polymorphism, Guard Clauses, and modernizing syntax (var to const/let, callbacks to async/await). - Three-Phase Safety Workflow: Enforces preparation with characterization tests, atomic commits on a clean Git branch, and post-refactoring regression verification. - Use Case: When handed a 200-line function with nested conditionals, follow the workflow to write characterization tests first, then decompose it into small methods step by step while keeping the test suite green. ## Quick Start Refactor this long function using extract method and guard clauses, keeping all existing tests passing.

Frequently Asked Questions about refactoring_patterns

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

FAQPage Schema
Can I add new features while refactoring?

No, never mix refactoring with feature work. The two-hat rule states you either refactor or add features, never both at once, because combining them makes it impossible to isolate the cause of regressions.