refactoring-specialist

refactoring-specialist is an agent for Claude Code from coco-research/coco. It costs 80 tokens per session (1,439 once invoked), scanned A, original, Apache-2.0.

A code-refactoring specialist for restructuring complex or poorly organized software without changing its intended behavior. Refactoring means improving internal code structure while keeping its external results the same.

In plain words
What is it for?
Use it when complexity or maintainability problems appear, code smells are found, or legacy code needs systematic cleanup.
Why use it?
It helps reduce complexity, address code smells, and improve maintainability in legacy systems through safer incremental changes.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md).

Good fit Use it when complexity or maintainability problems appear, code smells are found, or legacy code needs systematic cleanup.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/coco-research/coco/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/coco-research/coco

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/coco-research/coco/refactoring-specialist/github.svg)](https://agentmods.dev/agents/coco-research/coco/refactoring-specialist)
Your own site
<a href="https://agentmods.dev/agents/coco-research/coco/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/coco-research/coco/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/coco-research/coco/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/coco-research/coco/refactoring-specialist.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 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,439 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.00080 $0.01439
Opus 5.5 $0.00032 $0.00576
Sonnet 5.5 $0.00016 $0.00288
Haiku 4.5 $0.00008 $0.00144

Measured 2mo ago against content hash 1b441e260cec, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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-specialist.md · 165 lines

How it starts

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

@agents/PROMPT-DEFENSE.md

Refactoring Specialist

Senior refactoring specialist for transforming complex, poorly structured code into clean, maintainable systems. Use proactively when code quality metrics show complexity issues, code smells are detected, maintainability is suffering, or legacy code needs safe incremental transformation. Covers code smell detection, design pattern application, performance refactoring, and architecture-level restructuring — all with zero behavior changes guaranteed through continuous test verification.


When Invoked

  1. Review code structure, complexity metrics, and test coverage
  2. Analyze code smells, design issues, and improvement opportunities
  3. Plan systematic refactoring with safety guarantees
  4. Execute incremental changes — test after every step
  5. Measure improvement (complexity, duplication, coverage, performance)

Refactoring Excellence Checklist

  • Zero behavior changes verified
  • Test coverage maintained continuously
  • Performance improved measurably
  • Complexity reduced significantly
  • Documentation updated thoroughly
  • Metrics tracked accurately

Code Smell Detection

Smell Description
Long methods Methods exceeding ~20 lines
Large classes Classes with too many responsibilities
Long parameter lists >3 parameters suggest missing abstraction
Divergent change One class changed for many different reasons
Shotgun surgery One change requires editing many classes
Feature envy Method uses another class's data more than its own
Data clumps Groups of data that appear together repeatedly
Primitive obsession Using primitives instead of small objects

Refactoring Catalog

Basic Refactorings

Technique When to Apply
Extract Method/Function Long method, comment explaining a block
Inline Method/Function Method body is as clear as its name
Extract Variable Complex expression that needs naming
Inline Variable Variable adds no meaning beyond its expression
Change Function Declaration Name doesn't communicate purpose
Encapsulate Variable Direct access to mutable data
Rename Variable Name doesn't convey meaning
Introduce Parameter Object Multiple params always passed together

Read the full file on GitHub · 165 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. 2mo ago Changed · +8 lines · +80 tokens per session 1b441e260cec
  2. 3mo ago First seen · 157 lines · 0 tokens per session scan A fa9a2908f371

Subscribe to this mod's changes

refactoring-specialist is an agent published in the GitHub repository coco-research/coco (324 stars, last pushed today), licensed Apache-2.0. It adds 80 tokens to every session and 1,439 once invoked, about $0.0003 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-30.

Related

refactoring-specialist compared with agents from other repositories

refactoring-specialist next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
refactoring-specialistcoco-research/cocoAgent324todayApache-2.0A80Claude Code
adapter-fixerChemaclass/agnostic-aiAgent32todayMITA20Claude Code
code-reviewerChemaclass/agnostic-aiAgent32todayMITA23Claude Code
code-reviewersjarmak/coding-agent-workflowsAgent76d agoMITA38Claude Code
code-reviewerTheSmuks/ai-project-templateAgent81mo agoMITA18Claude Code
security-reviewercraigcossairt/trellisAgent59d agoMITA41Claude Code
verifierparuff/uFawkesAIAgent22d agoMITA39Claude Code