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 cniska/skills --skill refactorgit clone --depth 1 https://github.com/cniska/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/cniska/skills/refactor)<a href="https://agentmods.dev/skills/cniska/skills/refactor"><img src="https://agentmods.dev/badge/skills/cniska/skills/refactor/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/cniska/skills/refactor"><img src="https://agentmods.dev/badge/skills/cniska/skills/refactor.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.00061 | $0.01458 |
| Opus 5.5 | $0.00024 | $0.00583 |
| Sonnet 5.5 | $0.00012 | $0.00292 |
| Haiku 4.5 | $0.00006 | $0.00146 |
Grade A, and why
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 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 — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor
Change a design without letting the old one leak into the new. Agents write code that looks like the code around them, so the shape a refactor leaves behind is the one every later change copies. Design is more than half of this work.
Choose the mode
- Refactor when the design is sound where it matters and the change can move in steps that each keep the tests green. If the code would be broken for longer than one step, it is not a refactor: stop and choose.
- Rewrite when the design is wrong across modules whose patterns interlock, so fixing one module leaves the old shapes in its neighbors for the next agent to copy. A rewrite needs requirements that say what done is, a spec or its acceptance criteria. Without them, write them first with the owner, or refactor.
Decide from the fix history, the backlog and the requirements, never from reading the code a rewrite would replace. For a refactor, design-review's module review then finds the causes to remove; a concern that spans folders, such as navigation, is scoped by what it does, not by file prefix.
The repo's own rules hold throughout: its commit gate, its docs-with-behavior rule, its glossary. This skill never overrides them. Where docs contradict the code or each other, the owner decides which is right; list each contradiction for them rather than picking one.
Refactor
- Pin the behavior. Where no test pins what the code does now, write tests at the outermost surface the refactor keeps, such as the app, the CLI or the HTTP API, that assert what it does today, bugs included, before moving anything. These are the tests that stay untouched; a test of an internal the refactor removes goes with that internal, once the outer tests cover what it checked.
- Make the change easy, then make the easy change. Before a feature the structure fights, reshape the structure first in its own commits, then add the feature.
- Keep structure and behavior in separate commits. A commit either changes structure, with the pinning tests untouched and green, or changes behavior. Where splitting them would take a shim, the commit changes both and its subject says it changes behavior.
- Fix each pattern once, cleanly, in one place first. Pick the module agents will copy from, give it the right shape in full, and let the rest follow it. Take the shape from
design-review's rules, never from the code beside it. - Delete what the new design supersedes in the same change. Leftover behavior, a second path, a shim or a flag keeping the old way alive is not carried forward. A refactor that removes more than it adds is the good kind; one that adds more is questioned.
- Use a codemod for a rule-based change. A rename, a signature change or a moved import across many files goes through a deterministic tool (the language server, an AST transform), not a model editing file by file.
- Review when a part is done, not per slice. When a module or a pattern is complete, run
design-reviewon it as a whole and fix every tier-1 finding before moving on.
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 · 58 lines · 61 tokens per session scan A d1f58da64124
refactor is a skill published in the GitHub repository cniska/skills (6 stars, last pushed 1mo ago), licensed MIT. It adds 61 tokens to every session and 1,458 once invoked, about $0.0002 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-10-05.
refactor compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| refactorcniska/skills | Skill | 6 | 1mo ago | MIT | A | 61 | Claude Code |
| autoreviewopenclaw/clawhub | Skill | 9.5k | today | MIT | A | 17 | Claude Code, Codex |
| agent-teams-simplify-and-hardenLeoYeAI/openclaw-master-skills | Skill | 2.2k | 6d ago | MIT | A | 115 | Claude Code, Codex |
| omh-code-reviewrlaope/oh-my-hermes | Skill | 5.2k | today | MIT | A | 48 | Claude Code, Codex |
| revdiff-planumputun/revdiff | Skill | 947 | 2d ago | MIT | A | 84 | Claude Code |
| explore-unknownsdzhng/skills | Skill | 1.4k | today | MIT | A | 162 | Claude Code, Codex |
| re0-mergeLilMGenius/paperthin | Skill | 1.4k | 4d ago | MIT | A | 70 | Claude Code |