Token导航 LogoToken导航TokenDH.com
AI 工具可写文件github未标认证来源可访问clear审计异常

rustRust 工具

Agent Skill

rust 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

635

周安装

27

GitHub Stars

4

下载量

222
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/petekp/agent-skills --skill rust

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合围绕仓库状态、代码变更或协作事项进行整理。
  • 可结合来源仓库和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态及是否会触发联网或命令执行。
  • 当前归类为 AI 工具,但功能描述偏向代码协作管理。

SKILL.md

Rust Engineering Guide

Patterns for building reliable Rust systems that handle file-backed data, external process integration, and cross-language boundaries.

Core Philosophy

Conservative by Default: Inputs from files, subprocesses, and external systems are untrusted.

  • Prefer false negatives over false positives
  • Same input → same output (deterministic)
  • Never panic on user machines due to bad input

Canonical Model Ownership: When Rust is the source of truth, maintain separate representations:

LayerPurposeCharacteristics
Internal domainBusiness logicExpressive enums, rich types
FFI DTOsCross-language boundaryFlat, stable, String-heavy
File formatPersistenceVersioned, round-trippable
External inputValidation boundaryStrictly validated, never trusted

Safe Rust Only: None of these patterns require unsafe. Use ecosystem crates for safe abstractions.


Reference Guides

Load the relevant reference when working in that domain:

DomainReferenceWhen to Load
Data Modelingreferences/data-modeling.mdSerde patterns, UniFFI, strong types, versioned schemas
File I/Oreferences/file-io.mdAtomic writes, concurrency control, file watching
Process Integrationreferences/process-integration.mdPID verification, subprocess handling, timestamps
Text & Parsingreferences/text-and-parsing.mdUTF-8 safety, path normalization, state machines
Testingreferences/testing.mdRound-trip tests, fuzz testing, Clippy lints

Error Handling

Library vs Application Errors

Libraries (public API): Use thiserror with granular error types per operation:

// File operations have their own error type
#[derive(thiserror::Error, Debug)]
pub enum ReadError {
    #[error("failed to read {path}")]
    Io { path: PathBuf, #[source] source: std::io::Error },

    #[error("parse error at line {line}: {message}")]
    Parse { line: usize, message: String },
}

// Subprocess operations have their own error type
#[derive(thiserror::Error, Debug)]
pub enum SubprocessError {
    #[error("failed to spawn process")]
    Spawn(#[source] std::io::Error),

    #[error("process exited with {code:?}: {stderr}")]
    NonZeroExit { code: Option<i32>, stderr: String },

    #[error("output not valid UTF-8")]
    InvalidUtf8(#[source] std::str::Utf8Error),

    #[error("timed out after {0:?}")]
    Timeout(std::time::Duration),
}

Applications (internal/binary): Use anyhow for context-rich errors:

use anyhow::{Context, Result};

fn load_config(path: &Path) -> Result<Config> {
    let content = std::fs::read_to_string(path)
        .with_context(|| format!("failed to read config from {}", path.display()))?;
    // ...
}

Graceful Degradation

Errors degrade functionality, not crash. But *log* when being lenient:

match parse_metadata(&line) {
    Ok(meta) => entries.push(meta),
    Err(e) => {
        tracing::warn!("skipping malformed entry at line {}: {}", line_num, e);
        // Continue processing other entries
    }
}

Quick Reference

Do

  • Use std::sync::LazyLock for static regex (Rust 1.80+)
  • Hold locks across entire read-modify-write cycles
  • Add #[serde(deny_unknown_fields)] for strict external input
  • Truncate strings with .chars() or graphemes, not byte slicing
  • Write files atomically with sync_all() before rename
  • Verify PID identity with process start time
  • Use saturating_sub for time arithmetic
  • Run cargo clippy -- -D warnings and cargo fmt before commit

Don't

  • Use #[from] without adding context (loses *which* file failed)
  • Create monolithic error enums spanning unrelated operations
  • Silently ignore errors without logging
  • Slice strings with &s[..N] (panics on char boundaries)
  • Assume directory iteration order is stable
  • Trust subprocess output without validation
  • Use unsafe (not needed for these patterns)

Bugs This Guide Prevents

BugPatternReference
PID reuse "ghost sessions"Store + verify process start timeprocess-integration.md
Timestamp unit mismatch (sec vs ms)Normalize on readprocess-integration.md
UTF-8 panic on truncationUse .chars().take(n)text-and-parsing.md
Lost updates under concurrencyLock spans full read-modify-writefile-io.md
Corrupt file on power losssync_all() before renamefile-io.md
Silent metadata corruptionAnchor updates to heading linestext-and-parsing.md
Old data breaks new code#[serde(default)] + aliasdata-modeling.md

Change Checklist

When modifying these systems, verify:

Schema / Serde

  • New fields use Option + #[serde(default)]
  • Old field names supported via alias (read) or rename (write)
  • External input uses #[serde(deny_unknown_fields)]

Concurrency

  • Mutex held across entire read-modify-write cycle
  • Shared state uses Mutex<T>, not thread_local!
  • File locking documents platform caveats if used

Robustness

  • No panics on file I/O or parse errors
  • Errors logged before being ignored
  • Subprocesses have timeouts

Quality

  • cargo clippy -- -D warnings passes
  • cargo fmt --check passes
  • No unsafe blocks (unless justified and audited)

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

OpenCode

30.41%
按下载量换算68

Claude Code

25.87%
按下载量换算57

Codex

19.75%
按下载量换算44

windsurf

11.97%
按下载量换算27

Cursor

7.47%
按下载量换算17

droid

3.33%
按下载量换算7

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

可写文件

该 Skill 可能写入或修改本地文件,使用前需要确认目标目录和修改范围。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills