$npx -y skills add haoxiang-xu/PuPu --skill gitnexus-impact-analysisUse when the user wants to know what will break if they change something, or needs safety analysis before editing code. Examples: \"Is it safe to change X?\", \"What depends on this?\", \"What will break?\"
| 1 | # Impact Analysis with GitNexus |
| 2 | |
| 3 | ## When to Use |
| 4 | |
| 5 | - "Is it safe to change this function?" |
| 6 | - "What will break if I modify X?" |
| 7 | - "Show me the blast radius" |
| 8 | - "Who uses this code?" |
| 9 | - Before making non-trivial code changes |
| 10 | - Before committing — to understand what your changes affect |
| 11 | |
| 12 | ## Workflow |
| 13 | |
| 14 | ``` |
| 15 | 1. impact({target: "X", direction: "upstream"}) → What depends on this |
| 16 | 2. READ gitnexus://repo/{name}/processes → Check affected execution flows |
| 17 | 3. detect_changes() → Map current git changes to affected flows |
| 18 | 4. Assess risk and report to user |
| 19 | ``` |
| 20 | |
| 21 | > If "Index is stale" → run `node .gitnexus/run.cjs analyze` in terminal. |
| 22 | |
| 23 | ## Checklist |
| 24 | |
| 25 | ``` |
| 26 | - [ ] impact({target, direction: "upstream"}) to find dependents |
| 27 | - [ ] Review d=1 items first (these WILL BREAK) |
| 28 | - [ ] Check high-confidence (>0.8) dependencies |
| 29 | - [ ] READ processes to check affected execution flows |
| 30 | - [ ] detect_changes() for pre-commit check |
| 31 | - [ ] Assess risk level and report to user |
| 32 | ``` |
| 33 | |
| 34 | ## Understanding Output |
| 35 | |
| 36 | | Depth | Risk Level | Meaning | |
| 37 | | ----- | ---------------- | ------------------------ | |
| 38 | | d=1 | **WILL BREAK** | Direct callers/importers | |
| 39 | | d=2 | LIKELY AFFECTED | Indirect dependencies | |
| 40 | | d=3 | MAY NEED TESTING | Transitive effects | |
| 41 | |
| 42 | ## Risk Assessment |
| 43 | |
| 44 | | Affected | Risk | |
| 45 | | ------------------------------ | -------- | |
| 46 | | <5 symbols, few processes | LOW | |
| 47 | | 5-15 symbols, 2-5 processes | MEDIUM | |
| 48 | | >15 symbols or many processes | HIGH | |
| 49 | | Critical path (auth, payments) | CRITICAL | |
| 50 | |
| 51 | ## Tools |
| 52 | |
| 53 | **impact** — the primary tool for symbol blast radius: |
| 54 | |
| 55 | ``` |
| 56 | impact({ |
| 57 | target: "validateUser", |
| 58 | direction: "upstream", |
| 59 | minConfidence: 0.8, |
| 60 | maxDepth: 3 |
| 61 | }) |
| 62 | |
| 63 | → d=1 (WILL BREAK): |
| 64 | - loginHandler (src/auth/login.ts:42) [CALLS, 100%] |
| 65 | - apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%] |
| 66 | |
| 67 | → d=2 (LIKELY AFFECTED): |
| 68 | - authRouter (src/routes/auth.ts:22) [CALLS, 95%] |
| 69 | ``` |
| 70 | |
| 71 | **detect_changes** — git-diff based impact analysis: |
| 72 | |
| 73 | ``` |
| 74 | detect_changes({scope: "staged"}) |
| 75 | |
| 76 | → Changed: 5 symbols in 3 files |
| 77 | → Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline |
| 78 | → Risk: MEDIUM |
| 79 | ``` |
| 80 | |
| 81 | ## Example: "What breaks if I change validateUser?" |
| 82 | |
| 83 | ``` |
| 84 | 1. impact({target: "validateUser", direction: "upstream"}) |
| 85 | → d=1: loginHandler, apiMiddleware (WILL BREAK) |
| 86 | → d=2: authRouter, sessionManager (LIKELY AFFECTED) |
| 87 | |
| 88 | 2. READ gitnexus://repo/my-app/processes |
| 89 | → LoginFlow and TokenRefresh touch validateUser |
| 90 | |
| 91 | 3. Risk: 2 direct callers, 2 processes = MEDIUM |
| 92 | ``` |