pre-modification-check
它能做什么
这项技能让你的 AI 在修改某个文件之前评估其风险。适合在由 Repowise 建立索引的项目中工作、希望避免破坏共享或脆弱代码的开发者。
适用场景
- ✓当你的 AI 即将编辑一个共享工具函数或核心模块的时候。
- ✓当你没有提到的某个文件,可能会因为连带效应而被修改的时候。
- ✓当你计划一起修改或删除多个文件,并希望先了解影响的时候。
技能链接
https://github.com/repowise-dev/repowise/blob/main/plugins/claude-code/skills/pre-modification/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在你修改支付辅助函数之前,请先检查哪些代码依赖它,以及它是否经常出问题。”
每周 5 个新技能,1 分钟读完。
工作原理
技能对该文件运行风险检查,报告其修复历史、依赖文件、通常与之一起变更的文件、主要负责人、测试缺口和安全信号。AI 在进行编辑之前会阅读这些结果。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Pre-Modification Check with Repowise
Before modifying files in a Repowise-indexed codebase, assess the impact.
Before editing a file
Call get_risk(targets=["path/to/file.py"]). Per file it returns
hotspot_score, trend, risk_type, impact_surface (top 3),
dependents_count, co_change_partners, primary_owner,
test_gap, and security_signals. Read it for:
- Bug-fix history (
defect_profile) — present only on files with counted fixes:fix_countover the trailing 6 months,last_fix_days_ago, abug_magnetflag for sustained recent fix pressure, andtop_symbols(the per-symbol counts are approximate — read them as "mostly here"). A file that keeps getting fixed is the strongest single signal that the next edit breaks something; lead with it. - Hotspot status (
hotspot_score,trend) — high-churn × complex? Extra care needed. - Dependents (
dependents_count,impact_surface) — how wide is the blast radius? - Co-change partners — files that change together with this one (often without an import link); you may need to update them too.
- Ownership / bus factor — who owns it, and whether a single author maintains it.
- Test gap & security signals — flag untested or security-sensitive files before touching them.
When modifying multiple files
Batch all targets into one call: get_risk(targets=["file1.py", "file2.py", "module/"]).
When to warn the user
If get_risk shows:
- A
defect_profilewithbug_magnetset — say so plainly: this file has been fixed repeatedly and recently - Hotspot score above 90th percentile — mention this is a frequently-changed, high-risk file
- More than 10 dependents — list the top dependents; API changes here will break consumers
- Bus factor of 1 — note that a single person maintains this code
- Risk type is "bug-prone" or "high-coupling" — flag explicitly before making changes
Before refactoring or moving code
Call get_context(targets=["file.py"]) first to understand the full context: what uses this file, what decisions govern it, and why it's structured this way. This prevents accidentally violating architectural decisions.
For a heavy refactor, also call get_health(targets=["file.py"]) — the
marker findings (complexity, deep nesting, low cohesion, duplication) tell
you what to improve while you're in there, and give you a before/after score.
Error handling
If get_risk returns a tool error, the MCP server may not be running. Proceed with the modification but note that risk assessment was unavailable.
常见问题
检查会告诉我什么?
它会显示错误修复历史、依赖它的文件数量、一起变更的文件、主要负责人,以及是否缺少测试。
它能同时检查多个文件吗?
能。技能建议把所有目标文件合并到一次检查中。
它会阻止编辑发生吗?
不会。它只是把风险告知改动,让 AI 可以规划额外的谨慎措施,或更新相关文件。
详情
作者的原始描述
Use before modifying, refactoring, or deleting files in a codebase that has Repowise indexed (indicated by a .repowise/ directory). Activates when Claude is about to edit code, especially shared utilities, core modules, or files the user didn't explicitly mention. Helps assess impact and avoid breaking things.
repo: repowise-dev/repowise
热度
- GitHub 星标
- 8.1k
- 排名
- #12569
- 许可证
- AGPL-3.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
architectural-decisions
8.1k帮你的智能体在修改架构之前,借助已记录的决定和历史,弄清代码为何是这样构建的。
change-review
8.1k帮你的智能体在合并前审查拉取请求或一组改动,显示风险、受影响的文件以及还应做哪些修改。
code-health
8.1k帮你的智能体逐个文件评估代码健康度,找出风险最高的文件,并决定接下来重构哪些,所用分析来自 Repowise。
codebase-exploration
8.1k帮你的智能体通过回答代码如何运作、谁调用了什么以及东西在哪里构建,快速了解一个陌生项目。