code-health
它能做什么
这项技能帮助你的 AI 判断代码库的健康程度,以及哪些文件最难维护。适合希望基于证据规划清理或重构工作的开发者。
适用场景
- ✓当任务询问代码质量、复杂度或技术债务的时候。
- ✓当你想知道接下来应重构哪些有风险或难以维护的文件的时候。
- ✓当你需要为一次重构做前后健康度对比的时候。
技能链接
https://github.com/repowise-dev/repowise/blob/main/plugins/codex/skills/code-health/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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
- For "what should I refactor?" → dashboard mode, lead with
fix_first; open an item withget_health(fix_id=...)for its steps and the tests to run, and present the plan, not just the scores. - Rank by
weighted_deficit, notscore— the score floors at 1.0. - 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.
- Check
unresolvedbefore calling a file clean: a target listed there matched nothing, andnot_indexedmeans runrepowise update. - 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. - 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.coveragealso builds the per-test map), thenrepowise health --recomputeto fold it into the scores.
CLI equivalents
repowise health— KPIs + lowest-scoring filesrepowise health --refactoring-targets— ranked by impact / effortrepowise health --trend— snapshots + declining alertsrepowise 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
评论
- …
同一仓库的更多技能
architectural-decisions
8.1k帮你的智能体在修改架构之前,借助已记录的决定和历史,弄清代码为何是这样构建的。
change-review
8.1k帮你的智能体在合并前审查拉取请求或一组改动,显示风险、受影响的文件以及还应做哪些修改。
code-health
8.1k帮你的智能体逐个文件评估代码健康度,找出风险最高的文件,并决定接下来重构哪些,所用分析来自 Repowise。
codebase-exploration
8.1k帮你的智能体通过回答代码如何运作、谁调用了什么以及东西在哪里构建,快速了解一个陌生项目。