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 agentmods add skills/razaib-khan/forgeweave/refactor-enginenpx skills add Razaib-khan/ForgeWeave --skill refactor-enginegit clone --depth 1 https://github.com/Razaib-khan/ForgeWeaveWrote 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/razaib-khan/forgeweave/refactor-engine)<a href="https://agentmods.dev/skills/razaib-khan/forgeweave/refactor-engine"><img src="https://agentmods.dev/badge/skills/razaib-khan/forgeweave/refactor-engine.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 | $0.00023 | $0.00607 |
| Opus 5 | $0.00012 | $0.00303 |
| Sonnet 5 | $0.00005 | $0.00121 |
| Haiku 4.5 | $0.00002 | $0.00061 |
Grade A, and why
Refactor Engine 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 4d 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.
Refactor Engine
Purpose
Restructure existing code to improve readability, performance, and maintainability while preserving exact external behavior. Every refactor is verified by ensuring existing tests continue to pass and no observable behavior changes.
When to Use
- Code has duplicated logic that should be extracted
- A function or module is too long or does too many things
- Naming is unclear or inconsistent with project conventions
- Performance can be improved by algorithmic changes
- Dead code, commented-out code, or unused imports need removal
When Not to Use
- The code has a bug — use
debuggerfirst - New features need to be added — use
code-builder - The code works fine and doesn't need changes
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
target |
string | Yes | File, module, or code area to refactor |
goal |
enum | Yes | clarity, performance, maintainability, or all |
constraints |
string | No | What must NOT change (public API, performance bounds) |
Expected Outputs
| Output | Description |
|---|---|
| Refactored code | Restructured code preserving external behavior |
| Diff summary | What changed and why |
| Verification | Test results confirming no behavior change |
Exact Workflow Steps
- Read and understand the target code fully
- Run existing tests to establish baseline
- Identify refactoring opportunities (duplication, complexity, naming)
- Apply one refactoring at a time (small, atomic changes)
- Run tests after each change to confirm no regression
- Repeat until all planned refactorings are applied
Required Checks
- All existing tests pass before and after
- No public API changed unless explicitly requested
- Each change is atomic (one concern per change)
- No dead code or debug artifacts left behind
Failure Modes
| Failure Condition | Response |
|---|---|
| Test fails after refactor | Revert last change and re-approach differently |
| Refactor touches too many files | Break into smaller, focused refactors |
| Goal is unclear | Ask for specific examples of what to improve |
What ships with it
2 files 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.
- 4d ago First seen · 84 lines · 23 tokens per session scan A de34351916f0
Refactor Engine is a skill published in the GitHub repository Razaib-khan/ForgeWeave (1 stars, last pushed 2mo ago), licensed MIT. It adds 23 tokens to every session and 607 once invoked, about $0.0001 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
performant-code
Writing efficient code that handles large data and tight constraints.
refactor
Refactor code to improve structure and maintainability.
absolute-simplify
Use when the user wants to simplify, clean up, refactor, tidy, or refine code — their staged/unstaged git changes or a target file/path. Reduces complexity, flattens nesting, removes redundancy and dead code, scores each change by value (holding low-value churn), then runs tests to prove nothing broke. Invoke on…
code-refactor
Implement safe, behavior-preserving code refactors after inspecting the existing project. Use when the user asks to refactor, split large files, extract methods, reduce duplication, rename, clean dead code, or says 重构代码, 拆分模块, 提取方法, 优化命名, 优化注释, 删除未调用代码. For broad requests, plan safe slices and wait for approval; for…
agenthub
Browse, create, and complete tasks on Clawsy AgentHub — a distributed task platform for AI agents. Create tasks from GitHub repos, PDF/DOCX/PPTX/audio URLs, or plain text. Use custom LLM validation, earn karma. Categories: content, data, research, creative.
deep-clean
Full-spectrum consolidation of AI agent configuration files. Goes beyond memory-only dream skills: audits and optimizes context files (AGENTS.md/AGENTS.md/GEMINI.md/.cursorrules), rules, skills, and memory. Detects stale references, dead file paths, duplicated rules, stack mismatches, contradictions, vague directives…