rugged-gemini: Agent for Claude Code

.gemini/agents/refactoring-specialist.md

refactoring-specialist is an agent for Claude Code, Gemini CLI from irahardianto/rugged-gemini. It costs 47 tokens per session (699 once invoked), scanned A, a copy of refactoring-specialist, MIT.

A coding agent that improves existing code without adding new features. Refactoring means changing the code's structure while keeping what it does the same.

In plain words
What is it for?
Use it to find code smells, simplify complex code, remove dead code, apply established design patterns, reorganise module boundaries, and track complexity and test coverage.
Why use it?
It helps reduce duplicated, confusing, or overly complex code while checking that existing behaviour remains intact.

Agent for Claude CodeGemini CLI

Written for Gemini CLI and Claude Code: installed under .gemini/, but also a Claude Code subagent (agents/*.md).

This is irahardianto/rugged-gemini's own configuration. It tells Claude Code and Gemini CLI how to work on rugged-gemini 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 rugged-gemini configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/irahardianto/rugged-gemini/main/.gemini/agents/refactoring-specialist.md
Clone the repo
git clone --depth 1 https://github.com/irahardianto/rugged-gemini

Made for: Claude Code, Gemini CLI.

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 refactoring-specialist

README.md
[![agentmods](https://agentmods.dev/badge/agents/irahardianto/rugged-gemini/refactoring-specialist/github.svg)](https://agentmods.dev/agents/irahardianto/rugged-gemini/refactoring-specialist)
Your own site
<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.

agentmods 80×15 button for refactoring-specialist

Your own site · 80×15
<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>
Per session 47 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 699 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 88% copy Near-identical to another mod 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.00047 $0.00699
Opus 5 $0.00023 $0.00349
Sonnet 5 $0.00009 $0.00140
Haiku 4.5 $0.00005 $0.00070

Measured 9d ago against content hash 02f7b729d325, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

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 9d 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.

Origin

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.

.gemini/agents/refactoring-specialist.md · 61 lines

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)

  1. Code smell detection — complexity metrics, coupling analysis, duplication, naming, dead code
  2. Safe transformation — incremental changes, behavior preservation, test-driven refactoring
  3. Pattern application — design pattern introduction, anti-pattern elimination (receives discoveries from @scout or flags from @qa-analyst)
  4. Architecture refactoring — layer extraction, module boundary realignment, dependency inversion
  5. 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

  1. Analyze — map blast radius (files, modules, tests affected)
  2. Baseline — document existing behavior (passing tests, contracts, coverage)
  3. Plan — create ordered refactoring steps (each step preserves behavior)
  4. Execute — one incremental change at a time, tests passing between each step
  5. Verify — full validation (lint, type check, tests, build), coverage ≥ before
  6. 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

Read the full file on GitHub · 61 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. 9d ago First seen · 61 lines · 47 tokens per session scan A 02f7b729d325

Subscribe to this mod's changes

refactoring-specialist is an agent published in the GitHub repository irahardianto/rugged-gemini (5 stars, last pushed 4mo ago), licensed MIT. It adds 47 tokens to every session and 699 once invoked, about $0.0002 per session on Opus 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.