refactor-suggestion

Analyze PHP and TypeScript code for code smells and refactoring suggestions.

Updated Jun 19, 2023
One-click install
npx skills add https://github.com/JeroenJochems/modelwise --skill refactor-suggestion-jeroenjochems
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-suggestion
Source: https://github.com/JeroenJochems/modelwise/tree/main/.claude/skills/refactor-suggestion
Command: npx skills add https://github.com/JeroenJochems/modelwise --skill refactor-suggestion-jeroenjochems

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers identify and fix code smells, making codebases cleaner, more maintainable, and easier to change.

Core Features & Use Cases

  • Smell Detection: Analyzes code for common issues like long functions, duplicate code, and high coupling.
  • Prioritized Recommendations: Provides actionable refactoring suggestions ranked by severity and impact.
  • Use Case: You've inherited a large, complex codebase and need to understand where to start improving its quality. This Skill can scan the entire project and give you a prioritized list of the most critical areas to refactor.

Quick Start

Use the refactor-suggestion skill to analyze the file '/src/utils/helpers.js' for code smells.

Frequently Asked Questions about refactor-suggestion

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

FAQPage Schema
How do I identify code smells in a PHP or TypeScript codebase?

To identify code smells in PHP or TypeScript, you can analyze code for categories like Bloaters, OO Abusers, Change Preventers, Dispensables, and Couplers. This process detects issues such as long functions, duplicate code, and high coupling.

How do I prioritize refactoring tasks for a large inherited codebase?

You can prioritize refactoring tasks by generating reports that rank code smells by severity and impact. This provides an actionable, prioritized list of critical areas to refactor first, making large codebases easier to maintain.

Do I need test coverage before refactoring code?

Yes, assessing test coverage is a prerequisite for refactoring recommendations. Adequate test coverage ensures that your refactoring efforts do not introduce regressions while improving code quality.

What are the common categories of code smells to detect for clean code?

Common code smell categories include Bloaters, OO Abusers, Change Preventers, Dispensables, and Couplers. Detecting these specific categories helps developers fix structural issues and maintain clean code.

Can I get specific refactoring pattern suggestions for detected code smells?

Yes, analyzing code for smells provides suggested refactoring patterns tailored to the detected issues. These suggestions come with severity levels, locations, and descriptions to guide your code improvements.

Why does my code have high coupling and how do I fix it?

High coupling is a code smell often categorized under Couplers. You can fix it by applying suggested refactoring patterns provided after analysis, which target dependencies to make the codebase easier to change.