refactor-assistant

Analyze source code to identify smells and propose refactoring opportunities.

Updated Sep 5, 2021
One-click install
npx skills add https://github.com/a747895159/spring-cloud-study-alibaba --skill refactor-assistant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-assistant
Source: https://github.com/a747895159/spring-cloud-study-alibaba/tree/main/.agent/skills/refactor-assistant
Command: npx skills add https://github.com/a747895159/spring-cloud-study-alibaba --skill refactor-assistant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Codebases often accumulate smells such as long functions, duplicated logic, and unclear responsibilities, making maintenance costly and error-prone. This skill analyzes code, identifies refactoring opportunities, and provides concrete change recommendations to improve structure and readability.

Core Features & Use Cases

  • Identify refactoring opportunities such as extracting functions/classes, renaming entities, introducing parameter objects, replacing conditionals with polymorphism, removing dead code, and simplifying complex logic.
  • Provide rationale, impact estimation, and risk assessment for each proposed change to guide incremental adoption.
  • Use-case example: in a large module with long functions and duplicated logic, generate a step-by-step refactoring plan that preserves behavior and enables easier future changes.

Quick Start

Provide a concrete code change request and receive a ready-to-apply refactoring plan.

Frequently Asked Questions about refactor-assistant

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

FAQPage Schema
How do I identify code smells for refactoring in a large codebase?

Identify code smells by running static analysis to detect long functions, duplicated logic, and unclear responsibilities. This process pinpoints areas needing structural improvements to make maintenance less costly and error-prone.

What is the best way to plan incremental code refactoring without breaking existing behavior?

The best way to plan incremental code refactoring is to generate a step-by-step plan that includes rationale, impact estimation, and risk assessment for each change. This guides adoption while validating changes via tests to preserve behavior.

Can I use static analysis to find opportunities for extracting functions and classes?

Yes, static analysis finds opportunities for extracting functions and classes, introducing parameter objects, replacing conditionals with polymorphism, and removing dead code to improve overall code readability and structure.

How do I apply refactoring patterns to simplify complex logic in my source code?

Apply refactoring patterns by analyzing the source code to propose concrete changes. This provides ready-to-apply recommendations for simplifying complex logic and renaming entities to clarify their responsibilities.

Does code analysis for refactoring work on medium-to-large codebases with duplicated logic?

Yes, code analysis for refactoring is specifically applicable to medium-to-large codebases needing structural improvements across functions, classes, and modules to resolve duplicated logic and complex dependencies.