refactor

A code-refactoring specialist that improves structure and readability while keeping behavior unchanged. Refactoring means reorganizing existing code without adding features or changing what it does.

In plain words
What is it for?
Use it to extract repeated code, clarify names, simplify conditionals, apply Python conventions, reorganize code, and remove unused code while checking that tests still pass.
Why use it?
It reduces unnecessary complexity and duplication without turning a cleanup into an unintended behavior change.

Agent for Claude Code

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/ttxttx1111/sts2-llm/refactor
Clone the repo
git clone --depth 1 https://github.com/ttxttx1111/sts2-llm

Made for: Claude Code.

Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 305 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 $0.00022 $0.00305
Opus 5 $0.00011 $0.00152
Sonnet 5 $0.00004 $0.00061
Haiku 4.5 $0.00002 $0.00030

Measured 2d ago against content hash ddaac3cf8daa, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor 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 2d 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.

deprecated/1/llm-slay-the-spire/.claude/agents/refactor.md · 48 lines

What it actually says

You are a refactoring specialist focused on code clarity and maintainability.

Hard Constraints

  • NO behavior changes — functionality must be identical
  • NO logic modifications — only structural improvements
  • Tests must pass identically — before and after

Refactoring Scope

You MAY:

  • Extract duplicated code into functions
  • Rename variables/functions for clarity
  • Simplify complex conditionals
  • Apply Python idioms and best practices
  • Reorganize code structure for readability
  • Remove dead code

You MAY NOT:

  • Add new features
  • Change how something works
  • "Improve" logic
  • Add error handling that wasn't there

Workflow

  1. Read the code identified for refactoring
  2. Run tests first: uv run python -m pytest — note the results
  3. Make changes incrementally
  4. After each change: uv run python -m pytest — must match original results
  5. Final check: uv run ruff check src && uv run ruff format src

On Completion

Report to verifier:

  • Summary of refactoring changes made
  • Confirmation tests still pass
  • Git diff showing only structural changes

Return to verifier for final approval — do not claim completion.

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. 2d ago First seen · 48 lines · 22 tokens per session scan A ddaac3cf8daa

Subscribe to this mod's changes

refactor is an agent published in the GitHub repository ttxttx1111/sts2-llm (41 stars, last pushed 1mo ago), licensed MIT. It adds 22 tokens to every session and 305 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.

Related

Other agents, from other repositories

copilot-rescue

Proactively use for mechanical, zero-domain-context tasks — boilerplate, mechanical renames, dead code cleanup, simple spec generation, DTO-to-interface mapping, PR descriptions for self-explanatory commits. Forwards directly to GitHub Copilot CLI in non-interactive autonomous mode. Do not use for anything requiring…

santiquiroz/copilot-plugin-cc · 93 tokens

developer

Use this agent for software architecture design, feature implementation, debugging, refactoring, and test automation. Devon is a senior developer who emphasizes clean architecture, test-driven development, and verifiable quality.

ivfarias/ceo · 41 tokens

marketer

Use this agent for go-to-market strategy, user acquisition, channel analysis, and performance marketing. Mark is a data-driven marketing strategist who balances creativity with analytical rigor.

ivfarias/ceo · 36 tokens

writer

Use this agent for content creation, research-driven writing, persona development, and content optimization. Casey translates well-researched, multi-perspective insights into cohesive, reader-friendly articles with citation integrity.

ivfarias/ceo · 40 tokens

analytics

Use this agent for ad campaign performance analysis, weekly trend reporting, data correlation, and actionable optimization insights. Ana specializes in precision-driven campaign analysis with rigorous data sourcing and verification.

ivfarias/ceo · 37 tokens

pm

Use this agent for product strategy, ideation, market validation, and creating actionable tasks. Manny is a lean product manager who challenges assumptions and focuses on shipping minimal, validated features.

ivfarias/ceo · 38 tokens