/bevy-skills:similarity-rsfrom bevy-skills
Detects duplicate or near-duplicate Rust code using similarity-rs. Helps avoid code duplication, especially during LLM-assisted development, and integrates with CI.
Ships in bevy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Tool status: Beta — not production-tested per the upstream README. Evaluate findings manually before acting.
Antipattern triggers (act before writing code):
Plugin setups that share large blocks of boilerplate.Query filter component.commands.spawn((Mesh3d(...), MeshMaterial3d(...), ...)) patterns that belong in a Bundle.Tool-integration triggers (run the check):
-t/--threshold or --min-lines for a noisy or too-quiet run.The pattern is: search first → write minimally → run the check.
# 1. Search before writing — check whether the helper already exists
rg "fn <verb>" # e.g., rg "fn normalize" to find existing helpers
cargo doc --open --package <dep> # inventory what your deps already provide
# 2. Write only what's missing.
# 3. Before committing, check for accidental duplication
cargo install similarity-rs # one-time install
similarity-rs ./src # scan the src tree
# 4. If --cross-file output is needed (catches LLM's most common antipattern)
similarity-rs --cross-file ./src
# 5. Tighten or loosen if needed (see references/tuning.md)
similarity-rs -t 0.85 -m 5 --cross-file --skip-test ./src
Consult cargo doc --open for every dependency before reaching for a one-off helper. LLMs reproduce functions from stdlib, itertools, or an already-declared crate dep more often than from thin air.
| Topic | Reference |
|---|---|
| LLM duplication patterns with before/after examples | references/antipatterns.md |
| Search-before-write workflow (rg, cargo doc, CLAUDE.md scan) | references/search-before-write.md |
| Pre-commit hook and GitHub Actions CI recipes | references/ci-integration.md |
-t, --min-lines, --cross-file, --no-size-penalty knobs | references/tuning.md |
| When similar code is intentional — don't act on these | references/false-positives.md |
similarity-ts, similarity-py, similarity-generic for polyglot repos | references/sibling-tools.md |
--cross-file is off by default. Without it, only within-file pairs are reported. Most LLM-introduced duplication is across files. Always pass --cross-file unless you specifically want within-file only.
Beta tool. The upstream README marks similarity-rs as not production-tested. Treat output as signal, not verdict. Review each flagged pair before refactoring.
--skip-test on CI. Test files often contain structurally similar setup fixtures by design. Run with --skip-test on CI to suppress expected test-fixture symmetry; review test duplication locally.
Threshold tuning is project-specific. The default -t 0.85 catches obvious copy-paste. Use 0.75–0.80 during a cleanup sprint (more hits), 0.90–0.95 for production gating (fewer false alarms). See references/tuning.md.
No tester snippet for this skill. similarity-rs is a CLI-only tool with no library API — there is no cargo check example to validate. This follows the same approach as bevy-cargo-features and bevy-migration-0-17-to-0-18, which also carry no tester examples.
bevy-cargo-features — installing similarity-rs via cargo install sits alongside the Cargo.toml feature story; also covers default-features decisions that can hide accidental dep duplication.bevy-core-concepts — duplicate Plugin setup and schedule boilerplate is the most common Bevy-specific antipattern this tool catches.bevy-ecs-components — near-duplicate component structs and overlapping enums often surface when features are added without consolidation.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
32 skills in this plugin
/bevyUse when starting any Bevy task, choosing between Update and FixedUpdate, picking Cargo feature flags, or recalling which sibling skill covers ECS, assets, rendering, UI, or migration. Routes to the right Bevy 0.20 skill and pins the engine version for downstream snippets./bevy-a11yUse when designing or auditing high-standard video-game accessibility in Bevy 0.20, integrating screen readers and focus navigation, supporting adaptive controllers and complete remapping, implementing captions or audio description, checking contrast and motion safety, or building disabled-player test evidence./bevy-animationUse when wiring `AnimationPlayer` + `AnimationGraphHandle`, building an `AnimationGraph` from glTF clips, blending state-driven animations with `AnimationTransitions::play`, isolating body parts with `AnimationMask`, firing gameplay sync via `#[derive(AnimationEvent)]` + `On<E>` observers, tweening with `AnimatableCurve` / `EaseFunction` / `CubicSegment::new_bezier_easing` from `bevy::curve`, or applying the 12 Basic Principles of Animation to 3D characters in Bevy 0.20.npx claudepluginhub chrisgliddon/bevy-skills --plugin bevy-skillsOther plugins' skills for the same job