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.
npx agentmods add commands/ruslan-korneev/claude-plugins/clean-refactorgit clone --depth 1 https://github.com/ruslan-korneev/claude-pluginsWrote 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/commands/ruslan-korneev/claude-plugins/clean-refactor)<a href="https://agentmods.dev/commands/ruslan-korneev/claude-plugins/clean-refactor"><img src="https://agentmods.dev/badge/commands/ruslan-korneev/claude-plugins/clean-refactor.svg" alt="Measured on agentmods" 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 | $0.00017 | $0.00821 |
| Opus 5 | $0.00009 | $0.00411 |
| Sonnet 5 | $0.00003 | $0.00164 |
| Haiku 4.5 | $0.00002 | $0.00082 |
Grade A, and why
clean: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.
How it starts
The opening of the file, as written. The whole thing — 184 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Command /clean:refactor
Suggest a specific refactoring for the indicated problem.
Instructions
Step 1: Determine refactoring type
| Smell | Refactoring |
|---|---|
long-method |
Extract Method |
long-params |
Introduce Parameter Object |
god-class |
Extract Class |
primitive |
Replace Primitive with Object |
switch |
Replace Conditional with Polymorphism |
duplicate |
Extract Method / Pull Up Method |
feature-envy |
Move Method |
deep-nesting |
Replace Nested Conditional with Guard Clauses |
Step 2: Read the code
Read the specified file and find the problematic area.
Step 3: Suggest refactoring
Extract Method (long-method)
# Before
def process_order(order):
# Validate (10 lines)
...
# Calculate (15 lines)
...
# Save (10 lines)
...
# After
def process_order(order):
validate_order(order)
totals = calculate_totals(order)
save_order(order, totals)
def validate_order(order): ...
def calculate_totals(order): ...
def save_order(order, totals): ...
Introduce Parameter Object (long-params)
# Before
def create_user(name, email, age, city, country, phone): ...
# After
@dataclass
class CreateUserRequest:
name: str
email: str
age: int
city: str
country: str
phone: str
def create_user(request: CreateUserRequest): ...
Extract Class (god-class)
# Before
class UserManager:
def create_user(self): ...
def send_email(self): ...
def generate_report(self): ...
# After
class UserRepository:
def create(self): ...
class EmailService:
def send(self): ...
class ReportGenerator:
def generate(self): ...
Replace Primitive with Object
# Before
email: str = "[email protected]"
# After
@dataclass(frozen=True)
class Email:
value: str
def __post_init__(self):
if "@" not in self.value:
raise ValueError(f"Invalid email: {self.value}")
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.
- 3d ago First seen · 184 lines · 17 tokens per session scan A 62c51868ca28
clean:refactor is a command published in the GitHub repository ruslan-korneev/claude-plugins (4 stars, last pushed 6mo ago), licensed MIT. It adds 17 tokens to every session and 821 once invoked, about $0.0001 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-08-31.
Other commands, from other repositories
contact-upsert
Create or update a contact, optionally assign to groups.
sheet-report
Analyze a Numbers or Excel file and generate a report with charts.
csv-to-numbers
Convert a CSV into a formatted Numbers workbook.
excel-to-numbers
Convert an Excel workbook to Numbers.
meeting-start
Detect the current meeting, start a Voice Memo recording, and mark attendance.
numbers-to-excel
Convert a Numbers document to Excel.