一键导入
refactor-check
Safety analysis before refactoring -- dependency graph, test coverage, public API exposure, blast radius verdict.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Safety analysis before refactoring -- dependency graph, test coverage, public API exposure, blast radius verdict.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Review uncommitted changes using impact analysis. Quick local delta review with blast-radius detection.
Comprehensive PR review -- full branch diff against base, commit-by-commit analysis, breaking change detection, conventional commit verification.
Review only changes since last commit using impact analysis. Token-efficient delta review with automatic blast-radius detection.
Review a PR or branch diff using the knowledge graph for full structural context. Outputs a structured review with blast-radius analysis.
Build or update the code review knowledge graph. Run this first to initialize, or let hooks keep it updated automatically.
基于 SOC 职业分类
| name | refactor-check |
| description | Safety analysis before refactoring -- dependency graph, test coverage, public API exposure, blast radius verdict. |
| argument-hint | <function or class name> [intended change] |
Analyze whether a refactoring is safe BEFORE making changes. Produces a verdict with specific risks and mitigation steps.
Get the full dependency graph for the target:
graph(action="update") to ensure graph is currentquery(action="query", pattern="callers_of", target="<name>") -- who calls thisquery(action="query", pattern="callees_of", target="<name>") -- what this callsquery(action="query", pattern="imports_of", target="<name>") -- what this importsquery(action="query", pattern="inheritors_of", target="<name>") and query(action="query", pattern="children_of", target="<name>")Identify test coverage:
query(action="query", pattern="tests_for", target="<name>") -- direct teststests_for to see if callers have integration tests covering this function indirectlyFlag public API exposure:
__init__.py, index.ts, or similarEstimate blast radius:
query(action="impact", target="<name>") -- full impact analysisProduce verdict:
## Refactor Safety: <name>
### Target
- **Location**: <file_path>:<line>
- **Type**: function / class / method
- **Public API**: Yes / No
### Dependency Summary
- **Callers**: N functions depend on this
- **Callees**: Calls M other functions
- **Inheritance**: N subclasses (if class)
### Test Coverage
- **Direct tests**: N tests
- **Caller tests**: M/K callers have tests covering this path
- **Coverage gaps**: <list uncovered callers>
### Blast Radius
- **Impacted files**: N
- **Impacted functions**: M
- **Max depth**: K hops
### Verdict: SAFE / NEEDS MIGRATION / DANGEROUS
**SAFE** -- Low blast radius (<5 files), good test coverage, no public API exposure.
Make the change, run tests, done.
**NEEDS MIGRATION** -- Public API or moderate blast radius (5-15 files).
Recommended approach:
1. Create new version alongside old
2. Migrate callers incrementally
3. Deprecate old version
4. Remove after all callers migrated
**DANGEROUS** -- High blast radius (>15 files), poor test coverage, or public API with external consumers.
Specific risks:
- <risk 1 with affected files>
- <risk 2 with affected files>
Mitigation: <steps to reduce risk before proceeding>
| Condition | Verdict |
|---|---|
| <5 impacted files, not public API, >80% caller test coverage | SAFE |
| 5-15 impacted files OR public API with known consumers | NEEDS MIGRATION |
| >15 impacted files OR public API with unknown consumers OR <50% test coverage | DANGEROUS |
| Any external package/library depends on it | DANGEROUS |