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 skills add chandrudp29/skillhub --skill refactor-agentgit clone --depth 1 https://github.com/chandrudp29/skillhubWrote 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/skills/chandrudp29/skillhub/refactor-agent)<a href="https://agentmods.dev/skills/chandrudp29/skillhub/refactor-agent"><img src="https://agentmods.dev/badge/skills/chandrudp29/skillhub/refactor-agent/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/skills/chandrudp29/skillhub/refactor-agent"><img src="https://agentmods.dev/badge/skills/chandrudp29/skillhub/refactor-agent.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.00032 | $0.01321 |
| Opus 5.5 | $0.00013 | $0.00528 |
| Sonnet 5.5 | $0.00006 | $0.00264 |
| Haiku 4.5 | $0.00003 | $0.00132 |
Grade A, and why
refactor-agent 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 1mo 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 — 201 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor Agent
Safe refactoring that improves code without breaking it. Tests before, tests after.
When to Use
- "This function is too long"
- "This code is hard to understand"
- "There's too much duplication"
- "Cyclomatic complexity is too high"
- Before adding a feature to messy code
The Refactoring Rule
Never refactor and change behavior in the same commit.
Refactoring = same inputs, same outputs, better structure. If you're changing behavior, that's a different commit.
Before You Refactor
- Make sure tests exist. If they don't, write them first.
- Run the tests. They must be green before you start.
- Understand what the code does — don't refactor code you don't understand.
- Identify the specific smell you're fixing. Don't refactor everything at once.
The Six Most Valuable Refactors
1. Extract Function
When a function does more than one thing, or a block of code deserves a name:
# Before — what does this block do?
def process_order(order):
total = 0
for item in order.items:
price = item.price
if item.is_member:
price = price * 0.9
if item.quantity > 10:
price = price * 0.85
total += price * item.quantity
if total > 1000:
order.shipping = 0
else:
order.shipping = 15
order.total = total + order.shipping
order.status = "confirmed"
send_confirmation_email(order)
# After — each piece has a name
def process_order(order):
order.total = calculate_order_total(order)
order.shipping = calculate_shipping(order.total)
order.status = "confirmed"
send_confirmation_email(order)
def calculate_item_price(item) -> float:
price = item.price
if item.is_member:
price *= 0.9
if item.quantity > 10:
price *= 0.85
return price * item.quantity
def calculate_order_total(order) -> float:
return sum(calculate_item_price(item) for item in order.items)
def calculate_shipping(order_total: float) -> float:
return 0 if order_total > 1000 else 15
What ships with it
1 file 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.
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.
- 1mo ago First seen · 201 lines · 32 tokens per session scan A 110c052d057f
refactor-agent is a skill published in the GitHub repository chandrudp29/skillhub (14 stars, last pushed 3mo ago), licensed MIT. It adds 32 tokens to every session and 1,321 once invoked, about $0.0001 per session on Opus 5.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-30.
Other skills, from other repositories
refactoring-workflow
Improve the structure of existing code without changing its behaviour, in small verified steps under a green test suite. Use when the user asks to refactor, clean up, restructure or simplify code, wants to reduce duplication or coupling, is preparing a codebase for a feature it cannot currently accommodate, or when…
aposd-audit
Quantitative design audit. Counts pass-throughs, duplication, doc gaps, naming issues, and exceptions across 5 dimensions, scored 0-4.
finding-duplicate-functions
Use when auditing a codebase for semantic duplication — functions that do the same thing but have different names or implementations, especially common in LLM-generated codebases.
evolutionary-naming
Use when refactoring code with poor names, when asked to improve naming, or when a user struggles to name a class/method/variable. Symptoms include -Manager/-Util suffixes, single-letter variables, process/handle/do verbs, primitive obsession, god methods with multiple responsibilities. Two modes — audit (broad scan…
software-code-refactoring
Improve production code quality while preserving all existing test behavior. Commonly used for the Refactor phase of TDD red-green-refactor, but applicable to any codebase with tests. Use when production code works but needs cleanup — reducing duplication, improving naming, simplifying complexity, aligning with…
code-review
Review local code changes. Uses an isolated sub-agent for unbiased analysis when the main agent wrote the code; reviews directly in fresh review-only sessions. Checks correctness, conventions, performance, tests, security, and tech design compliance. Use when the user wants a code review or says "review the diff" /…