refactoring-expert

refactoring-expert is an agent for Claude Code from NikiforovAll/claude-code-rules. It costs 20 tokens per session (536 once invoked), scanned A, a copy of refactoring-expert, Apache-2.0.

An assistant for improving code structure while keeping its existing behaviour, a process commonly called refactoring.

In plain words
What is it for?
Use it to simplify code, apply established design principles, reduce duplication, improve readability, and validate that behaviour is preserved.
Why use it?
It addresses complicated code, duplicated logic, technical debt, and hard-to-maintain designs through incremental changes.

Agent for Claude Code

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

Part of the handbook plugin — 4 agents shipped together

Good fit Use it to simplify code, apply established design principles, reduce duplication, improve readability, and validate that behaviour is preserved.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/nikiforovall/claude-code-rules/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/NikiforovAll/claude-code-rules

Made for: Claude Code.

Or install handbook, the plugin that ships this one along with the rest of its 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 refactoring-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/nikiforovall/claude-code-rules/refactoring-expert/github.svg)](https://agentmods.dev/agents/nikiforovall/claude-code-rules/refactoring-expert)
Your own site
<a href="https://agentmods.dev/agents/nikiforovall/claude-code-rules/refactoring-expert"><img src="https://agentmods.dev/badge/agents/nikiforovall/claude-code-rules/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/nikiforovall/claude-code-rules/refactoring-expert"><img src="https://agentmods.dev/badge/agents/nikiforovall/claude-code-rules/refactoring-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 536 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 86% copy Near-identical to another mod 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.00020 $0.00536
Opus 5.5 $0.00008 $0.00214
Sonnet 5.5 $0.00004 $0.00107
Haiku 4.5 $0.00002 $0.00054

Measured 23d ago against content hash b9cf965578b4, 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 23d 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.

Origin

This is a copy

86% identical to refactoring-expert — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/handbook/agents/refactoring-expert.md · 53 lines

How it starts

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

Refactoring Expert

Triggers

  • Code complexity reduction and technical debt elimination requests
  • SOLID principles implementation and design pattern application needs
  • Code quality improvement and maintainability enhancement requirements
  • Refactoring methodology and clean code principle application requests

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

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

Important Guidelines

  • Use Explore SubAgent: Use built-in @agent-Explore to explore existing codebase when needed

Outputs

  • Refactoring Reports: Before/after complexity metrics with detailed improvement analysis and pattern applications
  • Quality Analysis: Technical debt assessment with SOLID compliance evaluation and maintainability scoring
  • Code Transformations: Systematic refactoring implementations with comprehensive change documentation
  • Pattern Documentation: Applied refactoring techniques with rationale and measurable benefits analysis
  • Improvement Tracking: Progress reports with quality metric trends and technical debt reduction progress

Read the full file on GitHub · 53 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. 23d ago First seen · 53 lines · 20 tokens per session scan A b9cf965578b4

Subscribe to this mod's changes

refactoring-expert is an agent published in the GitHub repository NikiforovAll/claude-code-rules (141 stars, last pushed 11d ago), licensed Apache-2.0. It adds 20 tokens to every session and 536 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 86% identical to refactoring-expert, differing in 4 lines, and is treated as a copy.

Related

Other agents, from other repositories

dead-code-analyzer

Analyzes the codebase to find unused code — functions, imports, exports, variables, types, and classes — and produces a cleanup report with confidence levels. Never auto-deletes; reports findings for user review. Context: User wants to find unused code user: "find dead code" Context: User asks about code hygiene user…

lukaskellerstein/claude-my-marketplace · 160 tokens

code-resolver

Re-checks prior findings after a code fix. Given the prior findings (untrusted), diffs of newly changed files, per-finding since-raised diffs, and the tip worktree, decides whether each finding was addressed. Not for general questions.

Jose-Ribeir/claude-code-review-gate · 56 tokens

do-debugger

Autonomous Durable Objects debugger. Automatically detects and fixes DO configuration errors, runtime issues, and common mistakes without user intervention.

secondsky/claude-skills · 28 tokens

Turnstile CSP Debugger

This agent should be used when the user asks to "validate CSP for turnstile", "fix CSP errors", "check content security policy", or encounters error 200500. Analyzes Content Security Policy headers and suggests Turnstile-compatible configurations.

secondsky/claude-skills · 58 tokens

error-handling-reviewer

Hunts for swallowed errors, silent failures, and broken error propagation chains in changed code.

OutSystems/outsystems-mcp · 24 tokens

fec-performance-optimizer

Front-end performance analysis and optimization specialization: Core Web Vitals, packaging volume, runtime and rendering, network and cache, memory leak troubleshooting; can cooperate with Lighthouse, Bundle analysis and Profiler. Use it when users mention page slowness, lag, first screen, package size, poor…

bovinphang/frontend-craft · 72 tokens