refactor

Refactor legacy modules and large functions using small-step, test-driven changes.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/BrunoAMSilva/my-config --skill refactor-brunoamsilva
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/BrunoAMSilva/my-config/tree/main/coding/skills/refactor
Command: npx skills add https://github.com/BrunoAMSilva/my-config --skill refactor-brunoamsilva

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Improve code structure and readability without changing external behavior, enabling safer evolution of codebases over time.

Core Features & Use Cases

  • Break down large functions and classes into focused units (Extract Method, Extract Class) to improve maintainability.
  • Rename and restructure to remove magic numbers and primitive obsession; introduce design patterns (Strategy, Chain of Responsibility) to reduce complex conditionals.
  • Apply safe, incremental refactoring steps with tests and version-control guardrails to ensure behavior stays intact.

Quick Start

Identify a small code smell in a module, apply a safe, incremental refactor, and run tests after each change.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I safely refactor legacy code without changing its behavior?

Break down god functions by applying the Extract Method and Extract Class refactoring techniques, separating tangled logic into focused, maintainable units without altering program behavior.

How do I break down large functions and tightly coupled classes?

Break down god functions by applying the Extract Method and Extract Class refactoring techniques, separating tangled logic into focused, maintainable units without altering program behavior.

When should I introduce design patterns to fix code smells?

Introduce design patterns like Strategy or Chain of Responsibility to fix code smells when facing complex conditionals, primitive obsession, and magic numbers that degrade code structure and readability.

What is the best way to refactor a large module incrementally?

The best way to refactor a large module is enforcing small-step changes with strict version-control discipline and test-driven progression, ensuring continuous validation of structural improvements.

Can I refactor tightly coupled classes without breaking existing tests?

Yes, you can refactor tightly coupled classes by extracting focused units and applying incremental structural changes, using existing tests as guardrails to verify behavior stays intact throughout the process.