一键导入
refactor-safely
Use when planning or executing a refactor — rename, extract, move, or delete code — to prevent breaking callers or missing affected files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when planning or executing a refactor — rename, extract, move, or delete code — to prevent breaking callers or missing affected files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when encountering unexpected behavior, failing tests, API errors, or runtime panics in Tundra — before proposing any fix
Use when you need to understand codebase structure, locate code, or trace relationships before making changes or answering architecture questions
Use after completing a feature or before merging to perform a risk-scored review of changed code, check test coverage, and assess blast radius
| name | refactor-safely |
| description | Use when planning or executing a refactor — rename, extract, move, or delete code — to prevent breaking callers or missing affected files |
Tundra spans 20+ Rust crates, a React SPA, proto definitions, and SQL migrations. A rename in one layer silently breaks another if you don't trace all references first. The graph finds them all.
Core principle: Preview before applying. Never rename across files without seeing the full impact list first.
get_minimal_context(task="refactor <what you're changing>")
query_graph(node_id="<target>", pattern="children_of") // what it contains
query_graph(node_id="<target>", pattern="callers_of") // who depends on it
query_graph(node_id="<target>", pattern="imports_of") // what it pulls in
Build the full dependency picture before touching anything.
refactor_tool(mode="dead_code")
Returns unreferenced functions/types. Verify with callers_of — graph dead code + zero callers = safe to delete.
refactor_tool(mode="suggest")
Community-driven suggestions for what could be extracted or grouped differently.
refactor_tool(mode="rename", node_id="...", new_name="...")
Returns a refactor_id and full list of affected locations. Read the list completely. If unexpected files appear, investigate before proceeding.
get_impact_radius(node_id="<target>")
Shows callers two levels up. Callers you didn't expect = the refactor is larger than assumed.
apply_refactor_tool(refactor_id="...")
detect_changes()
Confirms actual changes match expected scope. Then run cargo check --workspace and pnpm typecheck.
| What you're refactoring | What to check additionally |
|---|---|
Public Rust type in tundra-shared | Both Rust callers AND TypeScript api-types.ts DTO |
| Route handler signature | lib.rs route registration, openapi.yaml spec |
| DB column name | All SQLx queries in tundrad-repo, any SELECT * statements |
| Panel component | All import sites + any lazy-loaded routes in routeTree.gen.ts |
| Enum variant | match exhaustiveness — Rust will catch missing arms, but check JS too if mirrored |
| Migration table/column | Cannot rename via migration — add new column, migrate data, drop old in sequence |
apply_refactor_tool touches a migration file → stop, migrations are append-onlytundrad-auth or tundrad-crypto → get a second review