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

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

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

可以这样问 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_count over the trailing 6 months, last_fix_days_ago, a bug_magnet flag for sustained recent fix pressure, and top_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_profile with bug_magnet set — 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能