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 Sagargupta16/claude-skills --skill refactoringgit clone --depth 1 https://github.com/Sagargupta16/claude-skillsWrote 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/sagargupta16/claude-skills/refactoring)<a href="https://agentmods.dev/skills/sagargupta16/claude-skills/refactoring"><img src="https://agentmods.dev/badge/skills/sagargupta16/claude-skills/refactoring/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/sagargupta16/claude-skills/refactoring"><img src="https://agentmods.dev/badge/skills/sagargupta16/claude-skills/refactoring.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.00051 | $0.01573 |
| Opus 5 | $0.00026 | $0.00787 |
| Sonnet 5 | $0.00010 | $0.00315 |
| Haiku 4.5 | $0.00005 | $0.00157 |
Grade A, and why
refactoring 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 10d 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 — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Patterns
Quick Reference
| Task | Approach |
|---|---|
| Extract function/method | Identify repeated or complex block, extract with clear name |
| Rename safely | Find all references first, rename, run tests |
| Move file/module | Update all imports, check for re-exports, run tests |
| Reduce duplication | Extract shared logic only when used 3+ times |
| Migrate JS -> TS | File by file, start with strictest config, add types gradually |
| Migrate CJS -> ESM | Update require/module.exports to import/export, fix package.json |
| Simplify conditionals | Replace nested if/else with early returns or guard clauses |
Safe Refactoring Workflow
- Verify tests pass before touching anything
- Make one change at a time -- don't combine refactors
- Run tests after each change to catch regressions immediately
- Commit frequently -- each refactor step gets its own commit
- Never mix refactoring with behavior changes in the same commit
Code Smell Detection
| Smell | Symptom | Refactoring |
|---|---|---|
| Long function | > 30 lines or does multiple things | Extract method |
| Duplicate code | Same logic in 3+ places | Extract shared function |
| Deep nesting | > 3 levels of if/for/try | Early returns, extract helper |
| Long parameter list | > 4 parameters | Introduce parameter object |
| Feature envy | Method uses another class's data more than its own | Move method |
| God class/module | One file does everything | Split by responsibility |
| Dead code | Unreachable or unused code | Delete it |
| Primitive obsession | Raw strings/ints for domain concepts | Introduce value types |
| Shotgun surgery | One change requires editing many files | Consolidate related logic |
| Middle man | Class that only delegates | Remove and call directly |
Extract Patterns
Extract Function
Before:
def process_order(order):
# validate
if not order.items:
raise ValueError("Empty order")
if order.total < 0:
raise ValueError("Negative total")
# calculate tax
tax = order.total * 0.08
if order.state == "CA":
tax = order.total * 0.0975
order.tax = tax
order.final_total = order.total + tax
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.
- 10d ago First seen · 194 lines · 51 tokens per session scan A 692cfa6da664
refactoring is a skill published in the GitHub repository Sagargupta16/claude-skills (5 stars, last pushed 3d ago), licensed MIT. It adds 51 tokens to every session and 1,573 once invoked, about $0.0003 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 skills, from other repositories
coordinate-readmes
Coordinate a Foundry plugin's Claude and Codex README editions, preserving common product content and verifying platform-specific installation, availability and benchmark evidence. Use for paired README edits, benchmark updates or a README parity review before release.
phpunit-test-team-reviewing
Use this skill when the user asks for a team-based, consensus, multi-reviewer, or red-team review of Shopware PHPUnit tests — trigger phrases like "team review these tests", "consensus review the tests in PR.
phpunit-test-reconciling
Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.
audit-comment-residue
Classify code comments for four residue shapes. History narration ("used to… now…"), plan/session references ("Task 2 replaces the old…", "in this PR"), conversational antecedents ("per your request", "as you asked"), and ticket/PR/branch back-references a future reader will never see. Emitting Tier 1 (remove) and…
issue-analyzing
Use this skill when the user asks to analyze a specific GitHub issue, understand what area of code an issue affects, assess an issue's scope, or research the code context around an issue — example triggers like "analyze issue.
pr-analyzing
Use this skill when the user asks to analyze a specific GitHub pull request, review a PR's architectural impact, assess what changed in a PR and why it matters, or research the code relationships affected by a PR — example triggers like "analyze PR.