Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问clear审计通过

rustRust 工具

Agent Skill

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

总安装

367

周安装

15

GitHub Stars

38

下载量

118
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/lanej/dotfiles --skill rust

简介

lanej-dotfiles-rust 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 它可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 当前顶部介绍为空,需参考原始 SKILL.md 补充细节。
  • rust 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Rust/Cargo Development Skill

You are a Rust development specialist using cargo and related tools. This skill provides comprehensive workflows, best practices, and common patterns for Rust development.

IMPORTANT: Build Strategy

AVOID expensive builds:

  • DON'T use cargo build --release or cargo install --path. (very slow)
  • DON'T build unless necessary - use cargo check first
  • DO use cargo check to verify compilation (fast, no codegen)
  • DO use cargo run for iterative development and testing functionality (builds debug + runs in one command)
  • DO use debug builds for testing binaries (cargo build without --release)

Decision tree:

  1. Just checking if code compiles?cargo check (fastest)
  2. Developing/testing functionality?cargo run (builds debug + runs - use this for iteration)
  3. Need the binary artifact without running?cargo build (debug)
  4. Need optimized performance? → Only then use cargo build --release (slow)

Standard Development Workflow

Command Execution Order

Always follow this sequence when developing or validating Rust code:

cargo test --quiet
cargo check --quiet       # Fast compilation check (PREFER - no binary output)
cargo clippy

IMPORTANT: Use cargo check, NOT cargo build, for validation. Only use cargo build when you actually need the binary artifact.

For iterative development and testing functionality:

cargo run                 # Builds debug and runs (PREFERRED for development iteration)
cargo run -- arg1 arg2    # Pass arguments to test different scenarios
# OR
cargo build --quiet       # Only if you need the binary artifact without running it

Rationale:

  1. Tests first: Catch logic errors early
  2. Check second: Fast compilation verification without codegen
  3. Clippy third: Address code quality and style issues
  4. Run/Build last: Use cargo run to iterate on functionality, or cargo build if you need the artifact

Timeout Settings

Rust commands can be long-running, especially for large projects:

# Standard timeout (2 minutes) - sufficient for most operations
cargo test --quiet
cargo check --quiet
cargo build --quiet      # Debug build
# timeout: 120000

# Extended timeout ONLY for release builds (10 minutes) - AVOID if possible
cargo build --release    # WARNING: Very slow, only use when explicitly needed
# timeout: 600000

Best practice: Use the standard 2-minute timeout for check/test/debug builds. Only use extended timeout if you absolutely must do a release build.

Clippy - Linting and Code Quality

Auto-fix Workflow

Always attempt automatic fixes first:

cargo clippy --fix --allow-dirty

Flags:

  • --fix: Automatically apply suggested fixes
  • --allow-dirty: Allow fixes even with uncommitted changes
  • Implies --no-deps and --all-targets

Clippy Strategies

1. Distinguish Warning Types

Separate actionable issues from domain-appropriate patterns:

Actionable bugs:

  • Logic errors
  • Potential panics
  • Memory safety issues
  • API misuse

Domain-appropriate suppressions:

  • Domain-specific patterns (e.g., cast_possible_truncation in Excel formula evaluators)
  • False positives (e.g., unused_assignments for loop invariants)
  • Documentation lints for internal tools (e.g., missing_errors_doc)
  • Style preferences that don't affect correctness (e.g., needless_pass_by_value)

2. Suppression Hierarchy

Function-level suppression:

#[allow(clippy::cast_possible_truncation)]
fn process_excel_value(val: u64) -> u32 {
    val as u32  // Domain: Excel row numbers are always < u32::MAX
}

Module-level suppression (top of file):

#![allow(clippy::missing_errors_doc)]
#![allow(clippy::cast_possible_truncation)]

// Rest of module code...

Project-level suppression (Cargo.toml):

[lints.clippy]
missing_errors_doc = "allow"
cast_possible_truncation = "allow"
needless_pass_by_value = "allow"

3. Systematic Approach

  1. Run cargo clippy to see all warnings
  2. Run cargo clippy --fix --allow-dirty to auto-fix
  3. Review remaining warnings and categorize:

- Fix: Legitimate issues - Suppress: Domain-specific or false positives

  1. Add strategic suppressions at appropriate level
  2. Result: Only actionable warnings remain

Common Clippy Lints to Consider

Often suppressed in domain-specific code:

  • cast_possible_truncation - When domain guarantees safety
  • cast_sign_loss - When values are known positive
  • missing_errors_doc - Internal tools/libraries
  • missing_panics_doc - When panics are domain-impossible
  • needless_pass_by_value - API design choices
  • module_name_repetitions - Sometimes necessary for clarity
  • too_many_lines - Large but cohesive functions
  • unused_assignments - Loop invariants and initialization patterns

Generally should fix:

  • redundant_closure - Simplify code
  • unnecessary_unwrap - Handle errors properly
  • manual_map - Use iterator methods
  • match_same_arms - Reduce duplication
  • needless_return - Clean up style

Explaining Lints

Get detailed information about any lint:

cargo clippy --explain <LINT_NAME>

Command-line Lint Control

# Warn on specific lint
cargo clippy -- -W clippy::unwrap_used

# Deny specific lint (error)
cargo clippy -- -D clippy::unwrap_used

# Allow specific lint
cargo clippy -- -A clippy::needless_pass_by_value

# Forbid specific lint (cannot be overridden)
cargo clippy -- -F clippy::unwrap_used

Common Cargo Commands

Checking (Prefer This)

cargo check                    # Fast compilation check (PREFER THIS)
cargo check --quiet            # Suppress output
cargo check --all-targets      # Check all targets

Use cargo check instead of cargo build when you just need to verify code compiles.

Building

cargo build                    # Debug build (use for testing binary)
cargo build --quiet            # Suppress output
cargo build --all-targets      # Build all targets (bins, libs, tests, benches)
cargo build --target <TARGET>  # Cross-compile for target

# AVOID unless explicitly needed (very slow):
cargo build --release          # Optimized release build (WARNING: SLOW)

Testing

cargo test                     # Run all tests
cargo test --quiet             # Suppress output except failures
cargo test <NAME>              # Run specific test
cargo test --lib               # Test library only
cargo test --doc               # Test documentation examples
cargo test -- --nocapture      # Show println! output
cargo test -- --test-threads=1 # Run tests serially

Running

cargo run                      # Run default binary (debug build)
cargo run --bin <NAME>         # Run specific binary
cargo run --example <NAME>     # Run example
cargo run -- <ARGS>            # Pass arguments to binary

# AVOID unless you need optimized performance (very slow to build):
cargo run --release            # Run optimized build (WARNING: SLOW)

Documentation

cargo doc                      # Build documentation
cargo doc --open               # Build and open in browser
cargo doc --no-deps            # Only document this crate

Dependency Management

cargo add <CRATE>              # Add dependency
cargo add <CRATE>@<VERSION>    # Add specific version
cargo add --dev <CRATE>        # Add dev dependency
cargo remove <CRATE>           # Remove dependency
cargo update                   # Update dependencies in Cargo.lock
cargo update <CRATE>           # Update specific dependency

Project Management

cargo new <NAME>               # Create new binary project
cargo new --lib <NAME>         # Create new library project
cargo init                     # Initialize in current directory
cargo clean                    # Remove target directory

Publishing and Package Info

cargo search <QUERY>           # Search crates.io
cargo publish                  # Publish to crates.io
cargo package                  # Create distributable package
cargo tree                     # Show dependency tree

Process Management

Cleaning Up Background Processes

Cargo can leave processes running that cause "resource busy" or lock errors:

pkill -f cargo

Use this before running cargo commands if you encounter:

  • "resource busy" errors
  • Cargo.lock contention
  • Build hanging
  • File lock errors

Common Lock Issues

Problem: Multiple cargo processes fighting for Cargo.lock

Solution:

pkill -f cargo
cargo clean
cargo build

Configuration Best Practices

Cargo.toml Comments

Place comments on separate lines, not inline:

Correct:

# This dependency is used for CLI parsing
clap = "4.0"

# Linting configuration
[lints.clippy]
# Suppress in domain where values are guaranteed valid
cast_possible_truncation = "allow"

Incorrect:

clap = "4.0"  # This may cause parsing errors
cast_possible_truncation = "allow"  # Don't do this

Lint Configuration Structure

[lints.clippy]
# Code quality - generally enforce
unwrap_used = "warn"
expect_used = "warn"

# Domain-specific allowances
cast_possible_truncation = "allow"
missing_errors_doc = "allow"

# Style preferences
needless_pass_by_value = "allow"
module_name_repetitions = "allow"

Complete Development Workflows

Workflow 1: New Feature Development

# 1. Create feature branch (outside cargo)
git checkout -b feature/new-thing

# 2. Develop code
# ... edit files ...

# 3. Run full validation sequence
cargo test --quiet
cargo check --quiet       # Use check, not build, for validation
cargo clippy

# 4. Auto-fix clippy warnings
cargo clippy --fix --allow-dirty

# 5. Re-run validation
cargo test --quiet
cargo check --quiet
cargo clippy

# 6. Commit changes
git add .
git commit -m "Add new feature"

Workflow 2: Fixing Clippy Warnings

# 1. See all warnings
cargo clippy

# 2. Auto-fix what's possible
cargo clippy --fix --allow-dirty

# 3. Review remaining warnings
cargo clippy

# 4. For domain-specific warnings, add suppressions
# Edit Cargo.toml [lints.clippy] section or add #[allow(...)]

# 5. Verify clean clippy
cargo clippy

# 6. Ensure tests still pass
cargo test --quiet

Workflow 3: Debugging Build Issues

# 1. Clean build artifacts
cargo clean

# 2. Kill any stuck processes
pkill -f cargo

# 3. Check compilation only (faster)
cargo check

# 4. Full build with verbose output
cargo build --verbose

# 5. If still failing, check with different targets
cargo check --lib
cargo check --tests

Workflow 4: Dependency Updates

# 1. Check current dependency tree
cargo tree

# 2. Update all dependencies
cargo update

# 3. Or update specific dependency
cargo update serde

# 4. Validate after update
cargo test --quiet
cargo check --quiet       # Use check, not build, for validation
cargo clippy

# 5. Review Cargo.lock changes
git diff Cargo.lock

Workflow 5: Pre-commit Validation

# Complete validation before committing (PREFER THIS)
cargo test --quiet && cargo check --quiet && cargo clippy

# If any step fails, the sequence stops
# Fix issues and repeat

# NOTE: Only use cargo build instead of cargo check if you actually need
# the binary artifact. For validation, cargo check is sufficient and much faster.

Performance Optimization

Build Performance

# Use cargo check for fast iteration (PREFER THIS)
cargo check

# Parallel builds (default, but can tune)
cargo build -j 8

# Use cache-friendly flags (ONLY for actual releases)
cargo build --release --locked  # WARNING: SLOW - only for production releases

Development tip: cargo check is 2-10x faster than cargo build and sufficient for most development.

Test Performance

# Run only unit tests (fast)
cargo test --lib

# Skip slow integration tests
cargo test --lib --bins

# Run specific test module
cargo test module_name::

Common Patterns and Tips

Pattern 1: Iterative Development

# Fast check loop
cargo check
# ... fix errors ...
cargo check
# ... fix more ...
cargo test --quiet  # when ready to validate

Pattern 2: Release Preparation (ONLY for actual releases)

WARNING: Only use this workflow when preparing an actual release. For regular development, use the check-first workflow.

# Full validation for release (SLOW - only for actual releases)
cargo test
cargo test --release        # WARNING: SLOW
cargo build --release       # WARNING: VERY SLOW
cargo clippy -- -D warnings  # Deny all warnings
cargo doc --no-deps

For regular development, use instead:

cargo test --quiet
cargo check --quiet
cargo clippy

Pattern 3: Multi-target Projects

# Check everything
cargo check --all-targets
cargo test --all-targets
cargo clippy --all-targets

Pattern 4: Documentation Testing

# Test code examples in docs
cargo test --doc

# Build and review docs
cargo doc --open

Error Handling

Common Issues and Solutions

Issue: "could not compile due to previous error"

# Solution: Check specific error, may need cargo clean
cargo clean
cargo build

Issue: "waiting for file lock on package cache"

# Solution: Kill stuck processes
pkill -f cargo

Issue: Clippy warnings overwhelming

# Solution: Auto-fix first, then strategic suppression
cargo clippy --fix --allow-dirty
# Review remaining, add suppressions as needed

Issue: Tests passing but clippy failing

# Solution: This is normal - fix clippy issues or suppress appropriately
cargo clippy --fix --allow-dirty
# Then review and add strategic suppressions

Quick Reference

# Development cycle (PREFER - use check for validation)
cargo test --quiet && cargo check --quiet && cargo clippy

# Auto-fix clippy
cargo clippy --fix --allow-dirty

# Clean and re-check
pkill -f cargo && cargo clean && cargo check

# Update dependencies
cargo update && cargo test --quiet && cargo check --quiet

# Documentation
cargo doc --open

# Add dependency
cargo add <crate>

# Fast iteration (just checking compilation)
cargo check

# Only build when you need the binary artifact
cargo build

Integration with Git

After validation, use the git commit message writer agent:

  • Captures comprehensive commit context
  • Follows project conventions
  • Professional, human-written style (no AI attribution per CLAUDE.md)
# After cargo validation passes:
git add .
# Then request commit (use commit message writer agent)

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

Claude Code

29.66%
按下载量换算35

OpenCode

22.97%
按下载量换算27

Codex

15.85%
按下载量换算19

Antigravity

12.63%
按下载量换算15

Gemini CLI

7.35%
按下载量换算9

windsurf

3.53%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills