一键导入
before-refactor
Safety check before refactoring - shows callers, callees, and impact analysis
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Safety check before refactoring - shows callers, callees, and impact analysis
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Explore codebase semantically - find relevant code and documents using natural language search
Manage GitKB knowledge base for project documentation, tasks, and context. Use when working with KB documents, viewing tasks, updating progress, or managing project knowledge.
Understand a file or symbol's structure and dependencies using code intelligence tools
Manage isolated git worktree sets for multi-repo tasks.
Execute commands across all repos — parallel, filtered, dry-run modes.
Git operations across multiple repositories — status, commit, push, pull, snapshots, multi-commit.
| name | before-refactor |
| description | Safety check before refactoring - shows callers, callees, and impact analysis |
| allowed-tools | ["mcp__gitkb__kb_callers","mcp__gitkb__kb_callees","mcp__gitkb__kb_impact","mcp__gitkb__kb_symbols","mcp__gitkb__kb_symbol_refs"] |
Safety check before modifying a function, method, or type. Shows all call sites that would need updates if you change the signature, plus impact analysis.
Find the symbol and its location:
kb_symbols with search: "<symbol-name>"
Get all callers (who would break if you change the signature):
kb_callers with symbol: "<full-symbol-id>"
Get callees (what this function depends on):
kb_callees with symbol: "<full-symbol-id>"
Run impact analysis on the file:
kb_impact with file_path: "<file-path>"
Check for related documents:
kb_symbol_refs with symbol: "<full-symbol-id>"
## Refactor Safety Check: `symbolName()`
### Location
- File: src/services/auth.ts:45-67
- Kind: function
- Signature: `async function symbolName(param: Type): Promise<Result>`
### Direct Callers (5)
These will break if you change the signature:
- src/routes/auth.ts:45 -> handleRequest()
- src/routes/auth.ts:89 -> handleRefresh()
- src/middleware/auth.ts:22 -> authenticate()
- tests/auth.test.ts:15 -> testLogin()
- tests/integration.test.ts:88 -> testFullFlow()
### Transitive Impact
- 12 symbols transitively depend on this
- Affects 4 files
### What This Calls
- src/db/users.ts::findUser()
- src/crypto/tokens.ts::generateToken()
### Related Documents
- tasks/my-task (Related Task)
### Recommendation
[LOW|MEDIUM|HIGH] impact refactor:
- LOW: 0-2 callers, all in same module
- MEDIUM: 3-10 callers, multiple modules
- HIGH: 10+ callers or public API surface
Files that need updates if signature changes:
1. src/routes/auth.ts
2. src/middleware/auth.ts
3. tests/auth.test.ts
4. tests/integration.test.ts
Input: /before-refactor login
Output:
## Refactor Safety Check: `login()`
### Location
- File: src/services/auth.ts:45-67
- Kind: function
### Direct Callers (3)
These will break if you change the signature:
- src/routes/auth.ts:45 -> handleRequest()
- src/routes/auth.ts:89 -> handleRefresh()
- src/middleware/auth.ts:22 -> authenticate()
### Transitive Impact
- 8 symbols transitively depend on this
- Affects 3 files
### Recommendation
MEDIUM impact refactor.
Files that need updates if signature changes:
1. src/routes/auth.ts
2. src/middleware/auth.ts
Code must be indexed first:
git kb index