Skip to content
Back to skills

Refactor Suggester

ASecurity

Identifies code smells and provides concrete refactoring suggestions with diffs

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 11, 2026
ai-agentsgoexpressrefactoring

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add NAME0x0/CLAUDE_SETUP --skill refactor-suggester --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor Suggester?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Refactor Suggester
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/name0x0-refactor-suggester/badge)](https://www.skillsdirectory.com/skills/name0x0-refactor-suggester)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: refactor-suggester
description: Identifies code smells and provides concrete refactoring suggestions with diffs
triggers:
  - /refactor-suggester
  - /refactor
  - /improve-code
---

# Instructions

When this skill is invoked, analyze code for improvement opportunities and provide actionable refactoring suggestions.

## Process

1. **Analyze Code Structure**:
   - Read target file(s) completely
   - Calculate function/method lengths
   - Identify class sizes and responsibilities
   - Map dependencies and coupling

2. **Detect Code Smells**:

   **Complexity Issues**:
   - Long methods (>20 lines)
   - Deep nesting (>3 levels)
   - High cyclomatic complexity (>10)
   - Too many parameters (>4)
   - Large classes (>300 lines)

   **Duplication**:
   - Copy-pasted code blocks
   - Similar logic in multiple places
   - Repeated patterns that could be abstracted

   **Coupling & Cohesion**:
   - Feature envy (method uses other class's data extensively)
   - Inappropriate intimacy between classes
   - God classes/functions doing too much
   - Shotgun surgery (one change requires many file edits)

   **Naming & Clarity**:
   - Unclear variable/function names
   - Magic numbers without constants
   - Comments explaining "what" instead of code being self-documenting

3. **Propose Refactorings**:

   For each smell, suggest specific patterns:
   - **Extract Method**: For long functions
   - **Extract Class**: For god classes
   - **Replace Conditional with Polymorphism**: For complex switch/if chains
   - **Introduce Parameter Object**: For too many parameters
   - **Replace Magic Number with Constant**: For literals
   - **Compose Method**: For improving readability
   - **Extract Variable**: For complex expressions

4. **Generate Diffs**:
   Show before/after for each suggestion

## Output Format

```markdown
## Refactoring Analysis

**File**: path/to/file.js
**Overall Health**: 6/10

### Issues Found

#### 1. [Smell Type] - [Location]
**Severity**: High/Medium/Low
**Current Code**:
```[lang]
[problematic code]
```

**Suggested Refactoring**: [Pattern name]
**Refactored Code**:
```[lang]
[improved code]
```

**Benefits**: [Why this is better]

---

### Summary
- 3 High priority refactorings
- 5 Medium priority improvements
- Estimated complexity reduction: 40%
```

## Enhancements

- Calculate before/after complexity metrics
- Detect patterns that could use design patterns
- Suggest incremental refactoring order (safest first)
- Identify opportunities for functional programming patterns
- Flag code that would benefit from dependency injection
- Offer to apply refactorings automatically

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.