# Refactoring guide

> Refactoring guide is an open-source agent skill for developer tools. Plans safe, test-backed refactorings using Martin Fowler's catalog of named techniques. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/tansuasici/claude-code-kit/tree/main/.claude/skills/refactoring-guide
- **Repository:** https://github.com/tansuasici/claude-code-kit
- **GitHub stars:** 6
- **License:** MIT
- **Skill name:** refactoring-guide
- **Collection:** https://github.com/tansuasici/claude-code-kit
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill guides an agent through restructuring code by mapping common code smells to named refactorings from Martin Fowler's catalog. It groups techniques into extract, simplify and reorganize families, so the agent can match a problem such as a long function, nested conditionals or shotgun surgery to a specific fix.

Before proposing changes, the skill has the agent read the target code, locate existing tests, map what depends on it and check for open pull requests or in-progress work. Each proposed refactoring is then rated for risk, test coverage, blast radius, reversibility and whether it can be done incrementally, and turned into a plan with preconditions, atomic steps, verification and expected end state.

The output follows a fixed markdown template with a target summary, current issues, proposed refactorings, execution order and a safety checklist. The skill is a plain instruction file with no scripts. It assumes the agent can run the project's tests and typecheck between steps.

## When your agent uses it

> Fowler-based refactoring recommendations with specific techniques, risk assessment, and step-by-step plans. Use when code needs restructuring and you want a safe execution plan. To first locate structural issues use /architecture-review.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/tansuasici/claude-code-kit/tree/HEAD/.claude/skills/refactoring-guide)
- [License: MIT](https://github.com/tansuasici/claude-code-kit/tree/HEAD/.claude/skills/refactoring-guide)

## Features

- **Code smell mapping:** Matches smells such as long functions, feature envy and data clumps to named Fowler refactorings.
- **Risk assessment:** Rates each proposed change by risk level, test coverage, blast radius and reversibility.
- **Step-by-step execution plan:** Gives preconditions, atomic steps, verification commands and expected results for each refactoring.
- **Test-first safeguards:** Requires existing tests to be identified or written before any behavior-preserving change.
- **Dependency and PR checks:** Has the agent map dependent code and avoid areas with open pull requests or unfinished features.
- **Structured report template:** Produces a consistent markdown report with target, issues, refactorings, ordering and a safety checklist.

## Good for

- Plan a safe refactor of a bloated module into smaller classes
- Turn audit findings into ordered, committable refactoring steps
- Replace a growing switch on type with polymorphism without changing behavior
- Prepare a messy area of code for a new feature with cleaner foundations
- Assess the risk of splitting a large interface before editing it

## Install

### Claude Code

This skill ships in the `claude-code-kit` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add tansuasici/claude-code-kit
/plugin install claude-code-kit@claude-code-kit
```

Or copy only this skill to `~/.claude/skills/refactoring-guide`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tansuasici/claude-code-kit.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/refactoring-guide &&
cp -R "$tmp/.claude/skills/refactoring-guide" ~/.claude/skills/refactoring-guide &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/refactoring-guide` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/refactoring-guide` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tansuasici/claude-code-kit.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/refactoring-guide &&
cp -R "$tmp/.claude/skills/refactoring-guide" ~/.agents/skills/refactoring-guide &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/refactoring-guide` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/refactoring-guide` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tansuasici/claude-code-kit.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/refactoring-guide &&
cp -R "$tmp/.claude/skills/refactoring-guide" ~/.cursor/skills/refactoring-guide &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/refactoring-guide` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/tansuasici/claude-code-kit.git --path .claude/skills/refactoring-guide
```

Or copy the folder to `~/.gemini/skills/refactoring-guide` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/refactoring-guide`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tansuasici/claude-code-kit.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/refactoring-guide &&
cp -R "$tmp/.claude/skills/refactoring-guide" ~/.copilot/skills/refactoring-guide &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/refactoring-guide` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/tansuasici/claude-code-kit.git
```

Then copy `claude-code-kit/.claude/skills/refactoring-guide` into your agent's skills folder as `refactoring-guide`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Refactoring guide trigger?

It is invoked with /refactoring-guide when code needs restructuring and a safe execution plan is wanted. The skill suggests running /architecture-review first to locate structural issues.

### Does Refactoring guide change code directly?

The skill is focused on recommendations and a plan. It asks that each refactoring be applied stepwise, with tests run and verified between steps.

### What should be in place before using Refactoring guide?

The skill's core rule is to refactor only when current behavior is understood and tested. If tests are missing, its notes say to write them first.

### Does Refactoring guide need any scripts or extra tools?

The folder contains only the SKILL.md file and no scripts. The plan assumes the project's tests and typecheck can be run between steps.

### How do I install Refactoring guide in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/refactoring-guide to use it in all your projects, or to .claude/skills/refactoring-guide in one project. Or install the claude-code-kit plugin, which includes it: /plugin marketplace add tansuasici/claude-code-kit, then /plugin install claude-code-kit@claude-code-kit.

### Does Refactoring guide run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Refactoring guide?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Refactoring guide?

The closest alternatives to Refactoring guide are Refactor, Refactor plan, Refactor, Code simplification and Code simplification.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Refactor](https://ai-powered.com/skills/refactor): Refactor is an open-source agent skill for developer tools.
- [Refactor plan](https://ai-powered.com/skills/refactor-plan): Refactor plan is an open-source agent skill for developer tools.
- [Refactor](https://ai-powered.com/skills/refactor-zerotechdebt): Refactor is an open-source agent skill for developer tools.
- [Code simplification](https://ai-powered.com/skills/code-simplification): Code simplification is an open-source agent skill for developer tools.
- [Code simplification](https://ai-powered.com/skills/code-simplification-ajyadav013): Code simplification is an open-source agent skill for developer tools.
- [Go refactoring](https://ai-powered.com/skills/go-refactoring): Go refactoring is an open-source agent skill for developer tools.
- [Refactor seams](https://ai-powered.com/skills/refactor-seams): Refactor seams is an open-source agent skill for developer tools.
- [Refactor](https://ai-powered.com/skills/refactor-duthaho): Refactor is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/refactoring-guide
