rust-refactor

rust-refactor is a skill for Claude Code, Codex from pproenca/dot-skills. It costs 70 tokens per session (2,242 once invoked), scanned A, original, MIT.

A set of decision guides for simplifying and restructuring Rust code. Rust is a programming language focused on speed and safety, and the guides cover when to remove complexity or add structure.

In plain words
What is it for?
Use it when splitting large Rust files, simplifying modules and types, removing unused abstractions, or moving a project gradually between designs.
Why use it?
It helps prevent refactoring from making code harder to understand, while reducing needless layers, forwarded parameters, dead abstractions, and feature-flag clutter.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when splitting large Rust files, simplifying modules and types, removing unused abstractions, or moving a project gradually between designs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pproenca/dot-skills/rust-refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add pproenca/dot-skills --skill rust-refactor
Clone the repo
git clone --depth 1 https://github.com/pproenca/dot-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/pproenca/dot-skills/rust-refactor/github.svg)](https://agentmods.dev/skills/pproenca/dot-skills/rust-refactor)
Your own site
<a href="https://agentmods.dev/skills/pproenca/dot-skills/rust-refactor"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/rust-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/pproenca/dot-skills/rust-refactor"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/rust-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,242 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00070 $0.02242
Opus 5 $0.00035 $0.01121
Sonnet 5 $0.00014 $0.00448
Haiku 4.5 $0.00007 $0.00224

Measured 9d ago against content hash 5d51329f2568, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

rust-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/.curated/rust-refactor/SKILL.md · 241 lines

How it starts

The opening of the file, as written. The whole thing — 241 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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?"

Signal: The function body only passes the parameter to another function. No local logic depends on it. Action: Remove it. Replace with ambient/global access at the point of actual use. Remove from the lowest layer first, fix compilation errors upward.

2. "Is this feature flag still needed?"

Signal: Stage is Stable or equivalent, default is enabled, no rollback planned. Action: Remove the flag. Delete the conditional. Rename gated functions (init_if_enabled -> init). Remove monitoring scaffolding.

3. "Is this file doing too many things?"

Signal: File over ~500 lines with impl blocks operating on different domains (e.g., threads AND logs AND jobs). Action: Split by domain (what it operates on), not by layer. See Module Decomposition Guide below.

4. "Does this struct have mutually exclusive optional fields?"

Signal: 2+ Option<T> fields where only one should be set at a time. Code like if a.is_some() { assert!(b.is_none()) } or fields named x_config that only apply to one mode. Action: Convert to an enum where each variant carries only its relevant data.

Read the full file on GitHub · 241 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 241 lines · 70 tokens per session scan A 5d51329f2568

Subscribe to this mod's changes

rust-refactor is a skill published in the GitHub repository pproenca/dot-skills (205 stars, last pushed 24d ago), licensed MIT. It adds 70 tokens to every session and 2,242 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.