rust-refactor-helper

Refactor Rust code with LSP-based renaming, extraction, and moving.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill rust-refactor-helper-mte90
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-refactor-helper
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/rust-refactor-helper
Command: npx skills add https://github.com/Mte90/dotfiles --skill rust-refactor-helper-mte90

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates complex and potentially risky code refactoring tasks in Rust projects, ensuring code integrity and preventing unintended consequences.

Core Features & Use Cases

  • Safe Renaming: Renames symbols across your codebase with impact analysis.
  • Function Extraction: Extracts selected code blocks into new functions, generating signatures and replacements.
  • Symbol Moving: Moves symbols between modules, updating all necessary imports.
  • Use Case: Refactor a large Rust codebase by safely renaming a widely used function, ensuring all call sites and documentation are updated correctly.

Quick Start

Safely rename the 'parse_config' function to 'load_config' in your Rust project.

Frequently Asked Questions about rust-refactor-helper

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely rename a function across a large Rust codebase?

Safe Rust refactoring uses Language Server Protocol (LSP) analysis to rename symbols across your codebase, providing detailed impact assessments and conflict detection to ensure all call sites and documentation are updated correctly.

What is the best way to extract a code block into a new function in Rust?

Function extraction in Rust refactoring generates new function signatures and replacements for selected code blocks, using LSP integration to analyze the code structure before applying changes safely via the Edit tool.

Can I move Rust symbols between modules and automatically update imports?

Yes, symbol moving functionality relocates Rust symbols between modules while automatically updating all necessary imports, relying on LSP pre-refactor analysis to maintain code integrity.

Do I need LSP integration to perform automated Rust refactoring?

Yes, LSP integration is required for pre-refactor analysis to detect conflicts and assess impacts, while the Edit tool is used for applying the actual code transformations.

How does LSP analysis prevent unintended consequences during Rust code transformation?

LSP analysis performs detailed impact assessments and conflict detection before any code transformation occurs, ensuring that operations like symbol renaming and moving do not break existing code references.