Test-first refactoring — audit coverage, add characterization tests, apply changes with safety net, run quality stack and review loop. TRIGGER when: user wants to restructure existing Python code without changing behaviour; phrases: \"refactor X\", \"clean up Y\", \"extract Z\", \"restructure this module\", \"improve code quality\". SKIP when: bug fixes (use /develop:fix); new features (use /develop:feature); mixed refactor+feature — run /develop:refactor first, then /develop:feature; non-Python projects.
$npx -y skills add borda/ai-rig --skill refactorInstalls into the current project.
Run `npx skills use "https://github.com/borda/ai-rig" --skill "borda/ai-rig/refactor"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/borda/ai-rig" that are relevant to the current task. Run `npx skills add "https://github.com/borda/ai-rig"` and select the relevant skills, then follow their instructions.