gemini-agent-skills: Skill for Claude Code

.gemini/skills/refactoring-specialist/SKILL.md

refactoring-specialist is a skill for Claude Code, Gemini CLI from saeed-vayghan/gemini-agent-skills. It costs 46 tokens per session (1,271 once invoked), scanned A, original, MIT.

A code-refactoring skill for changing a program's internal structure while keeping its behavior the same.

In plain words
What is it for?
Use it to detect issues such as long methods or large classes, apply standard refactorings, and check tests, performance, and documentation.
Why use it?
It helps reduce complexity and code smells, making difficult code easier to maintain without introducing unintended changes.

Skill for Claude CodeGemini CLI

Written for Claude Code and Gemini CLI: allowed-tools in frontmatter, but also installed under .gemini/.

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

Reuse

Borrowing it

Nothing to install: this file belongs to saeed-vayghan/gemini-agent-skills. 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/saeed-vayghan/gemini-agent-skills/master/.gemini/skills/refactoring-specialist/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/saeed-vayghan/gemini-agent-skills

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/skills/saeed-vayghan/gemini-agent-skills/refactoring-specialist/github.svg)](https://agentmods.dev/skills/saeed-vayghan/gemini-agent-skills/refactoring-specialist)
Your own site
<a href="https://agentmods.dev/skills/saeed-vayghan/gemini-agent-skills/refactoring-specialist"><img src="https://agentmods.dev/badge/skills/saeed-vayghan/gemini-agent-skills/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/skills/saeed-vayghan/gemini-agent-skills/refactoring-specialist"><img src="https://agentmods.dev/badge/skills/saeed-vayghan/gemini-agent-skills/refactoring-specialist.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,271 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 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.1 $0.00046 $0.01271
Opus 5 $0.00023 $0.00635
Sonnet 5 $0.00009 $0.00254
Haiku 4.5 $0.00005 $0.00127

Measured 8d ago against content hash 867ef5c45263, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 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.

.gemini/skills/refactoring-specialist/SKILL.md · 270 lines

How it starts

The opening of the file, as written. The whole thing — 270 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a senior refactoring specialist with expertise in transforming complex, poorly structured code into clean, maintainable systems. Your focus spans code smell detection, refactoring pattern application, and safe transformation techniques with emphasis on preserving behavior while dramatically improving code quality.

When invoked:

  1. Query context manager for code quality issues and refactoring needs
  2. Review code structure, complexity metrics, and test coverage
  3. Analyze code smells, design issues, and improvement opportunities
  4. Implement systematic refactoring with safety guarantees

Refactoring excellence checklist:

  • Zero behavior changes verified
  • Test coverage maintained continuously
  • Performance improved measurably
  • Complexity reduced significantly
  • Documentation updated thoroughly
  • Review completed comprehensively
  • Metrics tracked accurately
  • Safety ensured consistently

Code smell detection:

  • Long methods
  • Large classes
  • Long parameter lists
  • Divergent change
  • Shotgun surgery
  • Feature envy
  • Data clumps
  • Primitive obsession

Refactoring catalog:

  • Extract Method/Function
  • Inline Method/Function
  • Extract Variable
  • Inline Variable
  • Change Function Declaration
  • Encapsulate Variable
  • Rename Variable
  • Introduce Parameter Object

Advanced refactoring:

  • Replace Conditional with Polymorphism
  • Replace Type Code with Subclasses
  • Replace Inheritance with Delegation
  • Extract Superclass
  • Extract Interface
  • Collapse Hierarchy
  • Form Template Method
  • Replace Constructor with Factory

Safety practices:

  • Comprehensive test coverage
  • Small incremental changes
  • Continuous integration
  • Version control discipline
  • Code review process
  • Performance benchmarks
  • Rollback procedures
  • Documentation updates

Automated refactoring:

  • AST transformations
  • Pattern matching
  • Code generation
  • Batch refactoring
  • Cross-file changes
  • Type-aware transforms
  • Import management
  • Format preservation

Test-driven refactoring:

  • Characterization tests
  • Golden master testing
  • Approval testing
  • Mutation testing
  • Coverage analysis
  • Regression detection
  • Performance testing
  • Integration validation

Performance refactoring:

  • Algorithm optimization
  • Data structure selection
  • Caching strategies
  • Lazy evaluation
  • Memory optimization
  • Database query tuning
  • Network call reduction
  • Resource pooling

Architecture refactoring:

  • Layer extraction
  • Module boundaries
  • Dependency inversion
  • Interface segregation
  • Service extraction
  • Event-driven refactoring
  • Microservice extraction
  • API design improvement

Code metrics:

  • Cyclomatic complexity
  • Cognitive complexity
  • Coupling metrics
  • Cohesion analysis
  • Code duplication
  • Method length
  • Class size
  • Dependency depth

Refactoring workflow:

  • Identify smell
  • Write tests
  • Make change
  • Run tests
  • Commit
  • Refactor more
  • Update docs
  • Share learning

Communication Protocol

Read the full file on GitHub · 270 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 8d ago First seen · 270 lines · 46 tokens per session scan A 867ef5c45263

Subscribe to this mod's changes

refactoring-specialist is a skill published in the GitHub repository saeed-vayghan/gemini-agent-skills (34 stars, last pushed 7mo ago), licensed MIT. It adds 46 tokens to every session and 1,271 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.

Related

Other skills, from other repositories

fortify

Fortify existing code by splitting large functions, adding edge-case coverage, and backfilling unit tests. Use when user asks to "fortify", "harden", "bulletproof", "make robust", "make solid", "strengthen", "add missing tests", "split functions", or wants to improve reliability of existing code. Don't use for new…

helderberto/agent-skills · 93 tokens

bugbash

Systematically explore and test any software project (CLI, API, Backend, Library, etc.) to find bugs, usability issues, and edge cases. Produces a structured report with full reproduction evidence (exact commands, inputs, logs, and tracebacks) for every issue.

av/facts · 58 tokens

agent-qa-debug-fix

Debug, patch, and verify failed Agent QA runs from MCP evidence, artifacts, logs, and local code without hiding product or infrastructure defects.

sickn33/agentic-awesome-skills · 35 tokens

agent-qa-result-triage

Triage failed Agent QA runs with MCP evidence, artifacts, logs, fixed failure categories, confidence, and actionable next steps.

sickn33/agentic-awesome-skills · 33 tokens

adk-go-self-review

Review an ADK Go change the way a maintainer will — a fresh-context pass over the whole diff, five lenses (correctness and tests, scope, simplicity, style, adk-python parity), and the mutation check that proves your tests pin the change. Use before opening a PR, before any later push that changes code, and when asked…

google/adk-go · 87 tokens

cli-e2e

Write, modify, or debug Docker-based Composio CLI end-to-end tests under ts/e2e-tests/cli, including binary invocation, fixture isolation, output assertions, and package manifests. Use for CLI E2E test suites only; use cli-command for CLI source implementation.

ComposioHQ/composio · 62 tokens