codebase-cleanup-refactor-clean

Refactor codebases by applying clean code principles and SOLID design patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Large codebases accumulate technical debt such as duplicated logic, long methods, and SOLID violations that slow down development and increase bug risk. This Skill analyzes code and produces a prioritized refactoring plan with concrete before/after implementations. ## Core Features & Use Cases - Code Smell Detection: Identifies long methods, duplicate code, dead code, magic numbers, and tight coupling across Python, TypeScript, Java, and Go. - SOLID Refactoring Patterns: Provides concrete before/after examples for all five SOLID principles plus common design patterns like Strategy, Factory, and Repository. - Prioritized Cleanup Plan: Uses an ROI framework and technical debt decision tree to rank refactoring targets by business value, effort, and risk. - Use Case: When preparing a legacy module for new feature work, run this Skill to get a step-by-step cleanup plan, refactored code samples, a test strategy, and a migration guide. ## Quick Start Ask the AI to analyze and refactor the provided code using clean code principles and SOLID patterns, then return a prioritized cleanup plan with tests.

Frequently Asked Questions about codebase-cleanup-refactor-clean

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

FAQPage Schema
How do I refactor a large legacy codebase with technical debt?

Start by identifying code smells like long methods, duplicate blocks, and tight coupling, then prioritize fixes using an ROI framework weighing business value against effort and risk. Break work into small, testable steps and validate each change with regression tests.

What are common code smells to look for during refactoring?

Common code smells include methods over 20 lines, classes over 200 lines, duplicate code blocks, dead code, magic numbers, long parameter lists, and feature envy. Each smell has a standard remedy such as method extraction, parameter objects, or moving methods to the class they depend on.

How do I apply SOLID principles when refactoring code?

Apply SOLID by giving each class one responsibility, using strategy interfaces for extensibility, respecting substitutability in inheritance, segregating fat interfaces, and depending on abstractions via dependency injection. The playbook includes concrete before/after examples for each principle.

When should I not refactor code?

Avoid refactoring when you only need a tiny targeted fix, when policy or deadlines block changes, or when the request is documentation-only. Large rewrites without agreed scope and test coverage also carry high regression risk.

What code quality metrics indicate refactoring is needed?

Warning signs include cyclomatic complexity above 10, methods over 20 lines, classes over 200 lines, test coverage below 60 percent, and duplication above 3 percent. Critical thresholds like complexity over 15 demand immediate decomposition.