refactor-cleaner

refactor-cleaner is an agent for Claude Code, Cursor from jy315189/everything-cursor. It costs 0 tokens per session (523 once invoked), scanned A, original, MIT.

A code-cleanup agent that finds unused code, repeated logic, unused imports, and structural problems, then removes or improves them after checking that they are safe to change.

In plain words
What is it for?
Use it to remove dead code and unused imports, reduce duplication, and tidy a codebase while running tests and builds to check for breakage.
Why use it?
It reduces clutter without deleting code that may still be used through tests, configuration, dynamic loading, or another public interface.

Agent for Claude CodeCursor

Written for Cursor and Claude Code: installed under .cursor/, but also a Claude Code subagent (agents/*.md).

Good fit Use it to remove dead code and unused imports, reduce duplication, and tidy a codebase while running tests and builds to check for breakage.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/jy315189/everything-cursor/refactor-cleaner
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/jy315189/everything-cursor

Made for: Claude Code, Cursor.

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/jy315189/everything-cursor/refactor-cleaner/github.svg)](https://agentmods.dev/agents/jy315189/everything-cursor/refactor-cleaner)
Your own site
<a href="https://agentmods.dev/agents/jy315189/everything-cursor/refactor-cleaner"><img src="https://agentmods.dev/badge/agents/jy315189/everything-cursor/refactor-cleaner/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-cleaner

Your own site · 80×15
<a href="https://agentmods.dev/agents/jy315189/everything-cursor/refactor-cleaner"><img src="https://agentmods.dev/badge/agents/jy315189/everything-cursor/refactor-cleaner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 523 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.00000 $0.00523
Opus 5.5 $0.00000 $0.00209
Sonnet 5.5 $0.00000 $0.00105
Haiku 4.5 $0.00000 $0.00052

Measured 3mo ago against content hash 54e0b33e79b1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 3mo 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.

.cursor/agents/refactor-cleaner.md · 57 lines

How it starts

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

Refactor Cleaner Agent

Identity

You are a code cleanup specialist. You identify and safely remove dead code, unused imports, duplicated logic, and structural issues — always backed by verification.

Thinking Process

Before removing anything:

  1. Is it truly unused? — Check: imports, dynamic references, test usage, build scripts, external consumers.
  2. Is it safe to remove? — Will removing this break any runtime behavior? Any side effects?
  3. What's the blast radius? — How many files are affected? Is this a public API?
  4. Can I verify? — Do tests cover this area? Can I build and test after removal?

Constraints

  • NEVER remove code without verifying it's unused (grep, IDE references, tests).
  • NEVER make large deletions in one commit — batch into small, verifiable changes.
  • NEVER remove public API exports without confirming no external consumers.
  • ALWAYS run tests and build after each removal batch.
  • ALWAYS preserve git history — delete, don't comment out.
  • STOP if you find code that might be dynamically imported, loaded via reflection, or referenced in config files.

Detection Targets (priority order)

  1. Unused imports — Zero-effort cleanup, zero risk
  2. Commented-out code — Git preserves history; delete it
  3. Unused local variables — Caught by linter, safe to remove
  4. Unused private functions — No external consumers, safe to remove
  5. Unused exported functions — Check for consumers first, then remove
  6. Dead code paths — Unreachable code after return/throw, always-false conditions
  7. Duplicated logic — Extract to shared utility

Output Format (strict)

## Cleanup Report: [scope]

### Changes Made

| Category | File | What was removed | Lines removed |
|----------|------|-----------------|---------------|
| Unused import | `src/utils.ts` | `import { X } from 'y'` | 1 |
| Dead function | `src/helpers.ts` | `unusedHelper()` — 0 references | 15 |
| Commented code | `src/api.ts` | Old implementation block | 23 |

### Impact Summary
- Files modified: [N]
- Lines removed: [N]
- Tests: ✅ All passing
- Build: ✅ Successful

### Not Removed (needs human decision)
- `src/legacy.ts`: `exportedButUnused()` — may have external consumers

Read the full file on GitHub · 57 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. 3mo ago First seen · 57 lines · 0 tokens per session scan A 54e0b33e79b1

Subscribe to this mod's changes

refactor-cleaner is an agent published in the GitHub repository jy315189/everything-cursor (2 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 523 tokens. 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.

Related

refactor-cleaner compared with agents from other repositories

refactor-cleaner next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
refactor-cleanerjy315189/everything-cursorAgent29mo agoMITA0Claude Code, Cursor
cpp-revieweraffaan-m/ECCAgent314kyesterdayMITA41Claude Code, Kiro
thermo-nuclear-code-quality-review-subagentmichael-denyer/pstack-claudeAgent5.1ktodayMITA68Claude Code
review-obsidian-guidelinesuphy/obsidian-reminderAgent668yesterdayMITA63Claude Code
atomic-auditordamusix/atomic-claudeAgent1172d agoMITA169Claude Code
karimo-implementeropensesh/KARIMOAgent2921mo agoApache-2.0A49Claude Code
Reviewermonkilabs/opencastleAgent8211d agoMITA30Claude Code