Rust Code Similarity Detection
SkillFiles & storageLets your agent scan Rust files to find duplicated functions and types that could be merged.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Rust Code Similarity Detection skill
About this capability
Detects duplicated Rust code with the dev-shell similarity-rs CLI. Use when reviewing .rs files for repeated functions, impl methods, or parallel struct and enum definitions, or before extracting a shared helper.
What this skill tells your AI
The instructions your AI receives, as published by ccusage/ccusage in .agents/skills/reduce-similarities/SKILL.md and read by ahel’s review.
similarity-rs comes from the Nix dev shell (similarity in
nix/dev-shell.nix); prefix it with direnv exec . from outside the shell.
TypeScript duplication belongs to the typescript and ast-grep skills.
Run it over $ARGUMENTS, or over . when none was given. Functions and type
definitions are separate passes, so a default run silently misses parallel
structs and enums:
similarity-rs . --threshold 0.85 --min-lines 5
similarity-rs . --threshold 0.85 --experimental-types
--print shows the matching snippets and similarity-rs --help has the rest;
--skip-test is worth adding when fixture-shaped test functions drown out the
real findings.
Triage
A score is a starting point, not a verdict. Usually worth refactoring:
- 100% matches: extract a shared function or generic.
- 95-100% across different types: generic function with trait bounds.
- Duplicate impl methods on several types: trait with default implementations.
- 85-95% match arms or error handling: shared helper or macro.
- Parallel structs with identical fields: shared base or generic struct.
Usually left alone: short new() constructors, simple From/Into impls, and
anything a derive would generate.
Report each surviving candidate as a concrete before/after shape, not as a list of scores.
Signals
- GitHub stars
- 18k
- Forks
- 821
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
reduce-similarities- Source
- github.com/ccusage/ccusage