跳到正文
Skillpedia
通用编程8.1k · #12571

code-health

它能做什么

这项技能帮助你的 AI 判断代码库的健康程度,以及哪些文件最难维护。适合希望基于证据规划清理或重构工作的开发者。

适用场景

  • ✓当任务询问代码质量、复杂度或技术债务的时候。
  • ✓当你想知道接下来应重构哪些有风险或难以维护的文件的时候。
  • ✓当你需要为一次重构做前后健康度对比的时候。

技能链接

https://github.com/repowise-dev/repowise/blob/main/plugins/codex/skills/code-health/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/repowise-dev/repowise/blob/main/plugins/codex/skills/code-health/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“这个项目中哪些文件是我应该先重构的未测试热点?”

每周 5 个新技能,1 分钟读完。

工作原理

技能运行 Repowise 健康检查,依据可衡量的信号为每个文件打 1 到 10 分。它返回一份按优先级排序的修复清单,或你指定文件的检查结果。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Code Health with Repowise

Repowise scores every file 1–10 from deterministic markers — McCabe complexity, deep nesting, brain methods, class cohesion (LCOM4), god classes, clone detection, untested hotspots, function-level churn, ownership dispersion, and more. Zero LLM calls; pure local analysis. The weights are calibrated against a real defect corpus, so a low score means more likely to harbour bugs, not just bigger.

Pick the mode by what you pass

  • Dashboard: get_health() (no targets): fix_first, the ranked list of what to fix first, then repo-level KPIs and the lowest-scoring files. Start here for "how healthy is this codebase?" or "what should we clean up?".
  • Targeted — get_health(targets=["src/x.py", "src/y.py"]): per-file score and the specific marker findings driving it. Use before/after a refactor, or to explain why a file is flagged.

Useful include flags

get_health(targets=[...], include=[...]):

  • "biomarkers" — always return the findings list (what's wrong, where).
  • "refactoring" — deterministic, ranked refactoring suggestions (by impact/effort).
  • "coverage" — surface coverage data when it's been ingested.
  • "trend" — recent health snapshots + declining / predicted-decline signal.

include adds blocks; only=[...] subtracts them.

How to use the results

  1. For "what should I refactor?" → dashboard mode, lead with fix_first; open an item with get_health(fix_id=...) for its steps and the tests to run, and present the plan, not just the scores.
  2. Rank by weighted_deficit, not score — the score floors at 1.0.
  3. For a specific file → report the score, the top 2–3 marker findings, and what each one means in plain language. Avoid dumping the raw payload.
  4. Check unresolved before calling a file clean: a target listed there matched nothing, and not_indexed means run repowise update.
  5. Before editing a flagged file → cross-check get_risk(targets=[...]); a file that is both low-health and a churn hotspot deserves the most care.
  6. Untested-hotspot / coverage questions → tell the user coverage markers light up once they ingest a report: repowise coverage add cov.lcov (LCOV / Cobertura / Clover; a coverage.py .coverage also builds the per-test map), then repowise health --recompute to fold it into the scores.

CLI equivalents

  • repowise health — KPIs + lowest-scoring files
  • repowise health --refactoring-targets — ranked by impact / effort
  • repowise health --trend — snapshots + declining alerts
  • repowise coverage add <file> — ingest coverage, light up untested-hotspot

Error handling

If get_health reports no repository, suggest /prompts:repowise-init. Code health is computed even with a template-rendered wiki (no LLM needed), so it should be available whenever the repo is indexed.

常见问题

分数低是否意味着文件很大?

不是。技能说明,分数低表示该文件更可能隐藏错误。

它能显示测试覆盖的缺口吗?

能,前提是项目中已添加了覆盖率数据。

评分会使用 AI 模型吗?

不会。评分是确定性的,并且在本地进行。

详情

作者的原始描述

Use when the user asks about code health, code quality, complexity, technical debt, risky or hard-to-maintain files, what to refactor next, untested hotspots, or coverage gaps in a Repowise-indexed codebase (.repowise/ directory exists). Also use for before/after health reads when planning or finishing a refactor.

repo: repowise-dev/repowise

热度

GitHub 星标
8.1k
排名
#12571
许可证
AGPL-3.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能