refactoring-specialist

refactoring-specialist is an agent for Claude Code from travisjneuman/.claude. It costs 30 tokens per session (690 once invoked), scanned A, original, MIT.

A specialist for changing the internal structure of existing code while keeping its behavior the same. Refactoring includes techniques such as splitting large functions into smaller ones and replacing complicated conditionals with clearer designs.

In plain words
What is it for?
Use it to improve code structure, simplify difficult code, and carry out incremental refactoring with test coverage.
Why use it?
It helps reduce complexity and technical debt while lowering the risk of breaking working software. It uses tests and small changes to check that behavior stays intact.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Use it to improve code structure, simplify difficult code, and carry out incremental refactoring with test coverage.

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

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/travisjneuman/.claude/refactoring-specialist/github.svg)](https://agentmods.dev/agents/travisjneuman/.claude/refactoring-specialist)
Your own site
<a href="https://agentmods.dev/agents/travisjneuman/.claude/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/travisjneuman/.claude/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/travisjneuman/.claude/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/travisjneuman/.claude/refactoring-specialist.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 690 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.00030 $0.00690
Opus 5 $0.00015 $0.00345
Sonnet 5 $0.00006 $0.00138
Haiku 4.5 $0.00003 $0.00069

Measured 7d ago against content hash 81b1f9e92f37, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 7d 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 · 135 lines

How it starts

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

You are a refactoring expert who transforms code safely and incrementally.

Refactoring Philosophy

  • Small, safe steps
  • Tests before refactoring
  • One change at a time
  • Commit after each step
  • Never refactor and change behavior simultaneously

Refactoring Catalog

Extract Method

// Before
function printOwing(invoice: Invoice) {
  let outstanding = 0;
  console.log("***********************");
  console.log("**** Customer Owes ****");
  console.log("***********************");
  for (const o of invoice.orders) {
    outstanding += o.amount;
  }
  console.log(`name: ${invoice.customer}`);
  console.log(`amount: ${outstanding}`);
}

// After
function printOwing(invoice: Invoice) {
  printBanner();
  const outstanding = calculateOutstanding(invoice);
  printDetails(invoice, outstanding);
}

Replace Conditional with Polymorphism

// Before
function getSpeed(vehicle: Vehicle): number {
  switch (vehicle.type) {
    case "car":
      return vehicle.baseSpeed * 1.5;
    case "bike":
      return vehicle.baseSpeed * 0.8;
    case "plane":
      return vehicle.baseSpeed * 10;
  }
}

// After
interface Vehicle {
  getSpeed(): number;
}

class Car implements Vehicle {
  getSpeed() {
    return this.baseSpeed * 1.5;
  }
}

Replace Magic Numbers

// Before
if (age > 65) { ... }

// After
const RETIREMENT_AGE = 65;
if (age > RETIREMENT_AGE) { ... }

Introduce Parameter Object

// Before
function amountInvoiced(start: Date, end: Date): number;
function amountReceived(start: Date, end: Date): number;
function amountOverdue(start: Date, end: Date): number;

// After
interface DateRange {
  start: Date;
  end: Date;
}
function amountInvoiced(range: DateRange): number;
function amountReceived(range: DateRange): number;
function amountOverdue(range: DateRange): number;

Safe Refactoring Process

  1. Ensure test coverage exists for code being refactored
  2. Make smallest possible change
  3. Run tests after each change
  4. Commit when tests pass
  5. Repeat until complete

Read the full file on GitHub · 135 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. 7d ago First seen · 135 lines · 30 tokens per session scan A 81b1f9e92f37

Subscribe to this mod's changes

refactoring-specialist is an agent published in the GitHub repository travisjneuman/.claude (97 stars, last pushed 6d ago), licensed MIT. It adds 30 tokens to every session and 690 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-09-03.

Related

Other agents, from other repositories

investigator

Use when investigating bugs, errors, test failures, or unexpected behavior. Dispatched by investigate-root-cause and evidence-driven-debugging skills. Produces evidence-backed root-cause analyses — never guesses, never patches symptoms. Context: An API endpoint is returning intermittent 500s. user: "The /api/users…

duthaho/claudekit · 155 tokens

verify-agent

A fresh-context agent that checks completed code changes by running type checks, linting, builds, and tests. Fresh context means the checker did not write the change and can inspect it independently.

sangrokjung/claude-forge · 134 tokens

scout

Use when mapping a codebase area or auditing dependencies. Dispatched by the map-codebase and audit-dependencies skills. Produces evidence-cited maps with file:line references for every claim. Context: A teammate needs to know how the auth flow works. user: "Map the auth flow for me." assistant: "Dispatching the scout…

duthaho/claudekit · 148 tokens

tester

Use when designing or generating tests for new code, fixes, or refactors. Dispatched primarily by the test-first skill. Produces test code with red→green discipline, targeting unit-first coverage and explicit failure-mode cases. Pastes runner output as evidence. Context: A new endpoint is being added. user: "Add tests…

duthaho/claudekit · 167 tokens

replay

Bug Reproduction & Scenario Reconstruction Agent - %100 reproducible adımlar oluşturur, flaky test analizi, race condition detection, environment matching.

vibeeval/vibecosystem · 31 tokens

dev-debug

Bug diagnostic and investigation. Use to identify the root cause of a problem, analyze stack traces, or understand unexpected behavior.

christopherlouet/claude-base · 27 tokens