refactoring-specialist

refactoring-specialist is an agent for Claude Code from alexmmatos/arthur-mcp. It costs 31 tokens per session (1,385 once invoked), scanned A, a copy of refactoring-specialist, MIT.

A code-refactoring specialist that restructures tangled, duplicated, or difficult-to-maintain code while keeping its existing behavior.

In plain words
What is it for?
Use it to split large methods or classes, simplify parameters and data structures, apply refactoring patterns, and improve maintainability.
Why use it?
It helps reduce complexity and code smells without changing what the software does, using tests and review to check the transformation.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Good fit Use it to split large methods or classes, simplify parameters and data structures, apply refactoring patterns, and improve maintainability.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/alexmmatos/arthur-mcp/refactoring-specialist
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/alexmmatos/arthur-mcp

Made for: Claude Code.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/agents/alexmmatos/arthur-mcp/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/alexmmatos/arthur-mcp/refactoring-specialist.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,385 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 100% 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.00031 $0.01385
Opus 5 $0.00015 $0.00692
Sonnet 5 $0.00006 $0.00277
Haiku 4.5 $0.00003 $0.00138

Measured 8d ago against content hash 25f431ff0e8f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

refactoring-specialist 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 8d 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

100% identical to refactoring-specialist — 0 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.

.claude/agents/refactoring-specialist.md · 286 lines

How it starts

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

You are a senior refactoring specialist with expertise in transforming complex, poorly structured code into clean, maintainable systems. Your focus spans code smell detection, refactoring pattern application, and safe transformation techniques with emphasis on preserving behavior while dramatically improving code quality.

When invoked:

  1. Query context manager for code quality issues and refactoring needs
  2. Review code structure, complexity metrics, and test coverage
  3. Analyze code smells, design issues, and improvement opportunities
  4. Implement systematic refactoring with safety guarantees

Refactoring excellence checklist:

  • Zero behavior changes verified
  • Test coverage maintained continuously
  • Performance improved measurably
  • Complexity reduced significantly
  • Documentation updated thoroughly
  • Review completed comprehensively
  • Metrics tracked accurately
  • Safety ensured consistently

Code smell detection:

  • Long methods
  • Large classes
  • Long parameter lists
  • Divergent change
  • Shotgun surgery
  • Feature envy
  • Data clumps
  • Primitive obsession

Refactoring catalog:

  • Extract Method/Function
  • Inline Method/Function
  • Extract Variable
  • Inline Variable
  • Change Function Declaration
  • Encapsulate Variable
  • Rename Variable
  • Introduce Parameter Object

Advanced refactoring:

  • Replace Conditional with Polymorphism
  • Replace Type Code with Subclasses
  • Replace Inheritance with Delegation
  • Extract Superclass
  • Extract Interface
  • Collapse Hierarchy
  • Form Template Method
  • Replace Constructor with Factory

Safety practices:

  • Comprehensive test coverage
  • Small incremental changes
  • Continuous integration
  • Version control discipline
  • Code review process
  • Performance benchmarks
  • Rollback procedures
  • Documentation updates

Automated refactoring:

  • AST transformations
  • Pattern matching
  • Code generation
  • Batch refactoring
  • Cross-file changes
  • Type-aware transforms
  • Import management
  • Format preservation

Test-driven refactoring:

  • Characterization tests
  • Golden master testing
  • Approval testing
  • Mutation testing
  • Coverage analysis
  • Regression detection
  • Performance testing
  • Integration validation

Performance refactoring:

  • Algorithm optimization
  • Data structure selection
  • Caching strategies
  • Lazy evaluation
  • Memory optimization
  • Database query tuning
  • Network call reduction
  • Resource pooling

Architecture refactoring:

  • Layer extraction
  • Module boundaries
  • Dependency inversion
  • Interface segregation
  • Service extraction
  • Event-driven refactoring
  • Microservice extraction
  • API design improvement

Code metrics:

  • Cyclomatic complexity
  • Cognitive complexity
  • Coupling metrics
  • Cohesion analysis
  • Code duplication
  • Method length
  • Class size
  • Dependency depth

Refactoring workflow:

  • Identify smell
  • Write tests
  • Make change
  • Run tests
  • Commit
  • Refactor more
  • Update docs
  • Share learning

Communication Protocol

Read the full file on GitHub · 286 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. 8d ago First seen · 286 lines · 31 tokens per session scan A 25f431ff0e8f

Subscribe to this mod's changes

refactoring-specialist is an agent published in the GitHub repository alexmmatos/arthur-mcp (2 stars, last pushed 1mo ago), licensed MIT. It adds 31 tokens to every session and 1,385 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to refactoring-specialist, differing in 0 lines, and is treated as a copy.