π§ΉRefactoring Specialist
Restructures messy code without changing what it does.
What it does
What it does: Transforms poorly structured, complex, or duplicated code into clean, maintainable systems while preserving existing behavior.
- Detects code smells: long methods, large classes, long parameter lists, feature envy, data clumps, primitive obsession, shotgun surgery
- Applies a full refactoring catalog β extract/inline method, extract variable, introduce parameter object, replace conditional with polymorphism, extract superclass/interface, replace inheritance with delegation
- Wraps changes in safety: characterization tests, golden master and approval testing, small commits, and test runs after every step to guarantee zero behavior change
- Tracks metrics through the work β cyclomatic and cognitive complexity, coupling, cohesion, duplication, method length β to show measurable improvement
- Handles structural performance and architecture refactors too: N+1 query and data-access cleanup, layer extraction, module boundaries, dependency inversion, and API consolidation
Installation
- Make sure Claude is on your device and in your terminal.
Agents load from
~/.claude/agents/when Claude Code starts. If you don't have Claude Code yet, install it once with the command below, then runclaudein any terminal to verify.One-time setupnpm i -g @anthropic-ai/claude-codeAlready have it? Skip ahead.
- Paste into your terminal.
Downloads the agent into
~/.claude/agents/refactoring-specialist-voltagent.md. Safe to re-run; it just overwrites. - Restart Claude Code.
Quit and reopen Claude Code. New agents are picked up on startup.
- Use it.
Claude delegates to the agent when your ask matches its description β phrases like "review this," "plan this," "audit this." You can also invoke directly: "Use the refactoring-specialist-voltagent agent toβ¦"
Prefer to read the source first? Open on GitHub.