zhanghandong avatar

Rust Refactor Helper

The rust-refactor-helper skill enables developers to safely refactor Rust code by leveraging Language Server Protocol (LSP) analysis to identify all affected locations before making changes. It supports multiple refactoring operations—including renaming symbols, extracting functions, inlining functions, and moving symbols across modules—with optional dry-run previews that show impact analysis, potential conflicts, and side effects like documentation updates or public API changes. This skill solves the problem of performing large-scale code transformations in Rust while minimizing the risk of introducing bugs or breaking dependent code.

skills.sh installs
821
GitHub stars
1.3K
last updated
Jul 14, 2026

Install

$ npx -y skills add zhanghandong/rust-skills --skill rust-refactor-helper --agent claude-code

Installs into .claude/skills of the current project.

Files

Rust Refactor Helper

Perform safe refactoring with comprehensive impact analysis.

Usage

/rust-refactor-helper <action> <target> [--dry-run]

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

# Find all references before renaming
LSP(
  operation: "findReferences",
  filePath: "src/lib.rs",
  line: 25,
  character: 8
)

# Get symbol info
LSP(
  operation: "hover",
  filePath: "src/lib.rs",
  line: 25,
  character: 8
)

# Check call hierarchy for move operations
LSP(
  operation: "incomingCalls",
  filePath: "src/lib.rs",
  line: 25,
  character: 8
)

Refactoring Workflows

1. Rename Symbol

Sponsors

Details

Repository
github.com/zhanghandong/rust-skills
Categories
Code Review & Quality, Rust

More from zhanghandong/rust-skills

All 34
1sickn33 avatarcodebase-cleanup-refactor-cleansickn33/antigravity-awesome-skillscodebase cleanup refactor clean808skills.sh installs
2affaan-m avatarprediction-market-risk-reviewaffaan-m/everything-claude-codeprediction market risk review801skills.sh installs
3sickn33 avatararchitecture-patternssickn33/antigravity-awesome-skillsarchitecture patterns787skills.sh installs
4sickn33 avatararchitecture-decision-recordssickn33/antigravity-awesome-skillsarchitecture decision records749skills.sh installs
5ruvnet avataradr-reviewruvnet/rufloReview code changes against accepted ADRs for compliance violations745skills.sh installs
6alirezarezvani avatargcp-cloud-architectalirezarezvani/claude-skillsDesign GCP architectures for startups and enterprises. Use when asked to design Google Cloud infrastructure, deploy to GKE or Cloud Run, configure BigQuery pipe732skills.sh installs