code-refactoring-refactor-clean

Refactor code using clean code principles, SOLID patterns, and incremental improvement plans.

1|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/Hamzaoui-Louai/LEAN-gym-dashboard-frontend --skill code-refactoring-refactor-clean-hamzaoui-louai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-refactoring-refactor-clean
Source: https://github.com/Hamzaoui-Louai/LEAN-gym-dashboard-frontend/tree/main/.opencode/skills/clean%20code%20skills/code-refactoring-refactor-clean
Command: npx skills add https://github.com/Hamzaoui-Louai/LEAN-gym-dashboard-frontend --skill code-refactoring-refactor-clean-hamzaoui-louai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It helps developers untangle hard-to-maintain code by identifying code smells, SOLID violations, and performance issues, then producing a prioritized refactoring plan with concrete before/after examples. ## Core Features & Use Cases - Code Smell Detection: Identifies long methods, large classes, duplication, dead code, magic numbers, and tight coupling. - SOLID Refactoring Patterns: Provides concrete before/after examples for SRP, OCP, LSP, ISP, and DIP in Python, TypeScript, Java, and Go. - Prioritized Refactoring Plan: Uses ROI analysis and a technical debt decision tree to order changes by impact, effort, and risk. - Use Case: Given a 500-line monolithic order processing class, the skill decomposes it into validators, repositories, and services with dependency injection, plus tests and a migration guide. ## Quick Start Ask the AI to refactor the attached module using clean code principles and provide a prioritized plan with tests.

Frequently Asked Questions about code-refactoring-refactor-clean

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor legacy code without breaking existing behavior?

Apply changes in small incremental slices while keeping external behavior stable, and update tests after each step. The skill produces an ordered refactor plan with verification notes so regressions are caught early.

What are common code smells and how do I fix them?

Common code smells include long methods over 20 lines, large classes, duplicate blocks, magic numbers, and long parameter lists. Fixes include extracting methods, introducing parameter objects, replacing primitives with value objects, and moving methods to the class they envy.

How do I apply SOLID principles in Python or TypeScript?

Apply SOLID by giving each class one responsibility, using strategy interfaces for extensibility, and injecting dependencies through abstractions. The playbook includes concrete before/after examples for all five principles in Python, TypeScript, Java, and Go.

When should I not refactor code?

Avoid refactoring during change freezes, when only a one-line fix is needed, or when the request is documentation only. Also stop and ask for clarification if safety boundaries, permissions, or success criteria are missing.

How do I prioritize technical debt and refactoring work?

Prioritize using ROI: multiply business value by technical debt severity, then divide by effort and risk. Issues causing production bugs are critical, feature blockers are high priority, and rarely modified code with decent coverage stays in the backlog.