# Branch refactor planner

> Branch refactor planner is an open-source agent skill for developer tools. Reviews a branch's changes against its base and writes a prioritized refactor plan. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/tonyghiani/ai-essentials/tree/main/skills/branch-refactor-planner
- **Repository:** https://github.com/tonyghiani/ai-essentials
- **GitHub stars:** 7
- **License:** MIT
- **Skill name:** branch-refactor-planner
- **Collection:** https://github.com/tonyghiani/ai-essentials
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill has the agent go through every file changed on the current branch compared with its base branch, reading each file in full rather than only the diff hunks. It checks naming, duplication, over-engineering, declarative style, edge cases, test quality, type safety, error handling and consistency, then groups its findings into critical, important and minor action items with file and line references.

The workflow starts by finding the merge base with main, falling back to master or a branch the user names, then lists the changed files and the full diff. It also looks for project instruction files such as AGENTS.md or CLAUDE.md and applies any rules they contain. The output is a plan and not a bug report, so it focuses on code quality rather than defect hunting.

The skill is plain instructions with no scripts. It expects a git repository with a base branch to compare against and relies on the agent's ability to run git commands and read source files.

## When your agent uses it

> Critically review all code changes on the current branch against the base branch, identify improvement opportunities across naming, structure, DRY/KISS/YAGNI, declarative style, self-documenting code, edge cases, testing, and general best practices, then produce a categorized refactoring plan with prioritized action items. Produces a plan, not a bug review. Use when the user asks for a "refactor plan", a "code quality review", or to "clean up this branch".

## What it can access

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

- [Instructions only, no scripts](https://github.com/tonyghiani/ai-essentials/tree/HEAD/skills/branch-refactor-planner)
- [License: MIT](https://github.com/tonyghiani/ai-essentials/tree/HEAD/skills/branch-refactor-planner)

## Features

- **Branch-wide changeset review:** Compares every changed file against the base branch and reads each one in full for context.
- **Quality dimension checklist:** Walks through naming, DRY, KISS, YAGNI, edge cases, testing and type safety for each file.
- **Prioritized action items:** Sorts findings into critical, important and minor groups, each with a file and line reference.
- **Project rules awareness:** Incorporates repository agent instruction files such as AGENTS.md or CLAUDE.md into the review.
- **Test quality checks:** Flags no-op assertions, duplicate coverage and tests that add no value.

## Good for

- Create a refactor plan for my feature branch before opening a pull request
- Run a code quality review on everything changed since main
- Clean up this branch and tell me what to fix first
- Find duplicated logic and naming drift across my changes

## Install

### Claude Code

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

```sh
/plugin marketplace add tonyghiani/ai-essentials
/plugin install ai-essentials@ai-essentials
```

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/branch-refactor-planner &&
cp -R "$tmp/skills/branch-refactor-planner" ~/.claude/skills/branch-refactor-planner &&
rm -rf "$tmp"
```

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

### Codex

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/branch-refactor-planner &&
cp -R "$tmp/skills/branch-refactor-planner" ~/.agents/skills/branch-refactor-planner &&
rm -rf "$tmp"
```

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

### Cursor

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/branch-refactor-planner &&
cp -R "$tmp/skills/branch-refactor-planner" ~/.cursor/skills/branch-refactor-planner &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/branch-refactor-planner` 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/tonyghiani/ai-essentials.git --path skills/branch-refactor-planner
```

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

### VS Code

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

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/branch-refactor-planner &&
cp -R "$tmp/skills/branch-refactor-planner" ~/.copilot/skills/branch-refactor-planner &&
rm -rf "$tmp"
```

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

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/tonyghiani/ai-essentials.git
```

Then copy `ai-essentials/skills/branch-refactor-planner` into your agent's skills folder as `branch-refactor-planner`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to run?

It needs a git repository with a base branch such as main, master, or one the user specifies, since it runs git merge-base and git diff commands against it.

### Does Branch refactor planner change my code?

No. The skill produces a categorized refactoring plan with action items and does not modify files.

### Is Branch refactor planner a bug finder?

No. The skill states it produces a plan, not a bug review, and focuses on code quality dimensions.

### When does Branch refactor planner trigger?

It is meant for requests such as a refactor plan, a code quality review, or asking to clean up the branch.

### How do I install Branch refactor planner in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/branch-refactor-planner to use it in all your projects, or to .claude/skills/branch-refactor-planner in one project. Or install the ai-essentials plugin, which includes it: /plugin marketplace add tonyghiani/ai-essentials, then /plugin install ai-essentials@ai-essentials.

### Does Branch refactor planner 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 Branch refactor planner?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Branch refactor planner?

The closest alternatives to Branch refactor planner are Refactor, Review, Code review, Code review and quality and Refactor plan.

## Where this comes from

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

## Alternatives

- [Refactor](https://ai-powered.com/skills/refactor-kzytateishi): Refactor is an open-source agent skill for developer tools.
- [Review](https://ai-powered.com/skills/review-juliusz-cwiakalski): Review is an open-source agent skill for developer tools.
- [Code review](https://ai-powered.com/skills/code-review-mattpocock): Code review is an open-source agent skill for developer tools.
- [Code review and quality](https://ai-powered.com/skills/code-review-and-quality): Code review and quality 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.
- [Review PR](https://ai-powered.com/skills/review-pr): Review PR 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.

---
Source: https://ai-powered.com/skills/branch-refactor-planner
