Refactoring Safe Skill
Goal: Prevent broken links and missing imports by checking references BEFORE moving files.
Protocol
- •
Identify Target:
- •Source file:
src/old/path.py - •Destination:
src/new/path.py
- •Source file:
- •
Trace References (Pre-Flight):
- •Use
grepai trace callers "path/basename"orgrepai search "basename"to find all usages. - •CRITICAL: If
grepaireturns > 0 results outside the file itself, STOP and list them.
- •Use
- •
Execute Move:
- •Only if 0 critical references found OR user explicitly approves after warning.
- •Use
git mv(if git repo) ormv.
- •
Post-Move Update:
- •Update known references (imports, includes).
- •Verify: Run
grepfor the old path to ensure it's gone.
Usage
bash
# Safe Move /refactor move source.py dest/