refactor

Detect code smells and generate incremental refactoring plans with rollback points.

9|2|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/botlearn-ai/botlearn-skills --skill refactor-botlearn-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/botlearn-ai/botlearn-skills/tree/main/skills/refactor
Command: npx skills add https://github.com/botlearn-ai/botlearn-skills --skill refactor-botlearn-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies code smells and prescribes safe, incremental refactoring to improve maintainability.

Core Features & Use Cases

  • Detects common code smells (e.g., long methods, large classes, duplicated logic, switch-based branching) and maps them to proven refactoring techniques (Extract Method, Move Method, Strategy, Template Method).
  • Generates step-by-step, dependency-aware refactoring plans with rollback points and equivalence verification using existing tests.
  • Reports measurable quality improvements (complexity, coupling, duplication) to guide safer evolution across repositories.

Quick Start

Provide the target codebase and request an incremental, safe refactoring plan to begin a step-by-step improvement session.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I refactor long methods and large classes safely?

To refactor long methods and large classes safely, this Skill prescribes an incremental plan with rollback points and equivalence verification using existing tests to ensure behavior remains unchanged throughout the transformation process.

What is the best way to eliminate duplicated logic and switch-based branching in my codebase?

Eliminating duplicated logic and switch-based branching involves mapping these code smells to proven techniques like Extract Method or Strategy. This Skill generates step-by-step, dependency-aware refactoring plans to guide the safe removal of these structural issues.

Do I need existing tests to verify behavior equivalence during refactoring?

Yes, you need existing tests to verify behavior equivalence during refactoring. This Skill relies on your current test suite to validate that each incremental transformation step preserves the original functionality before moving forward.

Can I track code quality improvements like complexity and coupling during the refactoring process?

Yes, you can track code quality improvements like complexity and coupling during the refactoring process. This Skill reports measurable quality metrics throughout, providing guidance to monitor duplication, complexity, and coupling changes step by step.

How do I generate a step-by-step refactoring plan with rollback points?

Generating a step-by-step refactoring plan with rollback points requires providing your target codebase to this Skill. It analyzes the code for smells and delivers a dependency-aware transformation plan, complete with rollback points for safe execution.