rust-refactor-helper

Safe Rust refactoring with LSP analysis. Triggers on: /refactor, rename symbol, move function, extract, 重构, 重命名, 提取函数, 安全重构

By actionbook · 2,797 installs

npx skills add actionbook/rust-skills --skill rust-refactor-helper

Source repository · Upstream listing

Rust Refactor Helper Perform safe refactoring with comprehensive impact analysis. Usage Actions: rename <old <new Rename symbol extract fn <selection Extract to function inline <fn Inline function move <symbol <dest Move to module Examples: /rust refactor helper rename parse config load config /rust refactor helper extract fn src/main.rs:20 35 /rust refactor helper move UserService src/services/ LSP Operations Used Pre Refactor Analysis Refactoring Workflows 1. Rename Symbol Output: 2. Extract Function Output: rust let file = File::open(&path)?; let mut contents = String::new(); file.read to string(&mut contents)?; let config: Config = toml::from str(&contents)?; validate config(&config)?; ​ rust fn load and validate config(path: &Path) Result<Config { let file = File::open(path)?; let mut contents = String::new(); file.read to string(&mut contents)?; let config: Config = toml::from str(&contents)?; validate config(&config)?; Ok(config) } ​ rust let config = load and validate config(&path)?; ​ 3. Move Symbol Output: src/ ├── services/ │ ├── mod.rs (NEW add pub mod user; ) │ └── user.rs (NEW UserService moved here) ├── handlers/ │ └── auth.rs (UserService removed) ​ Safety Checks Check Purpose Reference completeness Ensure all uses are found Name conflicts Detect existing symbols with same name Visibility changes Warn if pub/private scope changes Macro generated code Warn about code in macros Documentation Flag doc comments mentioning symbol Test coverage Show affected tests Dry Run Mode Always use dry run first to preview changes: This shows all changes without applying them. Related Skills When See Navigate to symbol rust code navigator Understand call flow rust call graph Project structure rust symbol analyzer Trait implementations rust trait explorer