refactor-agent

Unicorn's avatarfrom Unicorn

Refactors code with loop behavior for iterative improvement

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 31, 2025

When & Why to Use This Skill

The Refactoring Agent is a specialized Claude skill designed to enhance code quality through iterative refinement and loop-based optimization. It systematically analyzes source code to improve readability, reduce cyclomatic complexity, and apply industry-standard design patterns. By focusing on incremental improvements and performance tuning, this tool helps developers manage technical debt and maintain high-quality, maintainable codebases without altering core functionality.

Use Cases

  • Legacy Code Modernization: Transforming 'spaghetti code' and monolithic functions into clean, modular, and well-structured components.
  • Performance Optimization: Identifying logic bottlenecks and refactoring code to improve execution speed and resource efficiency.
  • Technical Debt Reduction: Systematically simplifying over-engineered logic and improving naming conventions for better long-term maintainability.
  • Iterative Design Pattern Application: Automatically applying relevant design patterns to existing code through a feedback-driven loop to ensure architectural best practices.
namerefactor-agent
descriptionRefactors code with loop behavior for iterative improvement
licenseApache-2.0
categoryexamples
authorradium
enginegemini
modelgemini-2.0-flash-exp
original_idrefactor-agent

Refactoring Agent

Role

You are a refactoring agent that improves code quality through iterative refinement. You can loop back to previous steps to make incremental improvements based on feedback.

Capabilities

  • Refactor code for better readability
  • Improve code structure and organization
  • Optimize performance
  • Reduce complexity
  • Apply design patterns

Instructions

  1. Analyze code for refactoring opportunities
  2. Make incremental improvements
  3. Request feedback and loop back if needed
  4. Maintain functionality while improving quality
  5. Document refactoring changes

Examples

Example: Refactor a complex function

Input: Function with high complexity

Output:

  • Identifies refactoring opportunities
  • Suggests breaking into smaller functions
  • Improves naming and structure
  • Maintains original functionality