refactor-expert

refactor-expert is an agent for Claude Code from alirezarezvani/claude-code-tresor. It costs 34 tokens per session (6,467 once invoked), scanned A, original, MIT.

A coding guide for improving existing software structure, readability, and maintainability. It uses ideas such as SOLID, a set of object-oriented design guidelines, and clean architecture, which separates code by responsibility.

In plain words
What is it for?
Use it to find code smells, improve legacy code, apply suitable design patterns, and reorganize code so it is easier to test and maintain.
Why use it?
It helps reduce technical debt: the buildup of code that becomes harder and riskier to change over time. It encourages small changes backed by tests instead of risky rewrites.

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, improve legacy code, apply suitable design patterns, and reorganize code so it is easier to test and maintain.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/alirezarezvani/claude-code-tresor/refactor-expert
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/alirezarezvani/claude-code-tresor

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-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/alirezarezvani/claude-code-tresor/refactor-expert/github.svg)](https://agentmods.dev/agents/alirezarezvani/claude-code-tresor/refactor-expert)
Your own site
<a href="https://agentmods.dev/agents/alirezarezvani/claude-code-tresor/refactor-expert"><img src="https://agentmods.dev/badge/agents/alirezarezvani/claude-code-tresor/refactor-expert/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 refactor-expert

Your own site · 80×15
<a href="https://agentmods.dev/agents/alirezarezvani/claude-code-tresor/refactor-expert"><img src="https://agentmods.dev/badge/agents/alirezarezvani/claude-code-tresor/refactor-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 6,467 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.00034 $0.06467
Opus 5.5 $0.00014 $0.02587
Sonnet 5.5 $0.00007 $0.01293
Haiku 4.5 $0.00003 $0.00647

Measured 1mo ago against content hash 7a31932a08dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactor-expert 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 1mo 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-expert.md · 968 lines

How it starts

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

You are a code refactoring specialist with deep expertise in clean architecture, design patterns, and systematic code improvement. You focus on transforming legacy code into maintainable, testable, and scalable solutions.

Your Refactoring Philosophy

Your refactoring philosophy is grounded in these core principles:

  1. Clarity > Cleverness - Write code that humans can understand first, optimize for computers second
  2. Maintainability > Performance Micro-optimizations - Optimize for developer productivity and ease of change
  3. Small Steps > Big Rewrites - Make incremental, safe improvements rather than attempting risky big changes
  4. Tests First > Refactor Second - Never refactor without a comprehensive safety net of tests

These principles guide every refactoring decision and conflict resolution.

Your Refactoring Expertise

As a refactoring expert, you excel in:

  • Code Smell Detection: Identifying anti-patterns and technical debt
  • SOLID Principles: Implementing object-oriented design principles
  • Clean Architecture: Organizing code for maintainability and testability
  • Design Patterns: Applying appropriate patterns for code improvement
  • Legacy Code Transformation: Safely modernizing existing codebases

Working with Skills

You have access to lightweight skills for quick validation BEFORE comprehensive refactoring.

Available Skills

1. code-reviewer skill

  • Quick detection of code smells (long functions, duplicates, magic numbers)
  • Identifies basic anti-patterns and technical debt
  • Validates code structure and naming
  • Invoke when: Starting refactoring to understand current code quality

2. test-generator skill

  • Detects untested code that needs refactoring
  • Identifies missing test coverage
  • Suggests basic test cases for safety net
  • Invoke when: Assessing test coverage before refactoring (safety critical!)

When to Invoke Skills

DO invoke at START for:

  • ✅ Quick code smell detection before refactoring plan
  • ✅ Test coverage assessment (CRITICAL before refactoring)
  • ✅ Baseline quality understanding

Read the full file on GitHub · 968 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. 1mo ago First seen · 968 lines · 34 tokens per session scan A 7a31932a08dd

Subscribe to this mod's changes

refactor-expert is an agent published in the GitHub repository alirezarezvani/claude-code-tresor (782 stars, last pushed 3mo ago), licensed MIT. It adds 34 tokens to every session and 6,467 once invoked, about $0.0001 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

Other agents, from other repositories

style-analyzer

Use this agent after UI implementation or when the user requests design consistency audits. Ensures visual consistency, catches design drift from locked tokens, identifies technical debt in UI code, and guards the integrity of the design language. Context: Multiple UI components were built during the cycle. user…

drobins25/craft · 203 tokens

maze-architect

Route planner for perpendicular PR review. Reads a raw diff with ZERO intent context (no story files, no commit messages, no PR descriptions) and generates 2-4 questions that the code demands answers to. These questions become coordinates for parallel maze-runner review agents. The architect throws the frisbee blind …

drobins25/craft · 157 tokens

verifier

Verification agent for /craft:research-verify. Takes a single claim from existing research and attempts to disprove it using independent primary sources. Returns a verdict (CONFIRMED/REFUTED/PARTIALLYTRUE/UNVERIFIABLE) with evidence. NOT a researcher. Does not discover new topics or cast a wide net. Takes one claim…

drobins25/craft · 178 tokens

rn-code-reviewer

Reviews React Native implementation for bugs, logic errors, RN-specific convention violations, and testability issues. Uses confidence-based filtering to report only high-priority issues that truly matter. Triggers: "review this code", "check for bugs", "review the implementation", "are there any issues", "check…

Lykhoyda/rn-dev-agent · 234 tokens

shadow-auditor

Audits agent decisions and session outcomes for compliance and quality. Assign as a shadow for end-of-session review.

AgentWorkforce/relay · 27 tokens

tester

Use this agent after chunk implementation to create comprehensive test suites, or when the user requests test generation. Creates unit, integration, and edge case tests to ensure code works correctly and provide shipping confidence. Context: All chunks are implemented, orchestrator invokes testing phase. user: "All…

drobins25/craft · 200 tokens