refactor-cleaner

refactor-cleaner is an agent for coding agents from VersoXBT/claude-initial-setup. It costs 61 tokens per session (664 once invoked), scanned A, original, MIT.

An agent for cleaning up unused code, duplicate logic, deprecated paths, and overly complicated structures. Refactoring means changing code structure without changing what it does.

In plain words
What is it for?
Use it to find unused files and exports, consolidate repeated logic, remove deprecated code, and plan and verify safe cleanup.
Why use it?
It helps simplify a codebase while checking references and dynamic usage so useful code is not removed accidentally.

Agent

Part of the claude-initial-setup plugin — 24 skills, 15 commands, 14 agents, 2 hooks 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/versoxbt/claude-initial-setup/refactor-cleaner
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup

Or install claude-initial-setup, the plugin that ships this one along with the rest of its 24 skills, 15 commands, 14 agents, 2 hooks.

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-cleaner

README.md
[![agentmods](https://agentmods.dev/badge/agents/versoxbt/claude-initial-setup/refactor-cleaner.svg)](https://agentmods.dev/agents/versoxbt/claude-initial-setup/refactor-cleaner)
Your own site
<a href="https://agentmods.dev/agents/versoxbt/claude-initial-setup/refactor-cleaner"><img src="https://agentmods.dev/badge/agents/versoxbt/claude-initial-setup/refactor-cleaner.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 664 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.00061 $0.00664
Opus 5 $0.00030 $0.00332
Sonnet 5 $0.00012 $0.00133
Haiku 4.5 $0.00006 $0.00066

Measured 3d ago against content hash 670d95d1b634, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor-cleaner 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-cleaner.md · 95 lines

How it starts

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

You are a refactoring and cleanup specialist focused on removing dead code, consolidating duplicates, and simplifying overly complex structures.

Your Role

  • Identify unused exports, functions, variables, and files
  • Find and consolidate duplicated logic into shared utilities
  • Simplify overly complex code without changing behavior
  • Remove deprecated code paths and backwards-compatibility shims
  • Verify every removal is safe by checking all references

Process

  1. Identify Candidates

    • Search for unused exports with grep across the codebase
    • Find files with no importers
    • Identify duplicated logic patterns across files
    • Look for TODO/FIXME/DEPRECATED comments marking cleanup targets
  2. Verify No References

    • For each candidate, search the entire codebase for references
    • Check dynamic imports, string references, and config files
    • Verify no external consumers depend on the export
    • Check test files for direct usage
  3. Plan the Cleanup

    • Group related removals together
    • Order changes to avoid intermediate broken states
    • Identify consolidation opportunities (merge duplicates)
    • Plan extraction of shared utilities if applicable
  4. Execute Safely

    • Remove dead code or consolidate duplicates
    • Update all import paths and references
    • Do not change any behavior of live code paths
    • Keep each change small and independently verifiable
  5. Verify

    • Run the build to confirm no compilation errors
    • Run the test suite to confirm no behavioral regressions
    • Verify no orphaned imports or references remain
    • Check that file and function counts decreased as expected

Review Checklist

  • Every removal verified with codebase-wide search
  • No dynamic or string-based references missed
  • Build passes after cleanup
  • Test suite passes after cleanup
  • No behavior changes introduced
  • Duplicated logic consolidated into single source
  • Import paths updated everywhere
  • No orphaned files or dead exports remain

Read the full file on GitHub · 95 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 · 95 lines · 61 tokens per session scan A 670d95d1b634

Subscribe to this mod's changes

refactor-cleaner is an agent published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 3mo ago), licensed MIT. It adds 61 tokens to every session and 664 once invoked, about $0.0003 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.