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

code-health

它能做什么

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

适用场景

  • ✓当你询问代码库的健康状况,或下一步应清理什么的时候。
  • ✓当你计划或完成一次重构,并想做前后对比的时候。
  • ✓当你想知道某个文件为何被标记为有风险或难以维护的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

请用这个技能帮我:https://github.com/repowise-dev/repowise/blob/main/plugins/claude-code/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 /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, which files are risky or hard to maintain, what to refactor next, untested hotspots, or coverage gaps in a Repowise-indexed codebase (.repowise/ directory exists). Also use to get a before/after health read when planning or finishing a refactor.

repo: repowise-dev/repowise

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能