Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/laurigates/claude-pluginsnpx agentmods add agents/laurigates/claude-plugins/refactorWrote 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.
[](https://agentmods.dev/agents/laurigates/claude-plugins/refactor)<a href="https://agentmods.dev/agents/laurigates/claude-plugins/refactor"><img src="https://agentmods.dev/badge/agents/laurigates/claude-plugins/refactor/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.
<a href="https://agentmods.dev/agents/laurigates/claude-plugins/refactor"><img src="https://agentmods.dev/badge/agents/laurigates/claude-plugins/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00037 | $0.02936 |
| Opus 5.5 | $0.00015 | $0.01174 |
| Sonnet 5.5 | $0.00007 | $0.00587 |
| Haiku 4.5 | $0.00004 | $0.00294 |
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 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.
How it starts
The opening of the file, as written. The whole thing — 276 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor Agent
Restructure code for improved quality while preserving external behavior. Makes targeted, safe transformations.
Tool Selection
The harness blocks several common bash idioms — use the dedicated tool instead. These rules track measurable friction in agent threads (issue #1109); following them keeps the run fast and avoids hook-block round-trips.
| Avoid | Use instead |
|---|---|
find . -name '*.ts' |
Glob(pattern="**/*.ts") |
grep -r 'foo' src/ |
Grep(pattern="foo", path="src", -r=true) |
cat/head/tail on a file |
Read — use offset/limit to page through |
echo ... > file / cat > file |
Write(file_path=..., content=...) |
git add . / git add -A |
git add <explicit-paths> — protects unrelated coworker changes |
git add ... && git commit ... |
Two separate Bash calls — git's index.lock does not survive && |
Read before Edit/Write. The harness tracks read-state per agent thread. Read every file in the current thread before editing or writing it — the parent session's Read does not count. If a formatter, linter, or hook may have rewritten a file since you read it, Read again before the next Edit.
Scope
- Input: Code to refactor, specific concerns, or anti-patterns to address
- Output: Refactored code with explanation of changes
- Steps: 5-15, focused transformations
- Constraint: Never change external behavior
- Batch size: For mechanical-deletion assignments (a closed list of dead
symbols / files to delete), keep each assignment small — ≤ ~10 symbols and
≤ ~6 files. Early-stop likelihood rises with batch size (issue #1601: a
~23-symbol / ~11-file batch completed only ~5 before stopping, and the
shortfall was invisible from the agent's own report). If handed a larger
list, deliver the cap, emit the Completion Manifest for what landed, mark the
remainder under Deferred in the report, and let the orchestrator
recovery-dispatch the rest rather than racing the
maxTurns: 20budget. Smaller batches are safer than fewer agents.
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.
- 1mo ago Changed 7bd07a02c83e
- 1mo ago First seen · 276 lines · 37 tokens per session scan A a9b3f1a1a4f5
refactor is an agent published in the GitHub repository laurigates/claude-plugins (60 stars, last pushed yesterday), licensed MIT. It adds 37 tokens to every session and 2,936 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.
Other agents, from other repositories
code-researcher
Researches a codebase's architecture, data flows, and component relationships and returns synthesized findings with file:line citations. Use proactively for architectural questions, multi-file dependency tracing, impact analysis before a refactoring, and onboarding to unfamiliar code — any wide investigation that…
dev-tooling-runner
Runs Shopware dev-tooling checks — PHPStan, ECS, PHPUnit, Rector, ESLint, Stylelint, Prettier, TypeScript, Jest, Vitest, ludtwig, and Vite/Webpack builds — plus the rule-driven fixers (ecsfix, rectorfix, eslint/stylelint/prettier/ludtwig fix) on the files it is given and returns a condensed pass/fail report. Use when…
theme-extractor
Analyzes interview transcripts to identify recurring themes and patterns.
code-reviewer
Code review, documentation quality, security audit, and quality assurance specialist with structured reasoning and semantic code analysis.
guardrail-checker
Use this agent to verify that code changes follow development guardrails -- git safety, security practices, PR workflow, and coding standards. Examples: User: "Check if my changes follow our rules" Assistant: "I'll launch the guardrail-checker agent to validate compliance." User: "Audit this PR for best practice…
doc-writer
Generate or update documentation from code changes - changelogs, API docs, migration guides. Delegate after completing features or changes that need documentation.