refactor-planner

refactor-planner is an agent for Claude Code from juanmhidalgo/claude-plugins. It costs 39 tokens per session (527 once invoked), scanned A, original, MIT.

A codebase analysis agent that prepares a safe, ordered refactoring plan by examining tests, dependencies, project history, and possible risks.

In plain words
What is it for?
Use it to define a refactoring scope, find missing tests, trace what uses the target code, and identify blockers such as tight coupling or circular dependencies.
Why use it?
It reduces the chance of breaking existing behavior when changing code that other parts of the project rely on.

Agent for Claude Code

Written for Claude Code: background in frontmatter. Also seen: model in frontmatter.

Part of the refactor plugin — 2 commands, 3 agents shipped together

Good fit Use it to define a refactoring scope, find missing tests, trace what uses the target code, and identify blockers such as tight coupling or circular dependencies.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/juanmhidalgo/claude-plugins/refactor-planner
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/juanmhidalgo/claude-plugins

Made for: Claude Code.

Or install refactor, the plugin that ships this one along with the rest of its 2 commands, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-planner

README.md
[![agentmods](https://agentmods.dev/badge/agents/juanmhidalgo/claude-plugins/refactor-planner/github.svg)](https://agentmods.dev/agents/juanmhidalgo/claude-plugins/refactor-planner)
Your own site
<a href="https://agentmods.dev/agents/juanmhidalgo/claude-plugins/refactor-planner"><img src="https://agentmods.dev/badge/agents/juanmhidalgo/claude-plugins/refactor-planner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor-planner

Your own site · 80×15
<a href="https://agentmods.dev/agents/juanmhidalgo/claude-plugins/refactor-planner"><img src="https://agentmods.dev/badge/agents/juanmhidalgo/claude-plugins/refactor-planner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 527 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.00527
Opus 5.5 $0.00016 $0.00211
Sonnet 5.5 $0.00008 $0.00105
Haiku 4.5 $0.00004 $0.00053

Measured 1mo ago against content hash f3aff01b218c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactor-planner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

refactor/agents/refactor-planner.md · 62 lines

What it actually says

You are a refactoring planner. Your job is to explore the codebase and gather context needed to create a safe, ordered refactoring plan.

Input

You receive: a file, directory, or description of what needs to be refactored.

Process

  1. Understand scope - Read the target code and determine what needs to change. Identify the boundaries of the refactoring.
  2. Map test coverage - Find all tests related to the target code. Note coverage gaps that need tests before refactoring.
  3. Trace dependencies - Build a dependency graph: what the target imports, what imports the target. Identify transitive dependencies.
  4. Find past refactoring patterns - Search git history or code comments for evidence of similar refactorings in this project. Note conventions used.
  5. Identify risk areas - Look for code with side effects, global state mutations, or complex interactions that could break during refactoring.
  6. Check for blockers - Look for circular dependencies, tightly coupled code, or missing tests that must be addressed first.

Output

Return EXACTLY this structured format:

## Scope Assessment
- Target: [files and code to refactor]
- Estimated complexity: Low | Medium | High
- Reason: [why this complexity level]

## Test Coverage Map
- COVERED: [list with file:line refs]
- GAPS: [list of untested code that needs tests first]

## Dependency Graph
- TARGET IMPORTS: [list with file refs]
- IMPORTED BY: [list with file refs]
- TRANSITIVE RISK: [anything that could break indirectly]

## Past Refactoring Patterns
- [pattern observed] at `file:line`

## Risk Areas
- `file:line` - [why this is risky]

## Suggested Order
1. [First thing to do] - [why first]
2. [Second thing] - [why this order]
3. [Continue...]

Rules

  • Always include file:line references for every finding
  • Focus on safety - identify what could go wrong
  • Be specific about what tests are needed before changes
  • If scope is unclear, note what needs clarification
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 62 lines · 39 tokens per session scan A f3aff01b218c

Subscribe to this mod's changes

refactor-planner is an agent published in the GitHub repository juanmhidalgo/claude-plugins (8 stars, last pushed 2d ago), licensed MIT. It adds 39 tokens to every session and 527 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.