- Home
- Skills
- Zhanghandong
- Rust Skills
- Rust Refactor Helper
rust-refactor-helper_skill
- Shell
565
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill zhanghandong/rust-skills --skill rust-refactor-helper- SKILL.md5.9 KB
Overview
This skill performs safe Rust refactoring with LSP-powered impact analysis and optional dry-run previews. It supports renames, function extraction, inlining, and moving symbols while reporting dependencies, visibility changes, and potential issues. The goal is predictable, reversible refactors that surface documentation, test, and macro risks before changes are applied.
How this skill works
The skill queries the language server for definitions, references, hover info, and call hierarchies to build a full impact map. For each action it categorizes references by file, analyzes variable usage for extraction, checks for name conflicts, and detects visibility or circular-dependency changes. A --dry-run mode produces a human-readable plan and file-by-file edits; the apply step uses an edit operation only after confirmation.
When to use it
- Rename a public or private symbol across the project
- Extract repeated or complex code blocks into a new function
- Move a struct/impl or module to a different crate path
- Inline a small helper function to reduce indirection
- Preview changes safely using --dry-run before applying
Best practices
- Always run with --dry-run to review impact and affected files
- Check for macro-generated uses and documentation mentions manually when flagged
- Verify visibility/public-api implications for re-exports and crates
- Run tests after applying refactors and update tests listed as affected
- Prefer small, focused refactors to limit cross-file ripple effects
Example use cases
- /rust-refactor-helper rename parse_config load_config --dry-run to preview API and doc impacts
- /rust-refactor-helper extract-fn src/main.rs:20-35 to produce a typed, side-effect-aware helper and replacement call
- /rust-refactor-helper move UserService src/services/ to relocate implementation and update imports
- Inline short utility functions into hot paths to reduce indirection and improve readability
- Use dry-run output to produce a checklist of documentation, tests, and re-exports to update manually
FAQ
Only when you confirm. Use --dry-run to preview edits; apply is a separate step that performs the edits.
How are inputs and outputs determined for extract-fn?
The skill analyzes variable reads/writes in the selection to infer inputs, outputs, and side effects, then suggests a function signature and call replacement.