| allowed-tools | ["Read","Grep","Glob","Bash"] |
| description | Use when modifying any existing file (excluding new standalone files) to analyze dependencies and calculate impact score. |
| name | impact-analysis |
| trigger | ์ํฅ ๋ถ์, ๋ณ๊ฒฝ ์ํฅ ๋ฒ์, ์์กด์ฑ ๋ถ์, impact analysis, check what this affects, before modifying files, ์์ ์ ์ํฅ๋ ํ์ธ, ๋ฆฌ๊ทธ๋ ์ด์
๋ฐฉ์ง, ์์กด์ฑ ์ถ์ , ํ๊ธ ํจ๊ณผ ๋ถ์, ์ํฅ๋ ์ ์ ๊ณ์ฐ, impact score, ๋ณ๊ฒฝ ์ ํ์ธ, ๋ฆฌํฉํ ๋ง ์ ๋ถ์, code impact, dependency chain, affected files, ์น์ธ ํ์ ํ์ธ, high impact check, before code change, dependency analysis |
| version | 4.0.0 |
Quick Reference
- ์คํ ์กฐ๊ฑด: ๋ชจ๋ ํ์ผ ์์ ์ ํ์ (์ ๊ท standalone ํ์ผ ์ ์ธ)
- ์น์ธ ๊ธฐ์ค: Impact Score > 7 ์ผ ๊ฒฝ์ฐ ๋ฐ๋์ Human Approval ํ์
- ์์กด์ฑ ํ์ธ: Grep ์ผ๋ก import/require ์ฒด์ธ ๋ฐ ํ
์คํธ ์ปค๋ฒ๋ฆฌ์ง ํ์ ์ ๊ฒ
- ๋ฆฌ์คํฌ ๊ด๋ฆฌ: ๊ณผ๊ฑฐ ๋ณ๊ฒฝ ์ด๋ ฅ (Memory Recall) ์์ deviation ์ ๋ฌด ํ์ธ
- ์ดํ ์กฐ์น: ๊ณ ์ํ ์ STATE.md ๊ฒ์ฆ ๋จ๊ณ ์ถ๊ฐ ๋ฐ ์ ์ง์ ๋กค์์ ๊ณํ ์๋ฆฝ
Procedure
Step 1: Identify Targets
List the files you intend to modify.
target_files = ["src/utils.ts", "src/models.ts"]
Step 2: Run Impact Analysis
Grep์ ์ฌ์ฉํ์ฌ ์์กด์ฑ ์ฒด์ธ์ ๋ถ์ํ๋ค.
# import/require ๊ฒ์์ผ๋ก ์์กด์ฑ ์ถ์
Grep(pattern: "from.*utils.*import|import.*utils|require.*utils", path: "src/", output_mode: "files_with_matches")
Grep(pattern: "from.*models.*import|import.*models|require.*models", path: "src/", output_mode: "files_with_matches")
# ํ
์คํธ ์ปค๋ฒ๋ฆฌ์ง ํ์ธ
Grep(pattern: "utils|models", path: "tests/", output_mode: "files_with_matches")
Step 3: Memory Recall (๊ณผ๊ฑฐ ๋ณ๊ฒฝ ์ด๋ ฅ)
bash .hxsk/hooks/md-recall-memory.sh "utils" "." 5 compact
๊ณผ๊ฑฐ deviation์ด๋ root-cause๊ฐ ์์ผ๋ฉด ์ฃผ์ ํ์.
Step 4: Review Impact Report
Check the following areas in the report:
| Area | What to Look For |
|---|
| Incoming Dependencies | Who calls these files? |
| Outgoing Dependencies | What do these files call? |
| High-Risk Warnings | Circular dependencies, core API usage |
| Test Coverage | Which tests cover this code? |
Step 5: Calculate Impact Score
| Factor | Score |
|---|
| 0-2 dependents | +1 |
| 3-5 dependents | +3 |
| 6+ dependents | +5 |
| Core/shared module | +2 |
| Has test coverage | -1 |
| No test coverage | +2 |
Impact Score > 7: Require human approval before proceeding.
Step 6: Plan Mitigation
If high impact is detected:
- Update
.hxsk/STATE.md to include verification steps
- Add affected dependent modules to test scope
- Consider incremental rollout strategy
Compliance Rules
| Rule | Description |
|---|
| Mandatory | You MUST NOT skip this step for any file modification |
| Exception | New standalone files don't require analysis |
| Escalation | If impact score > 7, require human approval before proceeding |
Output Format
=== Impact Analysis Report ===
Target: src/utils.ts
Impact Score: 5/10
Incoming Dependencies (3):
- src/api.ts:15
- src/services/auth.ts:8
- tests/test_utils.ts:1
Outgoing Dependencies (1):
- src/constants.ts
Test Coverage: YES (tests/test_utils.ts)
Recommendation: Safe to proceed with standard testing
===
Iron Laws
NO FILE MODIFICATION WITHOUT IMPACT ANALYSIS FIRST
NO PROCEEDING WITHOUT HUMAN APPROVAL FIRST WHEN IMPACT SCORE > 7
NO IMPACT ANALYSIS COMPLETE WITHOUT DEPENDENCY TRACING AND MEMORY RECALL FIRST
NO SKIP OF ANALYSIS WITHOUT VERIFICATION OF STANDALONE STATUS FIRST