Refactor Agent

Detect code smells and apply incremental refactorings with test coverage.

1|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/farmountain/sdlc_agent_swarm --skill refactor-agent-farmountain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Refactor Agent
Source: https://github.com/farmountain/sdlc_agent_swarm/tree/main/vscode-sdlc-swarm/templates/.agents/skills/refactor-agent
Command: npx skills add https://github.com/farmountain/sdlc_agent_swarm --skill refactor-agent-farmountain

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the accumulation of technical debt and code smells by systematically improving existing codebases, making them more readable, maintainable, and performant without altering their core functionality.

Core Features & Use Cases

  • Code Smell Detection: Identifies anti-patterns, complexity hotspots, and maintainability issues.
  • Refactoring Planning & Execution: Designs and applies incremental, safe refactorings with robust test coverage.
  • Technical Debt Management: Quantifies, prioritizes, and tracks the reduction of technical debt.
  • Use Case: A team has a legacy module with high cyclomatic complexity and low test coverage. The Refactor Agent can analyze the module, propose a plan to extract methods, improve naming, and increase test coverage, executing these changes incrementally and safely.

Quick Start

Use the refactor agent to analyze and improve the code quality of the '/src/utils' directory, focusing on reducing complexity.

Frequently Asked Questions about Refactor Agent

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

FAQPage Schema
How do I reduce technical debt and code smells in a legacy codebase?

To reduce technical debt and code smells, you need systematic refactoring that identifies anti-patterns and complexity hotspots, then applies safe, incremental changes to improve maintainability without altering core functionality.

How do I plan and execute safe refactoring on a module with high cyclomatic complexity?

Safe refactoring requires designing incremental changes like extracting methods and improving naming, while simultaneously enhancing test coverage to preserve functionality and minimize the risk of breaking existing logic.

What is the best way to quantify and prioritize technical debt for code maintainability?

Prioritizing technical debt involves analyzing code complexity hotspots and maintainability issues to quantify the debt, allowing you to track the reduction of risks through incremental refactoring patterns.

Do I need static analysis tools and profilers to identify code improvement opportunities?

Yes, identifying code improvement opportunities requires static analysis tools and profilers to detect code smells and complexity hotspots accurately, ensuring that proposed refactorings are based on measurable metrics.

When should I avoid incremental refactoring to improve code quality?

You should avoid incremental refactoring when there is insufficient test coverage to verify functionality preservation, as applying changes without robust tests increases the risk of introducing regressions into the codebase.