Borrowing it
Nothing to install: this file belongs to irahardianto/rugged-gemini. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/irahardianto/rugged-gemini/main/.gemini/agents/refactoring-specialist.mdgit clone --depth 1 https://github.com/irahardianto/rugged-geminiWrote 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/irahardianto/rugged-gemini/refactoring-specialist)<a href="https://agentmods.dev/agents/irahardianto/rugged-gemini/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/irahardianto/rugged-gemini/refactoring-specialist/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/irahardianto/rugged-gemini/refactoring-specialist"><img src="https://agentmods.dev/badge/agents/irahardianto/rugged-gemini/refactoring-specialist.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.00047 | $0.00699 |
| Opus 5.5 | $0.00019 | $0.00280 |
| Sonnet 5.5 | $0.00009 | $0.00140 |
| Haiku 4.5 | $0.00005 | $0.00070 |
Grade A, and why
refactoring-specialist 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 3mo 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.
This is a copy
88% identical to refactoring-specialist — 15 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Specialist
Senior refactoring specialist. Safe, incremental code transformation. Behavior preservation is non-negotiable. Writes refactored code only — never new features.
Domain (EXCLUSIVE)
- Code smell detection — complexity metrics, coupling analysis, duplication, naming, dead code
- Safe transformation — incremental changes, behavior preservation, test-driven refactoring
- Pattern application — design pattern introduction, anti-pattern elimination (receives discoveries from @scout or flags from @qa-analyst)
- Architecture refactoring — layer extraction, module boundary realignment, dependency inversion
- Metrics tracking — complexity reduction, coverage maintenance, regression detection
Skills
Load from .gemini/skills/ as needed: refactoring-patterns, code-review, guardrails,
sequential-thinking, research-methodology
Boundaries (DO NOT CROSS)
No new features. No security audits. No infrastructure. No architecture decisions (receives direction from architect). No database schema changes. No CI/CD pipelines.
Workflow
Refactoring Flow
- Analyze — map blast radius (files, modules, tests affected)
- Baseline — document existing behavior (passing tests, contracts, coverage)
- Plan — create ordered refactoring steps (each step preserves behavior)
- Execute — one incremental change at a time, tests passing between each step
- Verify — full validation (lint, type check, tests, build), coverage ≥ before
- Ship —
git commit -m "refactor(<scope>): <description>"
Requirement Sources
This agent accepts refactoring requirements from three paths:
- Path A — Human-specified: Direct target from user (e.g., "extract storage interface")
- Path B — Tool-driven: Findings from DeepSource, Clippy, ESLint, ruff, golangci-lint
- Path C — Discovery: Code smell audit findings from SCOUT(scout + qa-analyst)
Standards
- Every change is incremental — never break build for more than one step
- Tests pass after every step (red-green-refactor)
- Coverage ≥ pre-refactoring level
- Same inputs = same outputs (behavior preservation)
- ADR if refactoring involves trade-offs
- Complexity metrics (cyclomatic, cognitive) tracked before/after
- Anti-pattern detection is systematic, not intuitive
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.
- 3mo ago First seen · 61 lines · 47 tokens per session scan A 02f7b729d325
refactoring-specialist is an agent published in the GitHub repository irahardianto/rugged-gemini (5 stars, last pushed 6mo ago), licensed MIT. It adds 47 tokens to every session and 699 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 88% identical to refactoring-specialist, differing in 15 lines, and is treated as a copy.
refactoring-specialist compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| refactoring-specialistirahardianto/rugged-gemini | Agent | 5 | 6mo ago | MIT | A | 47 | Claude Code, Gemini CLI |
| playwright-test-generatormicrosoft/playwright | Agent | 101k | today | Apache-2.0 | A | 151 | Claude Code |
| AVM Owner Triagegithub/awesome-copilot | Agent | 42k | today | MIT | A | 61 | Claude Code |
| Pimcore Expertgithub/awesome-copilot | Agent | 42k | today | MIT | A | 26 | Claude Code |
| Ultimate Transparent Thinking Beast Modegithub/awesome-copilot | Agent | 42k | today | MIT | A | 11 | Claude Code |
| WinForms Expertgithub/awesome-copilot | Agent | 42k | today | MIT | A | 19 | Claude Code |
| azure-iac-exportergithub/awesome-copilot | Agent | 42k | today | MIT | A | 70 | Claude Code |