refactor

Identify and fix code quality issues through safe, incremental refactorings with QA validation.

18|4|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/chrisallenlane/claude-swe-workflows --skill refactor-chrisallenlane
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/chrisallenlane/claude-swe-workflows/tree/main/skills/refactor
Command: npx skills add https://github.com/chrisallenlane/claude-swe-workflows --skill refactor-chrisallenlane

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Iterative, autonomous refactoring workflow that improves code quality within an existing architecture by identifying tactical issues (DRY, dead code, naming, complexity) and applying safe, verifiable changes through SME implementation and QA verification until no opportunities remain.

Core Features & Use Cases

  • Autonomous, iterative refactoring loops that target technical debt while preserving behavior.
  • Prefers the least aggressive changes first and resurfaces opportunities after each pass.
  • Fresh agent instances for each pass to prevent context carryover, with atomic commits and built-in QA gates.
  • Supports scoped operation and multi-language SME assignment (Go, Docker, Makefile, GraphQL, etc.), plus fallback implementations where no SME exists.
  • Generates completion summaries and keeps documentation up to date via doc-review.
  • Real-world use: cleanup dead code, DRY improvements, and simplification of complex constructs across a codebase.

Quick Start

Start the /refactor workflow to initiate an autonomous loop that discovers, implements, and verifies code quality improvements until no opportunities remain.

Frequently Asked Questions about refactor

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

FAQPage Schema
How can I autonomously refactor code to fix technical debt while preserving behavior?

Autonomous refactoring iteratively identifies tactical code quality issues like DRY violations and dead code, applying safe incremental changes with QA verification. The workflow loops with fresh scanner instances, implements fixes, and validates behavior until no opportunities remain.

What is the safest way to automate DRY improvements and dead code cleanup across a multi-language codebase?

Safe code cleanup automation prefers the least aggressive refactoring changes first, resurfacing opportunities after each pass. It assigns multi-language SME implementations for Go, Docker, Makefile, and GraphQL, using fallback implementations where no SME exists to ensure coverage.

How do I start an iterative refactoring loop that scans the entire codebase for complexity issues?

Starting an iterative refactoring loop initiates an autonomous workflow that discovers, implements, and verifies code quality improvements. The process scans the entire codebase respecting any defined scope, surfaces opportunities by risk level, and loops until all issues are resolved.

Does autonomous refactoring support atomic git commits and QA validation for each change?

Yes, autonomous refactoring coordinates atomic git commits and built-in QA gates for each change. Fresh agent instances prevent context carryover between passes, ensuring every incremental refactoring is independently verified before being committed.

Can I scope automated code quality improvements to specific directories instead of the full codebase?

Yes, the refactoring workflow supports scoped operation to target specific directories or modules instead of the full codebase. This allows focused technical debt reduction and complexity simplification within defined architectural boundaries while maintaining safety.

When should I avoid using an autonomous refactoring workflow for code quality improvements?

You should avoid autonomous refactoring when architectural changes are needed rather than tactical fixes, as the workflow specifically targets DRY, dead code, naming, and complexity issues within existing architectures rather than structural redesigns or behavior modifications.