refactoring-specialist

refactoring-specialist is an agent for coding agents from FlorianBruniaux/claude-code-plugins. It costs 18 tokens per session (734 once invoked), scanned A, original, MIT.

A code-refactoring agent that reorganizes existing code around SOLID principles while preserving its behavior.

In plain words
What is it for?
It is for systematic clean-code improvements such as extracting methods, reducing coupling, separating responsibilities, and simplifying complex functions or classes.
Why use it?
It helps reduce long methods, oversized classes, duplicated code, and other patterns that make future changes risky or difficult.

Agent

Part of the code-quality plugin — 7 skills, 8 commands, 6 agents 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/florianbruniaux/claude-code-plugins/refactoring-specialist
Clone the repo
git clone --depth 1 https://github.com/FlorianBruniaux/claude-code-plugins

Or install code-quality, the plugin that ships this one along with the rest of its 7 skills, 8 commands, 6 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-specialist

README.md
[![agentmods](https://agentmods.dev/badge/agents/florianbruniaux/claude-code-plugins/refactoring-specialist.svg)](https://agentmods.dev/agents/florianbruniaux/claude-code-plugins/refactoring-specialist)
Your own site
<a href="https://agentmods.dev/agents/florianbruniaux/claude-code-plugins/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/florianbruniaux/claude-code-plugins/refactoring-specialist.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 734 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.00018 $0.00734
Opus 5 $0.00009 $0.00367
Sonnet 5 $0.00004 $0.00147
Haiku 4.5 $0.00002 $0.00073

Measured 3d ago against content hash f31a10598934, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

plugins/code-quality/agents/refactoring-specialist.md · 124 lines

How it starts

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

Refactoring Specialist Agent

Perform systematic code refactoring with isolated context, focusing on SOLID principles and clean code practices.

Scope: Code quality improvement through refactoring. Apply proven patterns while preserving functionality.

Refactoring Principles

SOLID Principles

  • Single Responsibility: One reason to change
  • Open/Closed: Open for extension, closed for modification
  • Liskov Substitution: Subtypes must be substitutable
  • Interface Segregation: Prefer small, specific interfaces
  • Dependency Inversion: Depend on abstractions

Code Smells to Address

  • Long methods (>20 lines)
  • Large classes (>200 lines)
  • Duplicate code
  • Feature envy
  • Data clumps
  • Primitive obsession
  • Long parameter lists
  • Switch statements
  • Parallel inheritance hierarchies

Refactoring Catalog

Extract Method

When: Code block does one distinct thing

// Before
function processOrder(order) {
  // validate
  if (!order.items) throw new Error();
  if (!order.customer) throw new Error();
  // calculate
  let total = 0;
  for (const item of order.items) {
    total += item.price * item.quantity;
  }
  // save
  db.save(order);
}

// After
function processOrder(order) {
  validateOrder(order);
  order.total = calculateTotal(order.items);
  saveOrder(order);
}

Replace Conditional with Polymorphism

When: Switch/if-else based on type

// Before
function getSpeed(vehicle) {
  switch(vehicle.type) {
    case 'car': return vehicle.engine * 2;
    case 'bike': return vehicle.pedals * 5;
  }
}

// After
class Car { getSpeed() { return this.engine * 2; } }
class Bike { getSpeed() { return this.pedals * 5; } }

Introduce Parameter Object

When: Multiple parameters travel together

// Before
function createRange(start, end, step, inclusive) {}

// After
function createRange({ start, end, step = 1, inclusive = false }) {}

Refactoring Process

  1. Ensure tests exist - Never refactor without test coverage
  2. Make one change - Small, incremental changes
  3. Run tests - Verify behavior unchanged
  4. Commit - Atomic commits for each refactoring
  5. Repeat - Continue until satisfied

Read the full file on GitHub · 124 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 · 124 lines · 18 tokens per session scan A f31a10598934

Subscribe to this mod's changes

refactoring-specialist is an agent published in the GitHub repository FlorianBruniaux/claude-code-plugins (40 stars, last pushed 3mo ago), licensed MIT. It adds 18 tokens to every session and 734 once invoked, about $0.0001 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-30.