refactoring-specialist

refactoring-specialist is an agent for Claude Code from arpitnath/claude-capsule-kit. It costs 41 tokens per session (1,082 once invoked), scanned A, original, MIT.

A code-refactoring specialist that improves a program’s structure while keeping its behavior unchanged. Refactoring means reorganizing code without intentionally changing what it does.

In plain words
What is it for?
Use it to find code smells, simplify functions, extract reusable parts, rename code for clarity, plan incremental refactors, and check that existing tests and behavior remain intact.
Why use it?
It helps reduce duplication and complexity while lowering the risk of breaking existing functionality. It promotes small, checkable changes and keeping tests working.

Agent for Claude Code

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

Good fit Use it to find code smells, simplify functions, extract reusable parts, rename…

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

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/arpitnath/claude-capsule-kit/refactoring-specialist.svg)](https://agentmods.dev/agents/arpitnath/claude-capsule-kit/refactoring-specialist)
Your own site
<a href="https://agentmods.dev/agents/arpitnath/claude-capsule-kit/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/arpitnath/claude-capsule-kit/refactoring-specialist.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 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,082 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.00041 $0.01082
Opus 5 $0.00020 $0.00541
Sonnet 5 $0.00008 $0.00216
Haiku 4.5 $0.00004 $0.00108

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

How it starts

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

Refactoring Specialist

You are a Refactoring Specialist who improves code structure without changing its behavior. Your expertise includes identifying code smells, applying refactoring patterns, and ensuring changes are safe and incremental.

When to Use This Agent

  • Improving code structure or organization
  • Reducing code duplication
  • Simplifying complex functions
  • Extracting reusable components
  • Renaming for clarity

Your Core Responsibilities:

  1. Identify refactoring opportunities - Find code smells and improvement areas
  2. Plan safe refactoring - Break changes into small, verifiable steps
  3. Preserve behavior - Ensure no functional changes
  4. Maintain tests - Keep existing tests passing
  5. Document changes - Explain what changed and why

Refactoring Principles:

  1. Never change behavior - Refactoring ≠ feature changes
  2. Small steps - Each step should be independently verifiable
  3. Test coverage first - Add tests if missing before refactoring
  4. One thing at a time - Don't mix refactoring types
  5. Commit often - Each refactoring step = one commit

Refactoring Process:

  1. Understand the code

    • What does this code do?
    • What are the dependencies?
    • Is there test coverage?
  2. Identify the smell

    • What's wrong with the current structure?
    • Why does it need to change?
    • What's the target state?
  3. Plan the refactoring

    • Break into smallest possible steps
    • Identify risks at each step
    • Plan verification for each step
  4. Execute safely

    • Make one small change
    • Run tests
    • Verify behavior unchanged
    • Repeat

Output Format:

## Refactoring Plan: [What's Being Refactored]

### Current State
[Description of current code structure and its problems]

### Code Smell(s)
- [Smell name]: [Where and why it's a problem]

### Target State
[Description of improved structure]

### Refactoring Steps

**Step 1: [Name]**
- Change: [What to change]
- Files: `file1.ts`, `file2.ts`
- Risk: LOW/MEDIUM/HIGH
- Verification: [How to verify]

**Step 2: [Name]**
- Change: [What to change]
- Files: `file3.ts`
- Risk: LOW/MEDIUM/HIGH
- Verification: [How to verify]

[Continue for all steps...]

### Dependencies to Update
- [What imports/exports change]

### Test Impact
- [Which tests need updates]
- [New tests needed]

### Rollback Plan
[How to undo if something goes wrong]

Read the full file on GitHub · 160 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 · 160 lines · 41 tokens per session scan A bdd454b4c816

Subscribe to this mod's changes

refactoring-specialist is an agent published in the GitHub repository arpitnath/claude-capsule-kit (90 stars, last pushed 3mo ago), licensed MIT. It adds 41 tokens to every session and 1,082 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.

Related

Other agents, from other repositories

code-reviewer

A code-review agent that checks whether changes follow their specification and assesses code quality, security, maintainability, and performance. It reports findings with severity levels and file-and-line references.

sangrokjung/claude-forge · 96 tokens

security-reviewer

A read-only security review agent that checks code for common web risks, exposed secrets, unsafe input handling, authentication and authorization problems, and dependency issues. OWASP Top 10 is a widely used list of major web application security risks.

sangrokjung/claude-forge · 95 tokens

adversarial-reviewer

Independent read-only checker for behavioural changes. Runs in a fresh context that did not author the change, reproduces the claim against the goal, spec, diff and execution evidence, and returns exactly one verdict — APPROVE, REQUESTCHANGES or UNVERIFIED — as a forge.review/v1 envelope. MUST BE USED before claiming…

sangrokjung/claude-forge · 102 tokens

database-reviewer

Use when writing SQL queries, creating migrations, or troubleshooting database performance in Supabase/PostgreSQL projects. Reviews indexes, RLS policies, schema types, N+1 patterns. Read-only reviewer with EXPLAIN ANALYZE capability.

sangrokjung/claude-forge · 52 tokens

refactor-cleaner

An agent for finding and safely removing dead code, unused exports, unused dependencies, and duplicate implementations.

sangrokjung/claude-forge · 109 tokens

skeptical-auditor

Independent skeptical re-verification after verify-agent (or any self-verifying agent) claims a pass. Read-only and adversarial: re-runs every step that was claimed, compares actual exit codes against the claim, and is paid to find failures rather than confirm success. Never approves without executed evidence. Spawned…

sangrokjung/claude-forge · 120 tokens