Refactor safely

From rahXephonz/diffthing · View interactive version

Refactor safely is an AI agent skill from the GitHub repository rahXephonz/diffthing. Plan/verify a refactor via dependency + flow analysis and a rename preview. Use for refactor, rename, move, extract, restructure, split a large function.

How to use this skill

Skill file

Refactor safely

Drive the code-review-graph MCP to size the blast radius before editing.

  1. Establish current behavior with tests.
  2. get_impact_radius_tool + get_affected_flows_tool for the dependency and

flow blast radius; find_large_functions_tool to spot split targets.

  1. refactor_tool to preview a rename/structural edit, apply_refactor_tool to

apply it.

  1. Preserve protocol, reconciliation, review, and security invariants.
  2. Make the smallest coherent change.
  3. Run focused tests, then repository verification.

Never mix unrelated cleanup into a refactor. Fall back to rg when graph data

is missing or stale (incremental, can lag HEAD).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.