refactorer

refactorer is an agent for Claude Code from mintuz/skills. It costs 51 tokens per session (3,604 once invoked), scanned A, original, MIT.

A code-quality agent that looks for worthwhile refactoring, meaning changes to a program's internal structure without changing what it does. It can advise during code improvement and review opportunities after tests pass.

In plain words
What is it for?
Use it while considering a refactor or after tests are green. It evaluates whether code should be reorganized, abstracted, or left as it is.
Why use it?
It helps distinguish useful cleanup from abstractions that add needless complexity. It also checks that public interfaces stay compatible and tests continue to pass.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the web plugin — 11 skills, 4 agents shipped together

Good fit Use it while considering a refactor or after tests are green. It evaluates whether code should be reorganized, abstracted, or left as it is.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/mintuz/skills/refactorer
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/mintuz/skills

Made for: Claude Code.

Or install web, the plugin that ships this one along with the rest of its 11 skills, 4 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 refactorer

README.md
[![agentmods](https://agentmods.dev/badge/agents/mintuz/skills/refactorer/github.svg)](https://agentmods.dev/agents/mintuz/skills/refactorer)
Your own site
<a href="https://agentmods.dev/agents/mintuz/skills/refactorer"><img src="https://agentmods.dev/badge/agents/mintuz/skills/refactorer/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 refactorer

Your own site · 80×15
<a href="https://agentmods.dev/agents/mintuz/skills/refactorer"><img src="https://agentmods.dev/badge/agents/mintuz/skills/refactorer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 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,604 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.00051 $0.03604
Opus 5.5 $0.00020 $0.01442
Sonnet 5.5 $0.00010 $0.00721
Haiku 4.5 $0.00005 $0.00360

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

Security

Grade A, and why

refactorer 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.

src/web/agents/refactorer.md · 561 lines

How it starts

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

Refactoring Opportunity Scanner

You are the Refactoring Opportunity Scanner, a code quality coach with deep expertise in distinguishing valuable refactoring from premature optimization. Your mission is dual:

  1. PROACTIVE GUIDANCE - Help users make good refactoring decisions during code improvement
  2. REACTIVE ANALYSIS - Assess refactoring opportunities after tests pass

Core Principle: Refactoring means changing internal structure without changing external behavior. Not all code needs refactoring - only refactor if it genuinely improves the code.

Sacred Rules

Per CLAUDE.md: "Evaluating refactoring opportunities is not optional - it's the third step in the TDD cycle."

  1. External APIs stay unchanged - Public interfaces must not break
  2. All tests must still pass - Without modification
  3. Semantic over structural - Only abstract when code shares meaning, not just structure
  4. Clean code is good enough - If code is already expressive, say so explicitly

Your Dual Role

When Invoked PROACTIVELY (During Refactoring)

Your job: Guide users through refactoring decisions WHILE they're considering changes.

Decision Support For:

  • 🎯 "Should I create this abstraction?"
  • 🎯 "Is this duplication worth fixing?"
  • 🎯 "Are these functions semantically or structurally similar?"
  • 🎯 "Should I extract this constant/function?"
  • 🎯 "Is this abstraction premature?"

Process:

  1. Understand the situation: What refactoring are they considering?
  2. Apply semantic test: Do the similar pieces share meaning or just structure?
  3. Assess value: Will this genuinely improve the code?
  4. Provide recommendation: With clear rationale
  5. Guide implementation: If proceeding, show the pattern

Response Pattern:

"Let's analyze this potential refactoring:

**Semantic Analysis:**
- [Function 1]: Represents [business concept]
- [Function 2]: Represents [business concept]

**Assessment:** [Same/Different] semantic meaning

**Recommendation:** [Abstract/Keep Separate] because [rationale]

[If abstracting]: Here's the pattern to use:
[code example]

[If keeping separate]: This is appropriate domain separation.
"

Read the full file on GitHub · 561 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. 1mo ago Changed 527d10dccae6
  2. 1mo ago First seen · 561 lines · 51 tokens per session scan A 478e1d62540d

Subscribe to this mod's changes

refactorer is an agent published in the GitHub repository mintuz/skills (29 stars, last pushed 3d ago), licensed MIT. It adds 51 tokens to every session and 3,604 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-08-30.

Related

Other agents, from other repositories

code-quality-reviewer

Stage 2 of two-stage review. Spec compliance already verified by Stage 1. Reviews security, performance, maintainability, readability, test quality. Severity-tagged output (P0/P1/P2/P3/P4) with MANDATORY rule ID citation per finding.

taipt1504/agent-skills · 61 tokens

architect

High-stakes lane pre-plan architectural review. Reads ADRs + CONTEXT.md + brainstorm artifact. Validates chosen solution against existing architecture. Output feeds Plan gate. Optional for standard lane, auto-fire for high-stakes.

taipt1504/agent-skills · 47 tokens

spec-compliance-reviewer

Stage 1 of two-stage review. Verifies code does what spec said. Binary pass/fail outcome. Does NOT check code quality — that is Stage 2. If Stage 1 fails, Stage 2 does not run.

taipt1504/agent-skills · 53 tokens

cpp-reviewer

Expert C++ code reviewer specializing in memory safety, modern C++ idioms, concurrency, and performance. Use for all C++ code changes. MUST BE USED for C++ projects.

affaan-m/ECC · 41 tokens

thermo-nuclear-code-quality-review-subagent

Thermo-nuclear code quality audit (maintainability, structure, 1k-line rule, spaghetti, code-judo). Invoked through the Agent tool after a parent gathers diff and file contents. Loads rubric from the thermo-nuclear-code-quality-review skill in this plugin.

michael-denyer/pstack-claude · 68 tokens

karimo-implementer

Executes coding tasks (complexity 1-4) from KARIMO PRDs. Writes production code, follows existing patterns, validates before committing. Use for straightforward feature implementation, refactoring, and bug fixes.

opensesh/KARIMO · 49 tokens