ワンクリックで
ontoindex-refactoring
Plan safe refactors using blast radius and dependency mapping
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Plan safe refactors using blast radius and dependency mapping
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when the user needs to run OntoIndex CLI commands like analyze/index a repo, check status, clean the index, generate a wiki, or list indexed repos. Examples: "Index this repo", "Reanalyze the codebase", "Generate a wiki"
Use when the user is debugging a bug, tracing an error, or asking why something fails. Examples: "Why is X failing?", "Where does this error come from?", "Trace this bug"
Use when the user asks how code works, wants to understand architecture, trace execution flows, or explore unfamiliar parts of the codebase. Examples: "How does X work?", "What calls this function?", "Show me the auth flow"
Use when the user asks about OntoIndex itself — available tools, how to query the knowledge graph, MCP resources, graph schema, or workflow reference. Examples: "What OntoIndex tools are available?", "How do I use OntoIndex?"
Use 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?"
Use when the user wants to review a pull request, understand what a PR changes, assess risk of merging, or check for missing test coverage. Examples: "Review this PR", "What does PR #42 change?", "Is this PR safe to merge?"
| name | ontoindex-refactoring |
| description | Plan safe refactors using blast radius and dependency mapping |
1. ontoindex_impact({target: "X", direction: "upstream"}) → Map all dependents
2. ontoindex_query({query: "X"}) → Find execution flows involving X
3. ontoindex_context({name: "X"}) → See all incoming/outgoing refs
4. Plan update order: interfaces → implementations → callers → tests
If "Index is stale" → run
npx ontoindex analyzein terminal.
- [ ] ontoindex_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) — preview all edits
- [ ] Review graph edits (high confidence) and ast_search edits (review carefully)
- [ ] If satisfied: ontoindex_rename({..., dry_run: false}) — apply edits
- [ ] ontoindex_detect_changes() — verify only expected files changed
- [ ] Run tests for affected processes
- [ ] ontoindex_context({name: target}) — see all incoming/outgoing refs
- [ ] ontoindex_impact({target, direction: "upstream"}) — find all external callers
- [ ] Define new module interface
- [ ] Extract code, update imports
- [ ] ontoindex_detect_changes() — verify affected scope
- [ ] Run tests for affected processes
- [ ] ontoindex_context({name: target}) — understand all callees
- [ ] Group callees by responsibility
- [ ] ontoindex_impact({target, direction: "upstream"}) — map callers to update
- [ ] Create new functions/services
- [ ] Update callers
- [ ] ontoindex_detect_changes() — verify affected scope
- [ ] Run tests for affected processes
ontoindex_rename — automated multi-file rename:
ontoindex_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
→ 12 edits across 8 files
→ 10 graph edits (high confidence), 2 ast_search edits (review)
→ Changes: [{file_path, edits: [{line, old_text, new_text, confidence}]}]
ontoindex_impact — map all dependents first:
ontoindex_impact({target: "validateUser", direction: "upstream"})
→ d=1: loginHandler, apiMiddleware, testUtils
→ Affected Processes: LoginFlow, TokenRefresh
ontoindex_detect_changes — verify your changes after refactoring:
ontoindex_detect_changes({scope: "all"})
→ Changed: 8 files, 12 symbols
→ Affected processes: LoginFlow, TokenRefresh
→ Risk: MEDIUM
ontoindex_cypher — custom reference queries:
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"})
RETURN caller.name, caller.filePath ORDER BY caller.filePath
| Risk Factor | Mitigation |
|---|---|
| Many callers (>5) | Use ontoindex_rename for automated updates |
| Cross-area refs | Use detect_changes after to verify scope |
| String/dynamic refs | ontoindex_query to find them |
| External/public API | Version and deprecate properly |
validateUser to authenticateUser1. ontoindex_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
→ 12 edits: 10 graph (safe), 2 ast_search (review)
→ Files: validator.ts, login.ts, middleware.ts, config.json...
2. Review ast_search edits (config.json: dynamic reference!)
3. ontoindex_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false})
→ Applied 12 edits across 8 files
4. ontoindex_detect_changes({scope: "all"})
→ Affected: LoginFlow, TokenRefresh
→ Risk: MEDIUM — run tests for these flows