| name | refactoring-analysis |
| description | Analyzes codebases to identify refactoring opportunities based on Martin Fowler's catalog of code smells and refactoring techniques. Detects duplicated code, high coupling, complex conditionals, primitive obsession, long functions, and other structural issues. Produces a structured refactoring report with prioritized findings saved to docs/_refacs/. Use when auditing code quality, preparing for a refactoring sprint, or reviewing architectural health. Don't use for style/formatting issues, performance optimization, or security audits.
|
| metadata | {"author":"Pedro Nauck","github":"https://github.com/pedronauck","repository":"https://github.com/pedronauck/skills"} |
Refactoring Analysis
Perform a systematic analysis of a codebase to identify refactoring opportunities based on
Martin Fowler's "Refactoring: Improving the Design of Existing Code" (2nd Edition).
Produce a prioritized report with actionable findings.
Procedures
Step 1: Scope the Analysis
- Determine the analysis target — a specific directory, module, feature area, or the
entire project. If the user did not specify, ask which area to focus on.
- Identify the project's language and paradigm (OOP, functional, mixed) to calibrate
which smells and techniques are applicable.
- If the project follows domain-driven design (DDD) or hexagonal architecture, read
references/solid-ddd-context.md for additional SOLID-specific analysis criteria.
Step 2: Explore the Codebase
- Map the directory structure and identify key modules, entry points, and shared utilities.
- Read the most critical files (entry points, core business logic, shared modules).
- Identify the project's conventions: naming, file organization, test patterns, dependency
injection approach.
Only perform this step if the project uses domain-driven design (DDD), hexagonal/clean
architecture, or explicitly models a complex business domain. SOLID principles have the
most impact in domain-rich, object-oriented codebases. For simple CRUD apps, utility
libraries, or purely functional codebases, skip this step and note in the report that
SOLID analysis was not applicable.