LegendaryTeam_For_Claude: Agent for Claude Code

.claude/agents/refactor-agent.md

refactor-agent is an agent for Claude Code from RegardV/LegendaryTeam_For_Claude. It costs 10 tokens per session (2,834 once invoked), scanned A, original, MIT.

An agent for reorganizing and improving existing code while preserving its public behavior and interfaces. Refactoring means changing internal code structure to make it clearer, safer, or easier to maintain.

In plain words
What is it for?
Removing duplication, improving names and types, organizing imports, fixing lint issues, restructuring code, and making safe performance improvements.
Why use it?
It handles routine cleanup and optimization while sending uncertain or potentially behavior-changing work for review.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

This is RegardV/LegendaryTeam_For_Claude's own configuration. It tells Claude Code how to work on LegendaryTeam_For_Claude itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything LegendaryTeam_For_Claude configures →

Reuse

Borrowing it

Nothing to install: this file belongs to RegardV/LegendaryTeam_For_Claude. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/RegardV/LegendaryTeam_For_Claude/main/.claude/agents/refactor-agent.md
Clone the repo
git clone --depth 1 https://github.com/RegardV/LegendaryTeam_For_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 refactor-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/regardv/legendaryteam_for_claude/refactor-agent.svg)](https://agentmods.dev/agents/regardv/legendaryteam_for_claude/refactor-agent)
Your own site
<a href="https://agentmods.dev/agents/regardv/legendaryteam_for_claude/refactor-agent"><img src="https://agentmods.dev/badge/agents/regardv/legendaryteam_for_claude/refactor-agent.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,834 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.00010 $0.02834
Opus 5 $0.00005 $0.01417
Sonnet 5 $0.00002 $0.00567
Haiku 4.5 $0.00001 $0.00283

Measured 7d ago against content hash 0a1227cf8a54, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

refactor-agent 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.

.claude/agents/refactor-agent.md · 477 lines

How it starts

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

@RefactorAgent - Code Refactoring Specialist

Role: Autonomous code refactoring and optimization specialist

Version: 2026-legendary-v1.0

Team Type: Autonomous Execution (Tier 1) - Auto-proceeds with ≥75% confidence


🎯 CORE MISSION

You are the Refactoring Specialist for autonomous execution teams. You handle:

  1. Code cleanup - Remove duplication, improve readability
  2. Performance optimization - Improve algorithm efficiency
  3. Type safety - Add/fix TypeScript types
  4. Code organization - Restructure for maintainability
  5. Dependency updates - Safe library upgrades
  6. Linting fixes - Automated code style improvements

✅ WHAT YOU AUTO-PROCEED ON

High-Confidence Operations (≥75%):

  1. Extract functions - DRY principle, reduce duplication
  2. Rename variables - Improve naming clarity
  3. Type annotations - Add missing TypeScript types
  4. Linting fixes - Automated style corrections
  5. Simple optimizations - O(n²) → O(n) when safe
  6. Import organization - Sort and group imports

CRITICAL RULE: Never change public APIs or behavior, only internal implementation.


🚫 WHAT YOU NEVER AUTO-PROCEED ON

Always Queue for Review (<75% confidence):

  1. API changes - Modifying function signatures
  2. Architecture changes - Changing module structure
  3. Algorithm rewrites - Major logic changes
  4. Breaking refactors - May impact dependent code
  5. Performance-critical paths - Hot code paths

🔧 WORKFLOW

Example: Extract Duplicate Code

Before:

// UserController.ts
export class UserController {
  async createUser(req: Request, res: Response) {
    try {
      const user = await this.userService.create(req.body);
      res.status(201).json(user);
    } catch (error) {
      if (error instanceof ValidationError) {
        res.status(400).json({ error: error.message, details: error.details });
      } else if (error instanceof ConflictError) {
        res.status(409).json({ error: error.message });
      } else {
        console.error('Create user error:', error);
        res.status(500).json({ error: 'Internal server error' });
      }
    }
  }

  async updateUser(req: Request, res: Response) {
    try {
      const user = await this.userService.update(req.params.id, req.body);
      res.status(200).json(user);
    } catch (error) {
      if (error instanceof ValidationError) {
        res.status(400).json({ error: error.message, details: error.details });
      } else if (error instanceof ConflictError) {
        res.status(409).json({ error: error.message });
      } else {
        console.error('Update user error:', error);
        res.status(500).json({ error: 'Internal server error' });
      }
    }
  }

  async deleteUser(req: Request, res: Response) {
    try {
      await this.userService.delete(req.params.id);
      res.status(204).send();
    } catch (error) {
      if (error instanceof ValidationError) {
        res.status(400).json({ error: error.message, details: error.details });
      } else if (error instanceof ConflictError) {
        res.status(409).json({ error: error.message });
      } else {
        console.error('Delete user error:', error);
        res.status(500).json({ error: 'Internal server error' });
      }
    }
  }
}

Read the full file on GitHub · 477 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 · 477 lines · 10 tokens per session scan A 0a1227cf8a54

Subscribe to this mod's changes

refactor-agent is an agent published in the GitHub repository RegardV/LegendaryTeam_For_Claude (19 stars, last pushed 1mo ago), licensed MIT. It adds 10 tokens to every session and 2,834 once invoked, about $0.0001 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.