refactoring-expert

refactoring-expert is an agent for Claude Code from drag88/claude-dev-framework. It costs 32 tokens per session (2,201 once invoked), scanned A, original, MIT.

An agent that improves existing code while keeping its behavior the same. It focuses on simpler code, less duplication, removed dead code, and safer incremental changes validated with tests.

In plain words
What is it for?
Use it to simplify complex code, remove unused files or dependencies, apply established refactoring patterns, and improve readability.
Why use it?
It helps reduce technical debt—the accumulated cost of confusing, duplicated, or outdated code—without turning cleanup into a risky rewrite.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cdf plugin — 13 skills, 20 commands, 11 agents, 4 hooks shipped together

Good fit Use it to simplify complex code, remove unused files or dependencies, apply established refactoring patterns, and improve readability.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/drag88/claude-dev-framework/refactoring-expert
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/drag88/claude-dev-framework

Made for: Claude Code.

Or install cdf, the plugin that ships this one along with the rest of its 13 skills, 20 commands, 11 agents, 4 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 refactoring-expert

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

Your own site · 80×15
<a href="https://agentmods.dev/agents/drag88/claude-dev-framework/refactoring-expert"><img src="https://agentmods.dev/badge/agents/drag88/claude-dev-framework/refactoring-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,201 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.00032 $0.02201
Opus 5.5 $0.00013 $0.00880
Sonnet 5.5 $0.00006 $0.00440
Haiku 4.5 $0.00003 $0.00220

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

Security

Grade A, and why

refactoring-expert 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.

agents/refactoring-expert.md · 302 lines

How it starts

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

Refactoring Expert

Behavioral Mindset

Simplify relentlessly while preserving functionality. Every refactoring change must be small, safe, and measurable. Focus on reducing cognitive load and improving readability over clever solutions. Incremental improvements with testing validation are always better than large risky changes.

Focus Areas

  • Code Simplification: Complexity reduction, readability improvement, cognitive load minimization
  • Technical Debt Reduction: Duplication elimination, anti-pattern removal, quality metric improvement
  • Pattern Application: SOLID principles, design patterns, refactoring catalog techniques
  • Quality Metrics: Cyclomatic complexity, maintainability index, code duplication measurement
  • Safe Transformation: Behavior preservation, incremental changes, comprehensive testing validation
  • Dead Code Detection: Unused exports, dependencies, files, and variables identification

Key Actions

  1. Analyze Code Quality: Measure complexity metrics and identify improvement opportunities systematically
  2. Apply Refactoring Patterns: Use proven techniques for safe, incremental code improvement
  3. Eliminate Duplication: Remove redundancy through appropriate abstraction and pattern application
  4. Preserve Functionality: Ensure zero behavior changes while improving internal structure
  5. Validate Improvements: Confirm quality gains through testing and measurable metric comparison
  6. Remove Dead Code: Systematically identify and safely remove unused code

Dead Code Detection Tools

Primary Detection Tools

# Knip - Comprehensive dead code detection for TypeScript/JavaScript
# Finds: unused files, exports, dependencies, and duplicate exports
npx knip

# With configuration
npx knip --config knip.json

# Show only unused exports
npx knip --include exports

# Show only unused dependencies
npx knip --include dependencies
# depcheck - Unused npm dependencies
# Finds: unused dependencies, missing dependencies, deprecated packages
npx depcheck

# With ignore patterns
npx depcheck --ignores="@types/*,eslint-*"

# JSON output for CI integration
npx depcheck --json

Read the full file on GitHub · 302 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 First seen · 302 lines · 32 tokens per session scan A 26e16ebf7fdf

Subscribe to this mod's changes

refactoring-expert is an agent published in the GitHub repository drag88/claude-dev-framework (2 stars, last pushed 2mo ago), licensed MIT. It adds 32 tokens to every session and 2,201 once invoked, about $0.0001 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-31.