Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

cargo-machete货物砍刀

Agent Skill

cargo-machete 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,582

周安装

64

GitHub Stars

28

下载量

497
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cargo-machete(货物砍刀)
来源仓库:https://github.com/laurigates/claude-plugins
仓库路径:skills/cargo-machete
安装命令:
npx skills add https://github.com/laurigates/claude-plugins --skill cargo-machete
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/laurigates/claude-plugins --skill cargo-machete

简介

cargo-machete 用于检测并清理 Rust 项目中未使用的依赖项,优化构建体积与安全性。

  • 适合在代码审计、依赖清理或 CI/CD 流程中识别冗余包,提升项目维护效率。
  • 通过运行 cargo-machete 命令扫描 Cargo.toml,输出建议移除的条目供人工复核。
  • 安装前需确认项目为 Rust 工程,且具备执行 shell 命令的本地环境权限。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

cargo-machete - Unused Dependency Detection

Detect and remove unused dependencies in Rust projects using cargo-machete.

When to Use This Skill

Use this skill when...Use X instead when...
Auditing for unused dependenciesChecking for outdated deps -- use cargo outdated
Cleaning up Cargo.tomlAuditing security vulnerabilities -- use cargo audit
Optimizing build times by removing bloatChecking license compliance -- use cargo deny
Verifying deps in CINeed nightly-accurate analysis -- use cargo +nightly udeps

Context

  • Cargo.toml:!find. -maxdepth 1 -name \'Cargo.toml\'
  • Workspace:!grep -q '\[workspace\]' Cargo.toml
  • cargo-machete installed:!cargo machete --version
  • Machete config:!find. -maxdepth 1 -name \'.cargo-machete.toml\'
  • Workspace members:!grep -A 20 '^\[workspace\]' Cargo.toml

Execution

Execute this unused dependency analysis:

Step 1: Verify installation

Check if cargo-machete is installed (see Context above). If not installed, install it:

cargo install cargo-machete

Step 2: Run dependency analysis

Run cargo-machete with metadata for detailed output:

# Single crate
cargo machete --with-metadata

# Workspace (if Context shows workspace)
cargo machete --workspace --with-metadata

Step 3: Evaluate results

Review the output and classify each finding:

FindingAction
Genuinely unused dependencyRemove with --fix or manually
Proc-macro dependency (e.g., serde derive)Add machete:ignore comment
Build.rs-only dependencyMove to [build-dependencies]
Re-exported dependencyAdd machete:ignore comment with explanation

Step 4: Apply fixes

For confirmed unused dependencies, auto-remove them:

cargo machete --fix

For false positives, add ignore annotations in Cargo.toml:

serde = "1.0"  # machete:ignore - used via derive macro

Or create .cargo-machete.toml for project-wide ignores:

[ignore]
dependencies = ["serde", "log"]

Step 5: Verify build

After removing dependencies, confirm everything still compiles:

cargo check --all-targets
cargo test --no-run

False Positive Handling

ScenarioSolution
Proc-macro deps (e.g., serde derive)machete:ignore comment
Build.rs-only depsMove to [build-dependencies]
Re-exported depsmachete:ignore comment with explanation
Example/bench-only depsVerify in [dev-dependencies]

Comparison with cargo-udeps

Featurecargo-machetecargo-udeps
AccuracyGoodExcellent
SpeedVery fastSlower
Rust versionStableRequires nightly
False positivesSomeFewer

Use cargo-machete for fast CI checks. Use cargo-udeps for thorough audits:

cargo +nightly udeps --workspace --all-features

Agentic Optimizations

ContextCommand
Quick checkcargo machete
Detailed checkcargo machete --with-metadata
Workspace checkcargo machete --workspace --with-metadata
Auto-fixcargo machete --fix
Verify after fixcargo check --all-targets
Accurate check (nightly)cargo +nightly udeps --workspace

Quick Reference

FlagDescription
--with-metadataShow detailed output with versions and locations
--fixAuto-remove unused dependencies from Cargo.toml
--workspaceCheck all workspace members
-p <crate>Check specific workspace member
--exclude <crate>Exclude specific workspace member

Troubleshooting

ProblemSolution
Proc macro flagged as unusedAdd machete:ignore comment in Cargo.toml
Build.rs dep flaggedMove to [build-dependencies]
Re-exported dep flaggedAdd machete:ignore with explanation
Need more accuracyUse cargo +nightly udeps

For CI integration patterns, configuration file examples, pre-commit setup, and Makefile integration, see REFERENCE.md.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.11%
按下载量换算179

Claude

31.93%
按下载量换算159

Cursor

16.56%
按下载量换算82

Gemini CLI

8.83%
按下载量换算44

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/laurigates/claude-plugins --skill cargo-machete 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills