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 h4vzz/awesome-ai-agent-skills --skill refactoringgit clone --depth 1 https://github.com/h4vzz/awesome-ai-agent-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/h4vzz/awesome-ai-agent-skills/refactoring)<a href="https://agentmods.dev/skills/h4vzz/awesome-ai-agent-skills/refactoring"><img src="https://agentmods.dev/badge/skills/h4vzz/awesome-ai-agent-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/h4vzz/awesome-ai-agent-skills/refactoring"><img src="https://agentmods.dev/badge/skills/h4vzz/awesome-ai-agent-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.00023 | $0.01792 |
| Opus 5 | $0.00012 | $0.00896 |
| Sonnet 5 | $0.00005 | $0.00358 |
| Haiku 4.5 | $0.00002 | $0.00179 |
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 11d 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.
This is a copy
91% identical to refactoring — 2 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 177 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Code Refactoring
This skill guides an AI agent through the disciplined process of restructuring existing code without changing its external behavior. Refactoring improves readability, reduces complexity, and makes the codebase easier to extend and maintain. The agent identifies code smells, proposes targeted refactoring patterns, applies transformations safely, and verifies correctness through tests.
Workflow
-
Identify Code Smells: Scan the target code for common quality issues — long functions, deeply nested conditionals, duplicated logic, overly broad variable scoping, magic numbers, dead code, and large parameter lists. Flag each smell with its location and a brief explanation of why it harms the codebase.
-
Select Refactoring Patterns: For every identified smell, choose the most appropriate refactoring pattern. Common patterns include Extract Method, Rename Symbol, Simplify Conditional, Inline Variable, Replace Magic Number with Named Constant, Remove Dead Code, and Introduce Parameter Object. Explain the trade-offs and expected improvement for each proposed change.
-
Plan the Change Order: Determine a safe sequence for applying refactorings. Prefer small, independent changes that can each be verified in isolation. Group related changes (e.g., extracting a helper then renaming it) and avoid interleaving unrelated transformations that make rollback difficult.
-
Apply Refactorings: Transform the code one pattern at a time. Preserve the original public API and behavior. Use language-idiomatic constructs — list comprehensions in Python, destructuring in JavaScript, pattern matching in Rust, etc.
-
Run Tests and Verify: Execute the existing test suite after each transformation. If no tests exist, generate lightweight unit tests covering the refactored paths before and after the change. Confirm that all tests pass and that no regressions have been introduced.
-
Document Changes: Summarize each refactoring applied, the smell it addressed, and any follow-up improvements that are now possible. This summary serves as a commit message or PR description.
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.
- 11d ago First seen · 177 lines · 23 tokens per session scan A d4b92b9bd786
refactoring is a skill published in the GitHub repository h4vzz/awesome-ai-agent-skills (34 stars, last pushed 2d ago), licensed MIT. It adds 23 tokens to every session and 1,792 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 91% identical to refactoring, differing in 2 lines, and is treated as a copy.
Other skills, from other repositories
cost-optimizer
Trigger when the user asks to audit Claude Code costs, reduce token spend, says "my Claude bill is too high", "optimize my CLAUDE.md", "why is this project burning tokens", or "/cost-optimizer". Scans a project for the common Claude Code cost leaks and returns a prioritized fix list.
excalidraw-architecture
Trigger when the user asks for an architecture diagram, says "draw the system", "update the architecture diagram", "give me an excalidraw of this codebase", or "/excalidraw-architecture". Generates or updates an Excalidraw JSON file at docs/architecture.excalidraw by reading the codebase's key entry points.
model-cost-compare
Trigger when the user asks which model to use, wants to compare model costs, says "what's cheapest for this task", "should I use Opus or Sonnet", "can a smaller model handle this", or "/model-cost-compare". Estimates token cost across Opus 4.6, Sonnet 4.6, GLM-5.1, Minimax M2.7, and local Gemma 4, then recommends the…
openclaw-debugger
Trigger when an OpenClaw agent is broken, silent, crashing, stuck, not responding, returning empty output, or the user says "my agent is down", "agent not working", "/openclaw-debugger". Walks through the standard OpenClaw 2026.4 diagnosis checklist and prints a report.
growth-ideas
Describe your product or project and get three actionable growth ideas tailored to your stage.
meeting-notes
Paste raw meeting notes and get a clean summary with key decisions and action items.