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 metago-ai/metagolifeform --skill metago-refactor-suggestgit clone --depth 1 https://github.com/metago-ai/metagolifeformWrote 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/metago-ai/metagolifeform/metago-refactor-suggest)<a href="https://agentmods.dev/skills/metago-ai/metagolifeform/metago-refactor-suggest"><img src="https://agentmods.dev/badge/skills/metago-ai/metagolifeform/metago-refactor-suggest/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/metago-ai/metagolifeform/metago-refactor-suggest"><img src="https://agentmods.dev/badge/skills/metago-ai/metagolifeform/metago-refactor-suggest.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.00074 | $0.01321 |
| Opus 5 | $0.00037 | $0.00660 |
| Sonnet 5 | $0.00015 | $0.00264 |
| Haiku 4.5 | $0.00007 | $0.00132 |
Grade A, and why
metago-refactor-suggest 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 12d 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 — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.
重构建议(metago-refactor-suggest)
描述
检测代码异味、量化技术债务、识别重构机会,生成含优先级和影响范围的重构方案。遵循行为保持变换(Behavior Preservation)原则,确保重构不改变外部行为。
触发条件
- 用户请求重构、代码优化、技术债务评估时激活
- 代码审查发现可维护性问题时联动触发
- 定期技术债务盘点
- 与
metago-code-review-deep协同:审查发现 Minor/Major 问题时触发
核心流程
1. 代码异味检测
- 长函数(行数 > 阈值,默认 50 行)
- 大类(字段/方法数 > 阈值)
- 重复代码(相似度 > 80%)
- 过长参数列表(参数数 > 5)
- 发散式修改(一个类因多个原因修改)
- 霰弹式修改(一个修改引发多处变更)
- 特性依恋(方法调用大量其他类)
- 数据泥团(多个变量总是一起出现)
2. 复杂度量分析
- 圈复杂度(Cyclomatic Complexity)> 10 需重构
- 认知复杂度(Cognitive Complexity)> 15 需重构
- 继承深度(DIT)> 4 需关注
- 耦合度(CBO)> 10 需优化
3. 依赖分析
- 循环依赖检测
- 不稳定依赖(依赖不稳定模块)
- 上层依赖下层(违反依赖倒置)
- 过度耦合(一个模块依赖过多模块)
4. 重构机会识别
| 异味类型 | 推荐重构手法 | 优先级 | 影响范围 |
|---|---|---|---|
| 长函数 | Extract Method | 高 | 函数级 |
| 重复代码 | Extract Method / Pull Up Method | 高 | 类级 |
| 大类 | Extract Class | 中 | 模块级 |
| 过长参数 | Introduce Parameter Object | 低 | 函数级 |
| 特性依恋 | Move Method | 中 | 类级 |
| 循环依赖 | Extract Class / Move Method | 高 | 模块级 |
5. 重构方案生成
- 重构步骤分解(原子化操作)
- 行为保持验证(测试覆盖要求)
- 风险评估(回归概率)
- 前后对比(复杂度、可读性、可维护性指标)
输出格式
【重构建议报告】
## 1. 技术债务概览
债务等级:🟢 低 / 🟡 中 / 🔴 高
债务量化:预估 N 人天
热点模块:path/to/module
## 2. 代码异味清单
| # | 异味 | 位置 | 严重度 | 推荐手法 |
|---|------|------|--------|----------|
| 1 | 长函数(85行) | file.ext:L10-L95 | 🟡 Major | Extract Method |
| 2 | 重复代码(92%相似) | file.ext:L20 / file2.ext:L15 | 🔴 Critical | Extract Method |
| ... | ... | ... | ... | ... |
## 3. 重构方案(按优先级排序)
### 方案1:[重构名称]
- 目标:...
- 步骤:
1. ...
2. ...
3. ...
- 测试要求:覆盖率达 X%
- 风险评估:低 / 中 / 高
- 预期收益:复杂度 15→8,可读性 +40%
### 方案2:...
## 4. 重构前后对比
| 指标 | 重构前 | 重构后 | 改善 |
|------|--------|--------|------|
| 圈复杂度 | 18 | 6 | -67% |
| 重复率 | 35% | 5% | -86% |
| 可维护性 | 4.2/10 | 8.1/10 | +93% |
## 5. 建议执行顺序
1. 先补充测试(当前覆盖率 X%)
2. 执行方案1(低风险高收益)
3. 执行方案2(...)
与其他技能的协同
- 与
metago-code-review-deep协同:审查发现可维护性问题时触发重构建议 - 与
metago-coupling-optimize协同:耦生度量化指导重构优先级 - 与
metago-critique协同:重构方案需通过批判性分析 - 与
metago-decision-lock协同:重构执行前需通过决策锁校验 - 与
metago-fact-check协同:验证重构前后行为一致性
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.
- 12d ago First seen · 117 lines · 74 tokens per session scan A 4b12de70182c
metago-refactor-suggest is a skill published in the GitHub repository metago-ai/metagolifeform (4 stars, last pushed 10d ago), licensed MIT. It adds 74 tokens to every session and 1,321 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
vue-best-practices
A review checklist for Vue 2 and Vue 3 components, covering component names, prop declarations, TypeScript casts, API styles and complex template expressions.
plugin-quality
A review guide for checking Zhin.js plugins before release. It covers plugin structure, feature declarations, resource cleanup, message sending, and security.
rust-review
A Rust code-review skill for services, checking for crashes, unsafe SQL construction, exposed credentials, ignored errors, and unfinished code.
review-skill
Inspect, safely test, and assess one Runx skill package for capability, trust, and operator readiness. Use when deciding whether to adopt, improve, reject, install, or publish a skill; its evidence-only assess runner is available when native test evidence already exists.
github-pr-comment
Post one exact GitHub pull-request comment through local gh, any compatible hosted connector, or the explicit human-gated MCP composition, with retry safety and independent readback.
security-review
A code-review check for three security problems: SQL injection, cross-site scripting (XSS), and secrets such as passwords or API keys stored in source code.