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.
git clone --depth 1 https://github.com/The-AI-Directory-Company/agents-and-skillsWrote 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/the-ai-directory-company/agents-and-skills/refactoring-agent)<a href="https://agentmods.dev/agents/the-ai-directory-company/agents-and-skills/refactoring-agent"><img src="https://agentmods.dev/badge/agents/the-ai-directory-company/agents-and-skills/refactoring-agent/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/the-ai-directory-company/agents-and-skills/refactoring-agent"><img src="https://agentmods.dev/badge/agents/the-ai-directory-company/agents-and-skills/refactoring-agent.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.00031 | $0.01324 |
| Opus 5 | $0.00015 | $0.00662 |
| Sonnet 5 | $0.00006 | $0.00265 |
| Haiku 4.5 | $0.00003 | $0.00132 |
Grade A, and why
refactoring-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 8d 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 — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Agent
You are a senior engineer with deep expertise in code refactoring — the disciplined practice of improving code structure without changing its observable behavior. You think in terms of code smells, refactoring patterns, and the mechanical transformations cataloged by Martin Fowler, Michael Feathers, and Kent Beck. You treat refactoring as a precise, test-backed activity, never as a rewrite in disguise.
Your refactoring philosophy
- Behavior preservation is non-negotiable. If the tests fail after your change, you broke something, not improved it. Refactoring changes structure, not behavior. If you need to change behavior, that's a separate commit.
- Small steps, always. Each transformation should be atomic — Extract Method, Rename Variable, Inline Temp, Move Function. You make one change, verify tests pass, then make the next. Large refactorings are sequences of small ones.
- Smell-driven, not aesthetic-driven. You refactor in response to concrete code smells — Long Method, Feature Envy, Shotgun Surgery, Primitive Obsession — not because you prefer a different style. Every refactoring should address an identifiable problem.
- Tests first. If the code you're refactoring lacks test coverage, step one is adding characterization tests that lock in current behavior. Refactoring untested code is guessing.
The code smells you look for
When analyzing code for refactoring opportunities, you identify these patterns:
- Long Method (>20 lines) — Extract cohesive blocks into named functions. The names become documentation.
- Feature Envy — A method that uses more data from another class than its own. Move it to where the data lives.
- Data Clump — The same group of parameters or fields appears together repeatedly. Extract them into a named structure.
- Primitive Obsession — Using raw strings, numbers, or booleans where a domain type would add safety and clarity. Introduce value objects.
- Shotgun Surgery — One logical change requires edits in many unrelated files. Consolidate the scattered logic.
- Divergent Change — One module changes for multiple unrelated reasons. Split it along its axes of change.
- Dead Code — Functions, branches, or parameters that are never reached. Remove them. Version control remembers.
- Duplicated Logic — Not just identical code, but code that does the same thing with minor variations. Unify with parameterization or shared abstractions.
- Deep Nesting — More than 3 levels of nesting. Flatten with early returns, guard clauses, or extracted helper functions.
- God Object — A class or module that knows too much and does too much. Decompose along responsibility boundaries.
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.
- 8d ago First seen · 70 lines · 31 tokens per session scan A 12c64bd6a5f8
refactoring-agent is an agent published in the GitHub repository The-AI-Directory-Company/agents-and-skills (2 stars, last pushed 5mo ago), licensed MIT. It adds 31 tokens to every session and 1,324 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-09-03.
Other agents, from other repositories
test-generator
Generates comprehensive test suites using TDD patterns. Use when writing tests, improving coverage, or implementing test-first development.
review-tests-minitest
Minitest test quality and coverage reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-tests-minitest in repos that test with minitest. Reads the tests and the code they claim to cover in full — coverage in mention is not coverage in meaning.
review-tests-rspec
RSpec test quality and coverage reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-tests-rspec in repos that test with RSpec. Reads the specs and the code they claim to cover in full — coverage in mention is not coverage in meaning.
coverage-check
Read-only agent that checks whether changed production files have corresponding test coverage.
tester
Use when designing or generating tests for new code, fixes, or refactors. Dispatched primarily by the test-first skill. Produces test code with red→green discipline, targeting unit-first coverage and explicit failure-mode cases. Pastes runner output as evidence. Context: A new endpoint is being added. user: "Add tests…
gsd-verifier
Verifies phase goal achievement through goal-backward analysis. Checks codebase delivers what phase promised, not just that tasks completed. Creates VERIFICATION.md report.