funcvec-dedupe-fixer
Skill2 starsChanged 4 months agoMITView on GitHub
Use when the user wants Rust duplicate-function detection and cleanup with funcvec, especially crate-by-crate scans, duplicate triage, boilerplate refactors, or safe dedupe fixes across a Rust workspace.
In this repository25 other files it gives its agents.
- brutal-deepresearchSkill
- brutal-grillSkill
- brutal-idea-evalSkill
- brutal-inf-fix-loopSkill
- brutal-planSkill
- brutal-pr-finding-fixerSkill
- brutal-pr-fix-loopSkill
- brutal-project-reviewSkill
- brutal-pr-reviewSkill
- brutal-realitySkill
- brutal-reviewSkill
- brutal-specSkill
- brutal-swarmSkill
- brutal-ticketsSkill
- brutal-wayfinderSkill
- brutal-workerSkill
- codex-coopSkill
- design-jepa-modelsSkill
- factory-designSkill
- grill-meSkill
- handoffSkill
- opencode-delegateSkill
- rust-architecture-reviewSkill
- rust-pr-reviewSkill
- supply-chain-analyzerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 11 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 8
Run a crate-by-crate sieve: discover candidates with funcvec, inspect the code behind each hit, refactor only high-confidence duplication, …
- Very specific: line 15
Treat funcvec output as suspects, not proof.
- Distinctive: line 16
Prefer deleting duplication by reusing existing helpers, extracting a small private helper, or introducing a macro only when the repeated …
- Distinctive: line 18
Do not merge tiny getters, setters, builders, or forwarding methods unless a larger repeated pattern makes the refactor pay for itself.
- Distinctive: line 23
Leave generated code alone unless the generator is also updated.
- Distinctive: line 33
Use package manifest paths from metadata.
- Distinctive: line 47
If the output is dominated by trivial accessors or route wrappers, tighten:
- Distinctive: line 53
When native Nomic is installed and useful for semantic ranking:
- Distinctive: line 64
Read the full bodies and immediate call sites for each candidate before editing.
- Distinctive: line 98
Run the narrowest useful checks first:
- Distinctive: line 106
If the crate uses feature gates, use the feature set that covers the touched code.
- Distinctive: line 119
After one verified refactor, decide whether to continue in the same crate:
- Distinctive: line 123
Stop and report if a refactor changes public API, generated code, or shared behavior enough to need user approval.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Funcvec Dedupe Fixer
Run a crate-by-crate sieve: discover candidates with funcvec, inspect the
code behind each hit, refactor only high-confidence duplication, and verify each
crate before moving on.
Ground Rules
- Work one crate at a time. Do not batch edits across unrelated crates.
- Treat
funcvecoutput as suspects, not proof. - Prefer deleting duplication by reusing existing helpers, extracting a small private helper, or introducing a macro only when the repeated shape is real.
- Do not merge tiny getters, setters, builders, or forwarding methods unless a larger repeated pattern makes the refactor pay for itself.
- Preserve public APIs unless the user explicitly asked for breaking cleanup.
- Preserve error mapping, metrics, logging, tracing, auth, validation, endpoint names, serialization, and async behavior.
- Leave generated code alone unless the generator is also updated.
Step 1: Build The Crate Queue
Identify workspace crates in deterministic order:
cargo metadata --no-deps --format-version 1Use package manifest paths from metadata. Skip crates that cannot be built in the current environment only after recording the exact blocker.
Completion criterion: every workspace package is either queued once or recorded with a concrete skip reason.
Step 2: Run The Sieve
For each queued crate, run a focused scan:
funcvec <crate-dir> --top-k 60 --min-lines 4 --min-tokens 20If the output is dominated by trivial accessors or route wrappers, tighten:
funcvec <crate-dir> --top-k 80 --min-lines 6 --min-tokens 30 --threshold 0.98When native Nomic is installed and useful for semantic ranking:
funcvec <crate-dir> --provider nomic --top-k 40 --threshold 0.95Completion criterion: the crate has a saved candidate list in notes or the final response, including command, candidate count, and the top repeated pattern.
Step 3: Classify Candidates
Read the full bodies and immediate call sites for each candidate before editing. Classify each as:
- Fix: same behavior is repeated and a small refactor removes real maintenance risk.
- Template: repeated service/client/DTO/route shape. Fix with a shared helper, macro, or generator change only when the pattern repeats enough.
- Ignore: accessors, setters, builders, tests, or deliberately parallel domain methods where abstraction would hide intent.
- Defer: plausible duplication, but public API, generated code, or missing tests makes the change too risky for this pass.
Completion criterion: every candidate considered for editing has a classification and a stated reason tied to code, not just score.
Step 4: Refactor One Pattern
Pick the highest-payoff Fix or Template in the current crate.
Before editing, identify:
- the smallest shared abstraction that removes the duplication
- the behavior that must remain identical
- tests that currently cover it, or the focused test to add
- public API and semver impact
Implement the smallest refactor that removes the repeated behavior. Avoid renaming, reformatting, or moving unrelated code.
Completion criterion: the selected candidate pair or cluster no longer appears as duplicated implementation after inspection, and no unrelated files changed.
Step 5: Verify The Crate
Run the narrowest useful checks first:
cargo fmt --check
cargo test -p <package>
cargo clippy -p <package> --all-targets -- -D warningsIf the crate uses feature gates, use the feature set that covers the touched code. If a check is too broad or blocked by unrelated failures, run a narrower test and record the blocker.
Re-run funcvec <crate-dir> after the fix. The original cluster should either
be gone or reduced to intentional wrappers.
Completion criterion: formatting passes, relevant tests pass, clippy passes or has a recorded unrelated blocker, and the original funcvec finding is resolved or explicitly reclassified.
Step 6: Continue Or Stop
After one verified refactor, decide whether to continue in the same crate:
- Continue if another high-confidence Fix remains in the crate.
- Move to the next crate if remaining hits are Ignore or Defer.
- Stop and report if a refactor changes public API, generated code, or shared behavior enough to need user approval.
Completion criterion: every crate processed has one of these outcomes:
- no actionable duplication
- refactor committed or ready to commit
- blocked with exact command/error/context
- deferred with reason and candidate list
Final Report
Report in this shape:
## Crates Scanned
- `<crate>`: <command>, <candidate count>, <outcome>
## Fixes
- `<crate>`: <what duplication was removed>, <files changed>, <tests run>
## Ignored Patterns
- <pattern>: <why abstraction would be worse>
## Deferred
- <candidate>: <why not fixed now>
## Verification
- <commands and results>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

