Skip to content
pproenca avatar

Rust Refactor

Decision frameworks and six transformation patterns for simplifying, splitting, and migrating working Rust code.

CCM score
58 of 100
skills.sh installs
334
GitHub stars
228
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers two modes, defensive (add abstraction for safety) and offensive (delete indirection), and when to use each
  • Includes four diagnostic questions on forwarded parameters, stale feature flags, oversized files, and mutually exclusive Option fields
  • Provides six transformations: ambient access, domain-split modules, incremental From bridges, flag removal, crate extraction, and enum conversion
  • Designed for Rust codebases where refactors must keep every intermediate commit compiling

Install

$ npx -y skills add pproenca/dot-skills --skill rust-refactor -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Rust Refactoring Frameworks

This skill teaches you to look at working Rust code and see unnecessary complexity. Every refactoring starts with a diagnostic question, follows a transformation pattern, and ends with a self-review checklist.


The Two Refactoring Philosophies

Before touching code, decide which mode you are in.

Defensive mode: Add abstraction for safety. Split types. Create From bridges. Audit every consumer. Use when: security-critical code, type evolution, multi-crate dependencies.

Offensive mode: Delete indirection. Remove forwarded parameters. Collapse layers. Use when: the abstraction adds complexity without adding safety, the mediator just forwards, the parameter is always None.

Know which mode you are in. Do not add abstraction when you should be deleting, and do not delete safety layers when you should be adding them.


The 4 Diagnostic Questions

Run these BEFORE touching any code. They determine WHAT to refactor.

1. "Is this parameter just being forwarded?"

Details

Repository
github.com/pproenca/dot-skills
Categories
Rust, Code Review & Quality
First seen
Jun 3, 2026

Questions

What does the rust-refactor skill do?

The rust-refactor skill gives decision frameworks for refactoring, simplifying and decomposing Rust code. It covers removing forwarded parameters, splitting large files by domain, removing dead feature flags, migrating types incrementally, and turning mutually exclusive optional fields into enums.

How do I install the rust-refactor skill?

Run npx -y skills add pproenca/dot-skills --skill rust-refactor -y in your project. This installs the skill from the pproenca/dot-skills repository on GitHub.

Where does rust-refactor rank among Rust skills?

It ranks in the top 100 of the Rust category on Claude Marketplaces. Other well-known skills in the same category include fix-errors, rust-best-practices, rust-async-patterns, rust-testing and rust-patterns.

When should an agent use rust-refactor?

Use it when simplifying Rust code, splitting large files, removing dead abstractions, migrating types incrementally or cleaning up feature flags. It also applies to module splitting, parameter cleanup and incremental type migration.

How does rust-refactor decide what to change?

It starts with four diagnostic questions, such as whether a parameter is only being forwarded or whether a file is doing too many things. Each question has a signal and a matching action, so the agent knows what to refactor before editing code.

More from pproenca/dot-skills

All 100

Similar to Rust Refactor

More Rust