code-refactor

Detect anti-patterns and perform incremental refactors with tests.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/sunLeee/optimization --skill code-refactor-sunleee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-refactor
Source: https://github.com/sunLeee/optimization/tree/main/.claude/skills/quality/review/code-refactor
Command: npx skills add https://github.com/sunLeee/optimization --skill code-refactor-sunleee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Codebases often accumulate technical debt and anti-patterns, making maintenance painful and error-prone. A structured refactoring approach helps teams plan, validate, and execute safe changes.

Core Features & Use Cases

  • Code-review-driven issue identification and planning
  • Stepwise analysis, testing, and incremental changes
  • Safe guardrails: tests and validation to prevent regressions

Quick Start

Run /code-refactor on a target file to begin a guided refactor.

Frequently Asked Questions about code-refactor

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

FAQPage Schema
How do I refactor legacy code safely without introducing regressions?

Safe code refactoring requires a structured approach with incremental changes and verification through tests to prevent regressions. It uses code review to identify anti-patterns and validate each step before proceeding.

What is the best way to reduce technical debt and manage complexity in a software project?

Managing complexity and reducing technical debt involves detecting anti-patterns through code-review-driven issue identification. You apply stepwise analysis and incremental refactors to improve code quality and maintainability across projects of varying sizes.

How do I start a structured refactoring process on a specific file?

You start a structured refactoring process by running the guided refactor command on a target file. This initiates a code-review-driven analysis to identify issues, followed by stepwise testing and incremental changes to ensure safe execution.

Does code refactoring work for software projects of any size?

Structured code refactoring applies to software projects of varying sizes. It scales by breaking down refactors into incremental changes with tests, ensuring safe guardrails and validation are maintained regardless of the overall project complexity.

Why does code refactoring require integration with code review?

Code refactoring requires integration with code review to accurately identify anti-patterns and plan safe changes. This integration ensures the refactoring process remains structured, validating incremental changes and preventing regressions through continuous testing.