cargo-coupling: Skill for Claude Code

.claude/skills/similarity/SKILL.md

similarity is a skill for Claude Code from nwiizo/cargo-coupling. It costs 0 tokens per session (579 once invoked), scanned A, original, MIT.

A command-line tool that finds code sections with similar meaning or structure and suggests how to combine duplicates.

In plain words
What is it for?
Use it to scan source folders, review duplicate code, and prepare refactoring plans or CI checks.
Why use it?
It helps reveal repeated code that can make a project harder to change and maintain.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

This is nwiizo/cargo-coupling's own configuration. It tells Claude Code how to work on cargo-coupling itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cargo-coupling configures →

Reuse

Borrowing it

Nothing to install: this file belongs to nwiizo/cargo-coupling. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nwiizo/cargo-coupling/main/.claude/skills/similarity/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/nwiizo/cargo-coupling

Made for: Claude Code.

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 similarity

README.md
[![agentmods](https://agentmods.dev/badge/skills/nwiizo/cargo-coupling/similarity/github.svg)](https://agentmods.dev/skills/nwiizo/cargo-coupling/similarity)
Your own site
<a href="https://agentmods.dev/skills/nwiizo/cargo-coupling/similarity"><img src="https://agentmods.dev/badge/skills/nwiizo/cargo-coupling/similarity/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 similarity

Your own site · 80×15
<a href="https://agentmods.dev/skills/nwiizo/cargo-coupling/similarity"><img src="https://agentmods.dev/badge/skills/nwiizo/cargo-coupling/similarity.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 579 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 warn 7 Sept 2026
SkillSpector: 7 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 4
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 25
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 31
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 37
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 48
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 65
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
  • high Tool Misuse · line 76
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
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.00000 $0.00579
Opus 5 $0.00000 $0.00290
Sonnet 5 $0.00000 $0.00116
Haiku 4.5 $0.00000 $0.00058

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

Security

Grade A, and why

similarity 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 7d 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.

.claude/skills/similarity/SKILL.md · 79 lines

What it actually says

Similarity - Code Similarity Analysis

Execution Steps

  1. Run similarity-rs to detect code similarities
  2. Analyze detected duplicates (95%+: immediate, 85-95%: review)
  3. Create refactoring plan

Commands

# Basic scan
similarity-rs ./src

# With threshold
similarity-rs ./src --threshold 0.85

# Skip test functions
similarity-rs ./src --skip-test

# Show code in output
similarity-rs ./src --print

# Strict detection (95%+)
similarity-rs ./src --threshold 0.95 --skip-test

# Include type similarity
similarity-rs ./src --experimental-types

# CI integration
similarity-rs ./src --threshold 0.95 --skip-test --fail-on-duplicates

Options

Option Description Default
-t, --threshold Similarity threshold (0.0-1.0) 0.85
-m, --min-lines Minimum lines 3
--min-tokens Minimum tokens 30
-p, --print Show code in output -
--skip-test Skip test functions -
--exclude Exclude directories -
--experimental-types Check type similarity -
--fail-on-duplicates Exit 1 if duplicates found -

Interpretation

Similarity Category Action
95%+ Near-exact duplicate Extract to common function
85-95% Structural similarity Consider generics/traits
< 85% Possible false positive Review manually

Workflow with cargo-coupling

# 1. Detect similar code
similarity-rs ./src --threshold 0.85 --skip-test

# 2. Check coupling impact
cargo run -- coupling ./src

# 3. Visualize in Web UI
cargo run -- coupling --web ./src
  1. Initial scan: similarity-rs . --threshold 0.8 --skip-test
  2. Detailed analysis: similarity-rs ./src --threshold 0.95 --print
  3. Type check: similarity-rs ./src --experimental-types --threshold 0.85
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. 7d ago First seen · 79 lines · 0 tokens per session scan A d01aa9372438

Subscribe to this mod's changes

similarity is a skill published in the GitHub repository nwiizo/cargo-coupling (96 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 579 tokens. 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-09-01.