# Refactoring Assistant

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-sourav15mukherjee-skillforge-free-skills-refactoring-assistant`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [sourav15mukherjee](https://agentstack.voostack.com/s/sourav15mukherjee)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [sourav15mukherjee](https://github.com/sourav15mukherjee)
- **Source:** https://github.com/sourav15mukherjee/skillforge-free-skills/tree/main/refactoring-assistant

## Install

```sh
agentstack add skill-sourav15mukherjee-skillforge-free-skills-refactoring-assistant
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## Refactoring Assistant

Identify code smells and apply systematic refactoring patterns to improve quality without changing behavior.

## Workflow

1. **Read and understand the code**
   Read the target file(s). Before refactoring, understand what the code does and identify its tests.

2. **Run existing tests**
   Ensure tests pass BEFORE any changes. If no tests exist, warn the user.

3. **Identify code smells**
   Look for:
   - **Long Method**: Functions over 30 lines → Extract Method
   - **Deep Nesting**: More than 3 levels → Early Return, Extract Method
   - **Duplicated Code**: Similar blocks in 2+ places → Extract and share
   - **Large Class**: Class with too many responsibilities → Extract Class
   - **Feature Envy**: Method uses another class's data more than its own → Move Method
   - **Primitive Obsession**: Using strings/numbers where objects fit → Replace with Value Object
   - **Switch Statements**: Complex conditionals → Replace with Polymorphism or Map
   - **Dead Code**: Unused functions, unreachable branches → Remove
   - **Magic Numbers**: Unexplained literals → Extract Constant

4. **Prioritize**
   Rank smells by impact:
   1. Bugs/correctness risks
   2. Readability blockers
   3. Maintainability issues
   4. Style preferences

5. **Apply refactorings one at a time**
   Make each change independently. Run tests after each step.

6. **Verify**
   Run the full test suite. Behavior must be identical.

## Rules

- NEVER change behavior — refactoring is structure-only
- Always run tests before AND after
- Make one refactoring at a time, not all at once
- Explain each refactoring: what pattern, why it helps
- If tests don't exist, suggest writing them first
- Don't refactor code that's about to be deleted or rewritten
- Prefer small, reversible changes over large restructurings

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [sourav15mukherjee](https://github.com/sourav15mukherjee)
- **Source:** [sourav15mukherjee/skillforge-free-skills](https://github.com/sourav15mukherjee/skillforge-free-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-sourav15mukherjee-skillforge-free-skills-refactoring-assistant
- Seller: https://agentstack.voostack.com/s/sourav15mukherjee
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
