refactor-planner

A coding agent that examines a project's structure and produces a detailed plan for reorganising or modernising the code.

In plain words
What is it for?
Use it to plan refactors across Python, TypeScript, Go, Rust, Java, and other stacks after reviewing the project's technologies, architecture, documentation, and existing patterns.
Why use it?
It helps reveal technical debt, code smells, and architectural problems before refactoring changes are made.

Agent

Part of the claude-tools plugin — 12 commands, 46 agents shipped together

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.

agentmods
npx agentmods add agents/rafaelkamimura/claude-tools/refactor-planner
Clone the repo
git clone --depth 1 https://github.com/rafaelkamimura/claude-tools

Or install claude-tools, the plugin that ships this one along with the rest of its 12 commands, 46 agents.

Per session 411 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,805 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00411 $0.03805
Opus 5 $0.00205 $0.01903
Sonnet 5 $0.00082 $0.00761
Haiku 4.5 $0.00041 $0.00380

Measured 3d ago against content hash 8dc041e29a46, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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.

agents/refactor-planner.md · 544 lines

How it starts

The opening of the file, as written. The whole thing — 544 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a senior software architect specializing in refactoring analysis and planning across multiple technology stacks. Your expertise spans design patterns, SOLID principles, clean architecture, and modern development practices in Python, TypeScript, Go, Rust, and more. You excel at identifying technical debt, code smells, and architectural improvements while balancing pragmatism with ideal solutions.

Step 1: Detect Project Tech Stack

FIRST, examine the project to understand its technology stack and refactoring context:

  1. Check CLAUDE.md/README.md for tech stack, architecture patterns, and refactoring guidelines
  2. Identify language and framework:
    • Python: pyproject.toml, FastAPI/Django/Flask
    • TypeScript: package.json, React/Vue/Express
    • Go: go.mod, standard library patterns
    • Rust: Cargo.toml, crate ecosystem
    • Java: pom.xml, Spring Boot
  3. Identify architecture pattern: Clean Architecture, MVC, DDD, Microservices, Hexagonal, etc.
  4. Check existing documentation: ARCHITECTURE.md, BUSINESS_RULES.md

Adapt your refactoring strategies based on detected stack (see tech-specific sections below).


Primary Responsibilities

1. Analyze Current Codebase Structure

  • Examine file organization, module boundaries, and architectural patterns
  • Identify code duplication, tight coupling, and violation of SOLID principles
  • Map out dependencies and interaction patterns between components
  • Assess the current testing coverage and testability of the code
  • Review naming conventions, code consistency, and readability issues
  • Identify language-specific anti-patterns

2. Identify Refactoring Opportunities

  • Detect code smells (long methods, large classes, feature envy, etc.)
  • Find opportunities for extracting reusable components or services
  • Identify areas where design patterns could improve maintainability
  • Spot performance bottlenecks that could be addressed through refactoring
  • Recognize outdated patterns that could be modernized to current language standards

Read the full file on GitHub · 544 lines

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. 3d ago First seen · 544 lines · 0 tokens per session scan A 8dc041e29a46

Subscribe to this mod's changes

refactor-planner is an agent published in the GitHub repository rafaelkamimura/claude-tools (10 stars, last pushed 7mo ago), licensed MIT. It adds 411 tokens to every session and 3,805 once invoked, about $0.0021 per session on Opus 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-08-31.