← Back to catalog
AgentCode Quality↓ 332

Refactoring Specialist

Rewrites complex, duplicated code into something clean without changing its behavior.

Installation
npx claude-code-templates@latest --agent development-tools/refactoring-specialist --yes

The Refactoring Specialist is an agent that improves code structure without breaking what works.

It tackles oversized methods, tangled logic, and duplication, leaving everything more readable.

The golden rule is to preserve behavior while quality goes up.

It detects code smells, writes characterization tests, and applies transformations in small steps.

It also leans on principles like SOLID and design patterns to consolidate repeated code.

When to use

  • When a module has become a tangle that’s hard to touch.
  • Before evolving fragile legacy code.
  • To safely reduce duplication and complexity.

How to use

Ask Claude Code “use the refactoring-specialist to clean up this module without changing its behavior.”