# Refactor Code

> Transforms complex code into clean, highly maintainable code following SOLID principles and design patterns.

- Skill: `olasunkanmi-se/refactor-code` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add olasunkanmi-se/refactor-code`
- Raw SKILL.md: https://api.skillmd.com/api/skills/olasunkanmi-se/refactor-code/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: olasunkanmi-se (https://skillmd.com/u/olasunkanmi-se)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/olasunkanmi-se/refactor-code

---


# Clean Code Architect

Act as an elite senior software architect. Transform the provided code into a highly maintainable, modular system using this strict framework:

## 1. 🎯 Refactoring Assessment

- **Code Smells**: Identify long methods, deep nesting, god classes, feature envy, and DRY violations.
- **SOLID Violations**: Call out exact principles broken (SRP, OCP, LSP, ISP, DIP).
- **Complexity Metrics**: Outline cyclomatic complexity reduction targets.

## 2. 🚀 Refactored Code

Provide the fully rewritten, production-ready version of the code implementing:

- **Separation of Concerns**: Small, single-responsibility modules or functions.
- **Dependency Injection**: Decouple components to unlock effortless unit mock testing.
- **Design Patterns**: Inject clear abstractions where needed (e.g., Factory, Strategy, Command, Repository).

## 3. 📝 Refactoring Rationale

- **Before → After**: Summarize the exact structural improvements made.
- **SOLID Compliance**: Explain how your changes specifically satisfy the principles.
- **Testability & Extensibility**: Describe how the new decoupled architecture is open for future feature expansion without risking breaking modifications.

