refactor-rust
Installation
SKILL.md
Refactor Rust
Goal
Code should be easy to read, easy to follow, easy to review, and easy to change. But "no refactor needed" is a valid and good outcome. Don't refactor for refactoring's sake — only change code that has real readability, maintainability, or correctness pain.
Setup
Read the project's CLAUDE.md for project-specific rules before starting.
Preserve behavior by default. If a refactor exposes a correctness bug, isolate it, write a reproducing test, and report it to the user — don't fix it in the same pass. Ask the user before major module splits.
Discover repo-specific verification first: check for a justfile, then fall back to cargo fmt / cargo clippy / cargo test. Run tests before and after.
Scope
- Recent changes (default): Only refactor recently touched code — could mean uncommitted changes, commits on this branch, or the last day or two of work. Ask the user to confirm scope before starting
- Full sweep: When the user explicitly asks to refactor a whole module, crate, or codebase