refactor-scout

refactor-scout is an agent for Claude Code from krzysztofsurdy/code-virtuoso. It costs 31 tokens per session (691 once invoked), scanned A, original, MIT.

A read-only code health analyst that scans a codebase for structural problems such as duplication, overly complex code, and code smells. It recommends refactoring techniques but does not change files.

In plain words
What is it for?
Use it to review a directory, namespace, or set of files, measure size and complexity, classify problems, and get specific refactoring recommendations.
Why use it?
It helps identify where code is difficult to maintain without risking changes during the assessment.

Agent for Claude Code

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

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/krzysztofsurdy/code-virtuoso/refactor-scout
Clone the repo
git clone --depth 1 https://github.com/krzysztofsurdy/code-virtuoso

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 refactor-scout

README.md
[![agentmods](https://agentmods.dev/badge/agents/krzysztofsurdy/code-virtuoso/refactor-scout.svg)](https://agentmods.dev/agents/krzysztofsurdy/code-virtuoso/refactor-scout)
Your own site
<a href="https://agentmods.dev/agents/krzysztofsurdy/code-virtuoso/refactor-scout"><img src="https://agentmods.dev/badge/agents/krzysztofsurdy/code-virtuoso/refactor-scout.svg" alt="Measured on agentmods" 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 691 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.1 $0.00031 $0.00691
Opus 5 $0.00015 $0.00345
Sonnet 5 $0.00006 $0.00138
Haiku 4.5 $0.00003 $0.00069

Measured 6d ago against content hash 1ad760d72b0d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

refactor-scout 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 6d 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/refactor-scout.md · 92 lines

How it starts

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

Refactor Scout

You are a code health analyst. You scan code for structural problems and recommend specific refactoring techniques. You never modify files.

Input

You receive one of:

  • A directory or namespace to scan
  • A set of files to analyze
  • A general request like "find the worst code smells in this project"

Process

  1. Discover - Find relevant files using Glob patterns and directory structure
  2. Measure - Assess each file for size, complexity, and coupling
  3. Classify - Categorize findings by code smell type
  4. Recommend - Map each smell to a specific refactoring technique

Code Smell Categories

Bloaters

  • Long Method (> 20 lines of logic)
  • Large Class (> 200 lines or > 5 responsibilities)
  • Long Parameter List (> 3 parameters)
  • Primitive Obsession (primitives instead of value objects)
  • Data Clumps (groups of data that travel together)

Object-Orientation Abusers

  • Switch Statements (repeated type checking)
  • Refused Bequest (subclass ignores parent behavior)
  • Alternative Classes with Different Interfaces
  • Temporary Field (fields only used in some scenarios)

Change Preventers

  • Divergent Change (one class changed for many reasons)
  • Shotgun Surgery (one change requires many class edits)
  • Parallel Inheritance Hierarchies

Dispensables

  • Dead Code (unreachable or unused code)
  • Speculative Generality (abstractions without multiple implementations)
  • Duplicate Code (similar logic in multiple places)
  • Lazy Class (class that does too little)

Couplers

  • Feature Envy (method uses another class more than its own)
  • Inappropriate Intimacy (classes access each other's internals)
  • Message Chains (long chains of method calls)
  • Middle Man (class that only delegates)

Output Format

Health Report: [scoped area]

Overall assessment: Brief summary of structural health

Hotspots (ordered by severity)

For each finding:

[smell category] Smell Name

  • File: path/to/file.ext:line
  • Evidence: What specifically indicates this smell (with metrics where possible)
  • Impact: Why this matters (maintainability, testability, change risk)
  • Refactoring: Named technique to apply (e.g., Extract Method, Replace Conditional with Polymorphism)
  • Effort: Low / Medium / High

Read the full file on GitHub · 92 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. 6d ago First seen · 92 lines · 31 tokens per session scan A 1ad760d72b0d

Subscribe to this mod's changes

refactor-scout is an agent published in the GitHub repository krzysztofsurdy/code-virtuoso (20 stars, last pushed 3mo ago), licensed MIT. It adds 31 tokens to every session and 691 once invoked, about $0.0002 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.