
Refactor
Plans complexity-driven refactors that keep existing tests green
Refactor is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- None
- Platforms
- Claude Code
- GitHub stars
- 6
- Last commit
- License
- Apache-2.0
- Listing updated
Similar skills
About Refactor
This skill guides an agent through refactoring code that is hard to maintain. Instead of editing ad hoc, it relies on the project's coverage, complexity and duplication tooling to choose targets, then checks that the test suite passes before any change is made.
The workflow turns each chosen target into a planning task scoped to one file or module, with an explicit note that behavior stays the same and existing tests must pass unmodified. Tasks are meant to feed a larger plan pipeline, and the skill lists common patterns such as extracting functions, using guard clauses, extracting constants and separating I/O from domain logic.
It expects a project that uses the ffflow tooling, including a just check-all recipe and an optional .ffflow/config.yaml for stack and thresholds. An optional directory argument narrows the scan; otherwise the whole project is considered.
When your agent uses it
Coverage/complexity-driven refactoring. Identify targets, refactor under green tests. Generates plan tasks rather than ad-hoc edits.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (7 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the fff plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add zerotechdebt/ffflow
/plugin install fff@ffflowOr copy only this skill to ~/.claude/skills/refactor:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/refactor &&
cp -R "$tmp/plugin/skills/refactor" ~/.claude/skills/refactor &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/refactor inside it instead.
Copy the skill folder to ~/.agents/skills/refactor to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/refactor &&
cp -R "$tmp/plugin/skills/refactor" ~/.agents/skills/refactor &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/refactor inside it instead.
Copy the skill folder to ~/.cursor/skills/refactor to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/refactor &&
cp -R "$tmp/plugin/skills/refactor" ~/.cursor/skills/refactor &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/refactor inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/zerotechdebt/ffflow.git --path plugin/skills/refactorOr copy the folder to ~/.gemini/skills/refactor yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/refactor:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/refactor &&
cp -R "$tmp/plugin/skills/refactor" ~/.copilot/skills/refactor &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/refactor inside it instead.
Get the folder:
git clone --depth 1 https://github.com/zerotechdebt/ffflow.gitThen copy ffflow/plugin/skills/refactor into your agent's skills folder as refactor. Agents that support SKILL.md read one folder per skill.
What it does
- Target selection from metrics
- Uses complexity, coverage and duplication findings to decide which code is worth refactoring.
- Green-test gate
- Requires the test suite to pass before refactoring starts and between steps.
- Refactor plan tasks
- Drafts one task per target with behavioral scope, implementation scope, out-of-scope items and acceptance criteria.
- Common refactor patterns
- Lists techniques such as extract function, guard clauses, extract constants and extract fixture.
- Inline or planned mode
- Covers small in-PR cleanups during other work as well as standalone refactor plans.
Good for
- Find the most complex functions in a module and plan how to split them
- Clean up a file without changing its behavior, keeping existing tests unchanged
- Turn refactor findings from an audit into tasks ready for a pull request
- Extract I/O from domain logic in a service layer
- Collapse repeated test cases into parameterized tests
Refactor FAQ
Does Refactor change code on its own?
It generates refactor plan tasks and describes the steps to take. Changes are made through the wider ffflow workflow, with tests required to stay green.
What must be in place before using Refactor?
The skill expects a working test suite, reachable through the just check-all command, and it advises writing tests first for code that has no coverage.
Can Refactor change behavior?
No. The skill states that changes to observable behavior are features and should go through a separate planning step.
Which AI clients does Refactor support?
It is published as a Claude Code plugin skill in the ffflow marketplace.
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 fff plugin, which includes it: /plugin marketplace add zerotechdebt/ffflow, then /plugin install fff@ffflow.
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 Refactoring guide, Refactor plan, Refactor, Refactor and TDD loop.
Where this comes from
- Description: from the skill's own SKILL.md.
More from zerotechdebt/ffflow

Onboards a project onto FFFlow: config, stack setup, then a phased roadmap
- Open source
- 6 GitHub stars
- Developer tools

Runs keep-honest audits on a project and reports drift, stale docs and tech debt
- Open source
- 6 GitHub stars
- Developer tools

Runs another interactive skill unattended, making routine choices from project context
- Open source
- 6 GitHub stars
- Developer tools

Lists and validates the adapter cartridges that FFFlow ports load in a project
- Open source
- 6 GitHub stars
- Developer tools

Extracts a behavioral spec from an unspecified codebase and plans characterization tests
- Open source
- 6 GitHub stars
- Developer tools

Adds GitHub Actions workflows that run FFFlow quality gates on pull requests
- Open source
- 6 GitHub stars
- Developer tools




