rugged-gemini: Command for Gemini CLI

.gemini/commands/refactor.toml

refactor is a command for Gemini CLI from irahardianto/rugged-gemini. It costs 0 tokens per session (795 once invoked), scanned A, original, MIT.

A structured workflow for safely changing existing code in small steps.

In plain words
What is it for?
It is for extracting interfaces, splitting handlers, changing asynchronous code, and applying findings from tools such as linters or static analyzers.
Why use it?
It helps clarify the requested change, understand what it may affect, and check that behavior remains the same after refactoring.

Command for Gemini CLI

Written for Gemini CLI: installed under .gemini/.

This is irahardianto/rugged-gemini's own configuration. It tells 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/commands/refactor.toml
Clone the repo
git clone --depth 1 https://github.com/irahardianto/rugged-gemini

Made for: 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 refactor

README.md
[![agentmods](https://agentmods.dev/badge/commands/irahardianto/rugged-gemini/refactor.svg)](https://agentmods.dev/commands/irahardianto/rugged-gemini/refactor)
Your own site
<a href="https://agentmods.dev/commands/irahardianto/rugged-gemini/refactor"><img src="https://agentmods.dev/badge/commands/irahardianto/rugged-gemini/refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 795 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.00000 $0.00795
Opus 5 $0.00000 $0.00398
Sonnet 5 $0.00000 $0.00159
Haiku 4.5 $0.00000 $0.00080

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

Security

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 3d 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/commands/refactor.toml · 86 lines

How it starts

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

description = "Refactor existing code safely: 3-path requirement elicitation → impact analysis → incremental change → parity verification. Dispatches @refactoring-specialist for execution."

prompt = """

Refactor Workflow

Phase 0: Requirement Elicitation

Determine refactoring source before proceeding:

Path A — Human-Specified

User provides a specific, actionable target:

  • /refactor extract storage interface in task feature
  • /refactor split user handler into separate auth handler
  • /refactor migrate callbacks to async/await in notification service → Proceed directly to Phase 1

Path B — Tool-Driven

User references a static analysis tool as the requirement source:

  • /refactor from-deepsource — read DeepSource MCP findings
  • /refactor from-clippy — parse cargo clippy output
  • /refactor from-lint — parse linter output (ESLint, golangci-lint, ruff) → Parse tool findings → present summary → user approves scope → proceed to Phase 1

Supported tools:

Tool Integration
DeepSource MCP Read findings via deepsource MCP tools
cargo clippy Parse cargo clippy --message-format json
golangci-lint Parse golangci-lint run --out-format json
ESLint Parse npx eslint . --format json
ruff Parse ruff check . --output-format json
SonarQube Read via API if available

Path C — Discovery

User doesn't know what to refactor, or provides vague request:

  • /refactor discover — audit first, then refactor
  • /refactor apps/backend — too vague
  • /refactor improve code quality — what specific issue? → Dispatch SCOUT(@scout + @qa-analyst, code smell audit) → Present findings → user approves scope → proceed to Phase 1

Vague request without path → "Run /refactor discover to find issues, or specify a target like /refactor extract storage interface in task feature."

When to Use / NOT

Use: restructuring, pattern migration, breaking dep upgrades, QA findings, extracting interfaces, tool-driven cleanup. Don't: new features (orchestrator), small bugs (orchestrator Pattern B), "find improvements" without /refactor discover.

Read the full file on GitHub · 86 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. 3d ago First seen · 86 lines · 0 tokens per session scan A e9cc067b63b4

Subscribe to this mod's changes

refactor is a command published in the GitHub repository irahardianto/rugged-gemini (5 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 795 tokens. 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 commands, from other repositories

qa-changes

This skill should be used when the user asks to "QA a pull request", "test PR changes", "verify a PR works", "functionally test changes", or when an automated workflow triggers QA validation of code changes. Provides a structured methodology for setting up the environment, exercising changed behavior, and reporting…

OpenHands/extensions · 63 tokens

doctor

Diagnosticar y reparar problemas del framework Don Cheli, git y entorno. Usa cuando el usuario dice "doctor", "problemas del framework", "don cheli no funciona", "repair Don Cheli", "debug setup", "setup broken", "framework broken", "reparar entorno". Detecta y repara issues de configuración, git y dependencias…

doncheli/don-cheli-sdd · 76 tokens

fix

Universal debugging and fix application with semantic code analysis.

stefan-jansen/claude-code-toolkit · 9 tokens

gh-issue-use-cypress

Like /gh-issue-use-browser, but pinned to the Cypress MCP — use when your project runs the Cypress MCP for browser automation. Example — /gh-issue-use-cypress "Composer > Save" saving toasts failure but the record persists.

skyfox675/agents-skills · 49 tokens

http-service

Build, review or debug a Bun HTTP service. Loads the http-service skill, then works the task through its workflow.

MadAppGang/magus · 27 tokens

auditar-cascading

Invoca cascading-failures-auditor — audita serviço para 5 triggers de cascade (sem timeout, retry sem jitter, sem circuit breaker, sem deadline, queue unbounded) e gera CASCADING-AUDIT.md.

luanpdd/kit-mcp · 54 tokens