# Refactor

> Refactor is an open-source agent skill for developer tools. Runs multi-round refactoring on branch changes, verifying tests and lint each round. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/kzytateishi/spikeee-plugins-marketplace/tree/main/plugins/dev-workflow/skills/refactor
- **Repository:** https://github.com/kzytateishi/spikeee-plugins-marketplace
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** refactor
- **Collection:** https://github.com/kzytateishi/spikeee-plugins-marketplace
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill walks the agent through refactoring the files changed on a branch against its base branch. It works in at least three passes: structural cleanup such as removing duplication and extracting methods, then readability work on names and nesting, then checks against project conventions. Each pass is followed by running the project's tests and lint, and the agent keeps going while it still finds improvements.

The skill detects the base branch from the git remote or common branch names, collects the diff, and reads CLAUDE.md or AGENTS.md when present to pick up local conventions. Test code is refactored alongside source code. Behavior is meant to stay the same, and the agent is asked to note correctness issues it spots without fixing them, collecting them for a separate code review step.

It expects a git repository with a configured base branch and a project whose test and lint commands can be found in its configuration files. The output is a before-and-after report, and the skill is intended to run after implementation and before code review.

## When your agent uses it

> Run iterative refactoring on changed files (minimum 3 rounds). Round 1: structural improvements (DRY, method extraction). Round 2: readability (naming, nesting reduction). Round 3: convention compliance. Continues until no improvements found. Generates a before/after report. Use after implementation, before code review.

## What it can access

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

- [Instructions only, no scripts](https://github.com/kzytateishi/spikeee-plugins-marketplace/tree/HEAD/plugins/dev-workflow/skills/refactor)
- [License: MIT](https://github.com/kzytateishi/spikeee-plugins-marketplace/tree/HEAD/plugins/dev-workflow/skills/refactor)

## Features

- **Multi-round refactoring passes:** Runs structural, readability and convention rounds in sequence, repeating until no further changes are found.
- **Changed-file detection:** Identifies the base branch and collects the diff so only files touched on the branch are refactored.
- **Test and lint verification:** Runs the project's test and lint commands after each round to confirm behavior is preserved.
- **Convention alignment:** Checks code against CLAUDE.md, AGENTS.md and patterns used in sibling files.
- **Before and after report:** Produces a summary of the changes made, plus a list of issues flagged for later review.

## Good for

- Clean up a feature branch before opening a pull request
- Remove duplicated code from recently implemented changes
- Improve naming and reduce nesting in files I just edited
- Check my branch changes against the project's coding conventions

## Install

### Claude Code

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

```sh
/plugin marketplace add kzytateishi/spikeee-plugins-marketplace
/plugin install dev-workflow@spikeee-plugins
```

Or copy only this skill to `~/.claude/skills/refactor`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/kzytateishi/spikeee-plugins-marketplace.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/refactor &&
cp -R "$tmp/plugins/dev-workflow/skills/refactor" ~/.claude/skills/refactor &&
rm -rf "$tmp"
```

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

### Codex

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/kzytateishi/spikeee-plugins-marketplace.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/refactor &&
cp -R "$tmp/plugins/dev-workflow/skills/refactor" ~/.agents/skills/refactor &&
rm -rf "$tmp"
```

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

### Cursor

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/kzytateishi/spikeee-plugins-marketplace.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/refactor &&
cp -R "$tmp/plugins/dev-workflow/skills/refactor" ~/.cursor/skills/refactor &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/refactor` 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/kzytateishi/spikeee-plugins-marketplace.git --path plugins/dev-workflow/skills/refactor
```

Or copy the folder to `~/.gemini/skills/refactor` yourself.

### VS Code

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/kzytateishi/spikeee-plugins-marketplace.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/refactor &&
cp -R "$tmp/plugins/dev-workflow/skills/refactor" ~/.copilot/skills/refactor &&
rm -rf "$tmp"
```

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

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/kzytateishi/spikeee-plugins-marketplace.git
```

Then copy `spikeee-plugins-marketplace/plugins/dev-workflow/skills/refactor` into your agent's skills folder as `refactor`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Refactor need to run?

A git repository with a base branch it can detect, and a project with discoverable test and lint commands. It reads CLAUDE.md and AGENTS.md when they exist.

### Does Refactor change how the code behaves?

The skill instructs the agent not to change behavior, only structure, and to run tests after each round. Logic bugs it notices are listed for review rather than fixed.

### When should Refactor be used?

The skill describes running after implementation and before code review.

### How do I install Refactor in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/refactor to use it in all your projects, or to .claude/skills/refactor in one project. Or install the dev-workflow plugin, which includes it: /plugin marketplace add kzytateishi/spikeee-plugins-marketplace, then /plugin install dev-workflow@spikeee-plugins.

### Does Refactor 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 Refactor?

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 Refactor?

The closest alternatives to Refactor are Branch refactor planner, Code simplifier, Review workflow, Code review and Refactoring guide.

## Where this comes from

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

## Alternatives

- [Branch refactor planner](https://ai-powered.com/skills/branch-refactor-planner): Branch refactor planner is an open-source agent skill for developer tools.
- [Code simplifier](https://ai-powered.com/skills/code-simplifier): Code simplifier is an open-source agent skill for developer tools.
- [Review workflow](https://ai-powered.com/skills/review-workflow): Review workflow is an open-source agent skill for developer tools.
- [Code review](https://ai-powered.com/skills/code-review-kzytateishi): Code review is an open-source agent skill for developer tools.
- [Refactoring guide](https://ai-powered.com/skills/refactoring-guide): Refactoring guide is an open-source agent skill for developer tools.
- [K code simplifier](https://ai-powered.com/skills/k-code-simplifier): K code simplifier is an open-source agent skill for developer tools.
- [Quality review](https://ai-powered.com/skills/quality-review): Quality review 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/refactor-kzytateishi
