rust-dup-unifier

Detect and validate duplicate Rust abstractions to recommend safe consolidation strategies.

2|Updated May 6, 2026
One-click install
npx skills add https://github.com/bpcakes/jig-skills --skill rust-dup-unifier-bpcakes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-dup-unifier
Source: https://github.com/bpcakes/jig-skills/tree/main/plugins/jig-rust/skills/rust-dup-unifier
Command: npx skills add https://github.com/bpcakes/jig-skills --skill rust-dup-unifier-bpcakes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Rust codebases often accumulate parallel Config, Options, Error, and Builder types that drift apart over time, causing repeated bug fixes and adapter code. This Skill finds structurally similar abstractions and validates whether they should actually be merged, share a core, or stay separate. ## Core Features & Use Cases - Candidate Scanning: A dependency-free Python scanner extracts Rust structs, enums, traits, and impls, then scores structural and behavioral similarity to generate candidate clusters. - Semantic Validation: A checklist-driven workflow inspects callers, invariants, serialization, ownership, coherence, and feature gates before any merge recommendation, avoiding false positives like wire-vs-domain types. - Classification and Planning: Each cluster receives a disposition (unify, shared_core, keep_separate, needs_evidence) with drift risk, payoff, migration risk, and a smallest safe implementation sequence. - Use Case: Ask whether two configuration types in different crates should share a core, and receive an evidence-backed report with source anchors, divergences, and a migration plan. ## Quick Start Ask the agent to analyze whether the similar types in your Rust repository should be unified, specifying the repository path and whether you want a scan-only report or a consolidation plan.

Frequently Asked Questions about rust-dup-unifier

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

FAQPage Schema
How do I find duplicate code in a Rust project?

Run the bundled scanner with python3 scripts/scan_rust_dup_unifier.py against your repository root to get similarity-scored candidate pairs. The agent then validates each candidate semantically before recommending any consolidation.

How to decide whether two similar Rust types should be merged?

Compare their concept, invariants, behavior, callers, and drift history rather than structural similarity alone. The skill classifies each cluster as unify, shared_core, keep_separate, or needs_evidence based on source evidence.

Does the Rust duplication scanner require external dependencies?

No, the scanner is dependency-free Python that performs lightweight lexical extraction of Rust items. It does not expand macros or resolve types, so its output must be validated against the actual source.

Can the scanner analyze only part of a Rust workspace?

Yes, repeat the --scope option with repository-relative files or directories to restrict analysis. You can also adjust --min-score, --max-candidates, and include or exclude tests and generated code.

What are common false positives when detecting Rust code duplication?

Common false positives include wire DTOs versus domain types, owned versus borrowed views, sync versus async facades, and error types at different recovery boundaries. The semantic checklist identifies these before any merge is recommended.

Will the skill modify my Rust code automatically?

No, the default mode is read-only analysis that reports findings with source locations. Code changes happen only when you explicitly request implementation, and then one validated cluster at a time.