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 Miaoge-Ge/coding-agent-skills --skill refactoring-expertgit clone --depth 1 https://github.com/Miaoge-Ge/coding-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/miaoge-ge/coding-agent-skills/refactoring-expert)<a href="https://agentmods.dev/skills/miaoge-ge/coding-agent-skills/refactoring-expert"><img src="https://agentmods.dev/badge/skills/miaoge-ge/coding-agent-skills/refactoring-expert.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.1 | $0.00071 | $0.00929 |
| Opus 5 | $0.00036 | $0.00464 |
| Sonnet 5 | $0.00014 | $0.00186 |
| Haiku 4.5 | $0.00007 | $0.00093 |
Grade A, and why
refactoring-expert 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 8d 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 — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Expert
Refactoring preserves behavior — full stop. Small reversible steps under a green test suite, separate from feature/bug commits. Refactor toward a goal, then stop.
When to Use
- Cleaning up, simplifying, or decoupling existing code.
- Addressing code smells (long functions, duplication, deep nesting, god objects, primitive obsession, feature envy).
- Preparing messy code before adding a feature ("make the change easy, then make the easy change").
- Paying down technical debt in legacy code.
When NOT to Use
- Adding behavior/features — that's not refactoring → relevant language skill.
- Fixing a defect →
debugging-expert. - Optimizing speed (may justify behavior/structure trade-offs) →
performance-expert.
Core Principles
1. Behavior must not change
- Refactoring changes structure, never observable behavior. Keep refactors in separate commits from features and bug fixes so review and rollback stay clean.
- If you find a bug mid-refactor, note it and fix it separately — don't smuggle a behavior change into a refactor.
2. Establish a safety net first
- Tests are what make refactoring safe. No tests around the code? Add characterization tests (capture current behavior, even if "wrong") before changing legacy code. Then refactor against green.
3. Small, reversible steps
- One named transformation at a time — Extract Function, Rename, Inline, Introduce Parameter Object, Replace Conditional with Polymorphism, Move Method — running tests after each. Commit frequently so any step is cheap to revert.
- Prefer IDE/automated refactorings (rename, extract) — they're safer than hand edits.
4. Target real smells, then stop
- Extract long functions into small, single-purpose, well-named ones. Remove duplication once a pattern is proven (rule of three — don't abstract on the first repeat).
- Flatten nesting with guard clauses/early returns. Replace magic numbers/flags with named constants/types. Improve names — good names delete the need for comments.
- Refactor in service of a goal (readability, an upcoming change), not endlessly. Don't gold-plate or add speculative generality (YAGNI).
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.
- 8d ago First seen · 84 lines · 71 tokens per session scan A af55db16a693
refactoring-expert is a skill published in the GitHub repository Miaoge-Ge/coding-agent-skills (5 stars, last pushed 3mo ago), licensed MIT. It adds 71 tokens to every session and 929 once invoked, about $0.0004 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
audit
Audits recent work against its Definition of Done and project patterns. Runs the test suite, compares code against the spec, and reports PASS / PARTIAL / FAIL. Also runs the Critical Gate — a safety scan of the diff for destructive or dangerous operations. Generates an incremental prompt pack for any gaps found. With…
replen
Triage today's Replen matches for this repo: a verdict and effort estimate per candidate, grounded in your code. Invoke with /replen or "what's new from Replen?".
codex
Delegate coding tasks to the OpenAI Codex CLI for features, refactoring, PR reviews, and batch fixes. Requires the codex CLI and typically a git repository.
analyze
Deep-analyzes the current codebase to discover stack, architecture, patterns, conventions, and pitfalls. Creates curated documentation in .vibeflow/ that persists and can be committed to git. Supports incremental updates, scoped deep-dives, interactive review, and satellite repo analysis. Use when setting up a…
vibeflow-audit
Audits implementation against its DoD and project patterns. Runs the test suite, compares code against the spec, and reports PASS / PARTIAL / FAIL. Also runs the Critical Gate — a safety scan of the diff for destructive or dangerous operations. With --consolidate-hotfixes, reclassifies hotfix trace docs against the…
sdd-tasks
Break an SDD change into implementation tasks. Trigger: orchestrator launches task planning for a change.