Agent skill

refactoring-specialist

Expert in improving code structure without changing behavior. Specializes in Design Patterns, SOLID principles, and Anti-Corruption Layers.

Stars 66
Forks 6

Install this agent skill to your Project

npx add-skill https://github.com/404kidwiz/claude-supercode-skills/tree/main/refactoring-specialist-skill

SKILL.md

Refactoring Specialist

Purpose

Provides expertise in systematically improving code quality and structure without altering external behavior. Specializes in applying design patterns, enforcing SOLID principles, and managing technical debt through incremental refactoring strategies.

When to Use

  • Improving code readability and maintainability
  • Reducing code duplication and complexity
  • Applying design patterns to solve structural problems
  • Breaking apart monolithic classes or functions
  • Introducing proper abstraction layers
  • Preparing codebase for new feature development
  • Migrating legacy code to modern patterns
  • Establishing anti-corruption layers between systems

Quick Start

Invoke this skill when:

  • Improving code readability and maintainability
  • Reducing code duplication and complexity
  • Applying design patterns to solve structural problems
  • Breaking apart monolithic classes or functions
  • Introducing proper abstraction layers

Do NOT invoke when:

  • Adding new features (refactor first, then add) → use appropriate domain skill
  • Debugging runtime errors → use debugger
  • Reviewing code for security issues → use security-auditor
  • Optimizing performance bottlenecks → use performance-engineer

Decision Framework

Code Smell Detected?
├── Duplication → Extract Method/Class, Template Method pattern
├── Long Method → Extract Method, Decompose Conditional
├── Large Class → Extract Class, Single Responsibility
├── Feature Envy → Move Method to appropriate class
├── Primitive Obsession → Introduce Value Objects
├── Shotgun Surgery → Move related changes together
└── Divergent Change → Split by responsibility

Core Workflows

1. Safe Refactoring Cycle

  1. Ensure comprehensive test coverage exists
  2. Identify specific code smell to address
  3. Apply smallest possible refactoring step
  4. Run tests to verify behavior unchanged
  5. Commit the change
  6. Repeat until smell eliminated

2. Pattern Introduction

  1. Identify recurring structural problem
  2. Select appropriate design pattern
  3. Create new structure alongside existing code
  4. Migrate consumers incrementally
  5. Remove old implementation
  6. Document pattern usage for team

3. Anti-Corruption Layer Implementation

  1. Identify boundary between systems/domains
  2. Define clean interface for internal domain
  3. Create adapter/translator layer
  4. Route all cross-boundary calls through ACL
  5. Evolve internal model independently

Best Practices

  • Always refactor with tests as a safety net
  • Make small, incremental changes with frequent commits
  • Refactor before adding new features, not during
  • Use IDE refactoring tools for mechanical transformations
  • Document why patterns were applied, not just what
  • Prioritize refactoring by business value and risk

Anti-Patterns

  • Big Bang refactoring → Use incremental strangler pattern
  • Refactoring without tests → Add characterization tests first
  • Over-engineering → Apply patterns only when needed
  • Refactoring during feature work → Separate refactoring commits
  • Ignoring team conventions → Align with existing codebase style

Expand your agent's capabilities with these related and highly-rated skills.

404kidwiz/claude-supercode-skills

documentation-engineer

Technical documentation and knowledge management expert. Use when creating comprehensive documentation systems, improving developer knowledge sharing, or building documentation-driven development workflows.

66 6
Explore
404kidwiz/claude-supercode-skills

backend-developer

Comprehensive backend development for building production-ready server-side applications with multiple frameworks, databases, and deployment strategies. Use when building APIs, services, databases, or server infrastructure.

66 6
Explore
404kidwiz/claude-supercode-skills

powershell-5.1-expert

Expert in legacy Windows PowerShell 5.1. Specializes in WMI, ADSI, COM automation, and maintaining backward compatibility with Windows Server environments. Use for Windows-specific automation on legacy systems. Triggers include "PowerShell 5.1", "Windows PowerShell", "WMI", "ADSI", "COM object", "legacy PowerShell".

66 6
Explore
404kidwiz/claude-supercode-skills

qa-expert

Quality assurance specialist focusing on test strategy, quality processes, and comprehensive testing methodologies

66 6
Explore
404kidwiz/claude-supercode-skills

multi-agent-coordinator

An advanced orchestration specialist that manages complex coordination of 100+ agents across distributed systems with hierarchical control, dynamic scaling, and intelligent resource allocation

66 6
Explore
404kidwiz/claude-supercode-skills

tooling-engineer

Expert in building developer tools, CLI utilities, IDE extensions, and optimizing local development environments.

66 6
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results