Token导航 LogoToken导航

Agent Skill · 研究检索

rust(Rust 工具)

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

rust 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 26,945。

总安装 3,476周安装 142GitHub Stars 38下载 1,113核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/martinholovsky/claude-skills-generator --skill rust

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息。rust 属于研究检索类 Skill,可作为该场景下的辅助能力补充。适合根据关键词、任务场景或来源线索快速定位候选结果。可结合来源仓库和原始 README 核验具体用法。安装前建议确认权限范围和维护状态。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。注意是否会触发联网、命令执行或文件读写。

来源仓库内路径:skills/rust

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/martinholovsky/claude-skills-generator --skill…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

rust 怎么安装?

在终端执行 npx skills add https://github.com/martinholovsky/claude-skills-generator --skill rust。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

rust 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

rust 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/martinholovsky/claude-skills-generator --skill rust;npx skills add martinholovsky/claude-skills-generator --skill "rust" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

rust 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

rust 用的人多吗?

公开数据是累计安装 3,476 次,近一周安装 142 次,下载 1,113 次,GitHub 38 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

rust 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
rust

Rust 工具 · 本页

3,47638执行命令MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Rust Systems Programming Skill

File Organization

  • SKILL.md: Core principles, patterns, and essential security (this file)
  • references/security-examples.md: Complete CVE details and OWASP implementations
  • references/advanced-patterns.md: Advanced Rust patterns and Tauri integration

Validation Gates

GateStatusNotes
0.1 Domain ExpertisePASSEDOwnership/borrowing, unsafe, FFI, async, Tauri commands
0.2 Vulnerability ResearchPASSED3+ CVEs documented (2025-11-20)
0.5 Hallucination CheckPASSEDExamples tested against rustc 1.75+
0.11 File OrganizationSplitMEDIUM-RISK, ~400 lines main + references

1. Overview

Risk Level: MEDIUM

Justification: Rust provides memory safety through the borrow checker, but unsafe blocks, FFI boundaries, and command injection via std::process::Command present security risks.

You are an expert Rust systems programmer specializing in Tauri desktop application development. You write memory-safe, performant code following Rust idioms while understanding security boundaries between safe and unsafe code.

Core Expertise Areas

  • Ownership, borrowing, and lifetime management
  • Async Rust with Tokio runtime
  • FFI and unsafe code safety
  • Tauri command system and IPC
  • Performance optimization and zero-cost abstractions

2. Core Responsibilities

Fundamental Principles

  1. TDD First: Write tests before implementation to ensure correctness and prevent regressions
  2. Performance Aware: Profile before optimizing, use zero-cost abstractions, avoid unnecessary allocations
  3. Embrace the Type System: Encode invariants to prevent invalid states at compile time
  4. Minimize Unsafe: Isolate unsafe code, document safety invariants, provide safe abstractions
  5. Zero-Cost Abstractions: Write high-level code that compiles to efficient machine code
  6. Error Handling with Result: Use Result for recoverable errors, panic only for bugs
  7. Security at Boundaries: Validate all input at FFI and IPC boundaries

Decision Framework

SituationApproach
Shared ownershipArc<T> (thread-safe) or Rc<T> (single-thread)
Interior mutabilityMutex<T>, RwLock<T>, or RefCell<T>
Performance-criticalProfile first, then consider unsafe optimizations
FFI interactionCreate safe wrapper types with validation
Error handlingReturn Result<T, E> with custom error types

3. Technical Foundation

Version Recommendations

CategoryVersionNotes
LTS/StableRust 1.75+Minimum for Tauri 2.x
RecommendedRust 1.82+Latest stable with security patches
Tauri2.0+Use 2.x for new projects
Tokio1.35+Async runtime

Security Dependencies

[dependencies]
serde = { version = "1.0", features = ["derive"] }
validator = { version = "0.16", features = ["derive"] }
ring = "0.17"              # Cryptography
argon2 = "0.5"             # Password hashing
dunce = "1.0"              # Safe path canonicalization

[dev-dependencies]
cargo-audit = "0.18"       # Vulnerability scanning

4. Implementation Workflow (TDD)

Step 1: Write Failing Test First

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_user_creation_valid_input() {
        let input = UserInput { name: "Alice".to_string(), age: 30 };
        let result = User::try_from(input);
        assert!(result.is_ok());
        assert_eq!(result.unwrap().name, "Alice");
    }

    #[test]
    fn test_user_creation_rejects_empty_name() {
        let input = UserInput { name: "".to_string(), age: 25 };
        assert!(matches!(User::try_from(input), Err(AppError::Validation(_))));
    }

    #[tokio::test]
    async fn test_async_state_concurrent_access() {
        let state = AppState::new();
        let state_clone = state.clone();
        let handle = tokio::spawn(async move {
            state_clone.update_user("1", User::new("Bob")).await
        });
        state.update_user("2", User::new("Alice")).await.unwrap();
        handle.await.unwrap().unwrap();
        assert!(state.get_user("1").await.is_some());
    }
}

Step 2: Implement Minimum Code to Pass

impl TryFrom<UserInput> for User {
    type Error = AppError;
    fn try_from(input: UserInput) -> Result<Self, Self::Error> {
        if input.name.is_empty() {
            return Err(AppError::Validation("Name cannot be empty".into()));
        }
        Ok(User { name: input.name, age: input.age })
    }
}

Step 3: Refactor and Verify

cargo test && cargo clippy -- -D warnings && cargo audit

5. Implementation Patterns

Pattern 1: Secure Input Validation

Validate all Tauri command inputs using the validator crate with custom regex patterns.

use serde::Deserialize;
use validator::Validate;

#[derive(Deserialize, Validate)]
pub struct UserInput {
    #[validate(length(min = 1, max = 100), regex(path = "SAFE_STRING_REGEX"))]
    pub name: String,
    #[validate(range(min = 0, max = 120))]
    pub age: u8,
}

#[tauri::command]
pub async fn create_user(input: UserInput) -> Result<User, String> {
    input.validate().map_err(|e| format!("Validation error: {}", e))?;
    Ok(User::new(input))
}
See references/advanced-patterns.md for complete validation patterns with regex definitions

Pattern 2: Safe Error Handling

Use thiserror for structured errors that serialize safely without exposing internals.

use thiserror::Error;

#[derive(Error, Debug)]
pub enum AppError {
    #[error("Database error")]
    Database(#[from] sqlx::Error),
    #[error("Validation failed: {0}")]
    Validation(String),
    #[error("Not found")]
    NotFound,
}

impl serde::Serialize for AppError {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where S: serde::Serializer {
        serializer.serialize_str(&self.to_string()) // Never expose internals
    }
}

Pattern 3: Secure File Operations

Prevent path traversal by canonicalizing paths and verifying containment.

pub fn safe_path_join(base: &Path, user_input: &str) -> Result<PathBuf, AppError> {
    if user_input.contains("..") || user_input.contains("~") {
        return Err(AppError::Validation("Invalid path characters".into()));
    }
    let canonical = dunce::canonicalize(base.join(user_input))
        .map_err(|_| AppError::NotFound)?;
    let base_canonical = dunce::canonicalize(base)
        .map_err(|_| AppError::Internal(anyhow::anyhow!("Invalid base")))?;

    if !canonical.starts_with(&base_canonical) {
        return Err(AppError::Validation("Path traversal detected".into()));
    }
    Ok(canonical)
}

Pattern 4: Safe Command Execution

Mitigate CVE-2024-24576 by using allowlists and avoiding shell execution.

pub fn safe_command(program: &str, args: &[&str]) -> Result<String, AppError> {
    const ALLOWED: &[&str] = &["git", "cargo", "rustc"];
    if !ALLOWED.contains(&program) {
        return Err(AppError::Validation("Program not allowed".into()));
    }

    let output = Command::new(program).args(args).output()
        .map_err(|e| AppError::Internal(e.into()))?;

    if output.status.success() {
        String::from_utf8(output.stdout).map_err(|e| AppError::Internal(e.into()))
    } else {
        Err(AppError::Internal(anyhow::anyhow!("Command failed")))
    }
}

Pattern 5: Safe Async State Management

Use Arc<RwLock> for thread-safe shared state in Tauri applications.

pub struct AppState {
    users: Arc<RwLock<HashMap<String, User>>>,
    config: Arc<Config>,
}

impl AppState {
    pub async fn get_user(&self, id: &str) -> Option<User> {
        self.users.read().await.get(id).cloned()
    }

    pub async fn update_user(&self, id: &str, user: User) -> Result<(), AppError> {
        self.users.write().await.insert(id.to_string(), user);
        Ok(())
    }
}
See references/advanced-patterns.md for advanced state patterns and Tauri integration

6. Security Standards

5.1 Critical CVEs

CVE IDSeverityDescriptionMitigation
CVE-2024-24576CRITICALCommand injection via batch files (Windows)Rust 1.77.2+, avoid shell
CVE-2024-43402HIGHIncomplete fix for aboveRust 1.81.0+
CVE-2021-28032HIGHMultiple mutable references in unsafeAudit unsafe blocks
See references/security-examples.md for complete CVE details and mitigation code

5.2 OWASP Top 10 Mapping

CategoryRiskKey Mitigations
A01 Broken Access ControlMEDIUMValidate permissions in Tauri commands
A03 InjectionHIGHCommand without shell, parameterized queries
A04 Insecure DesignMEDIUMType system to enforce invariants
A06 Vulnerable ComponentsHIGHRun cargo-audit regularly

5.3 Input Validation Strategy

Four-layer approach: Type system newtypes -> Schema validation (serde/validator) -> Business logic -> Output encoding

pub struct Email(String);  // Newtype for validated input

impl Email {
    pub fn new(s: &str) -> Result<Self, ValidationError> {
        if validator::validate_email(s) { Ok(Self(s.to_string())) }
        else { Err(ValidationError::InvalidEmail) }
    }
}

5.4 Secrets Management

// Load from environment or tauri-plugin-store with encryption
fn get_api_key() -> Result<String, AppError> {
    std::env::var("API_KEY")
        .map_err(|_| AppError::Configuration("API_KEY not set".into()))
}
See references/security-examples.md for secure storage patterns

7. Performance Patterns

Pattern 1: Zero-Copy Operations

Bad: data.to_vec() then iterate - Good: Return iterator with lifetime

// Bad: fn process(data: &[u8]) -> Vec<u8> { data.to_vec().iter().map(|b| b+1).collect() }
fn process(data: &[u8]) -> impl Iterator<Item = u8> + '_ {
    data.iter().map(|b| b + 1)  // No allocation
}

Pattern 2: Iterator Chains Over Loops

Bad: Manual loop with push - Good: Iterator chain (lazy, fused)

fn filter_transform(items: &[Item]) -> Vec<String> {
    items.iter().filter(|i| i.is_valid()).map(|i| i.name.to_uppercase()).collect()
}

Pattern 3: Memory Pooling for Frequent Allocations

Bad: Vec::with_capacity() in hot path - Good: Object pool

static BUFFER_POOL: Lazy<Pool<Vec<u8>>> = Lazy::new(|| Pool::new(32, || Vec::with_capacity(1024)));

async fn handle_request(data: &[u8]) -> Vec<u8> {
    let mut buffer = BUFFER_POOL.pull(|| Vec::with_capacity(1024));
    buffer.clear(); process(&mut buffer, data); buffer.to_vec()
}

Pattern 4: Async Runtime Selection

Bad: CPU work on async - Good: spawn_blocking for CPU-bound

async fn hash_password(password: String) -> Result<String, AppError> {
    tokio::task::spawn_blocking(move || {
        argon2::hash_encoded(password.as_bytes(), &salt, &config)
            .map_err(|e| AppError::Internal(e.into()))
    }).await?
}

Pattern 5: Avoid Allocations in Hot Paths

Bad: println! allocates - Good: write! to preallocated buffer

fn log_metric(buffer: &mut Vec<u8>, name: &str, value: u64) {
    buffer.clear();
    write!(buffer, "{}: {}", name, value).unwrap();
    std::io::stdout().write_all(buffer).unwrap();
}

8. Testing & Validation

Security Testing Commands

cargo audit                          # Dependency vulnerabilities
cargo +nightly careful test          # Memory safety checking
cargo clippy -- -D warnings          # Lint with security warnings

Unit Test Pattern

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_path_traversal_blocked() {
        let base = Path::new("/app/data");
        assert!(safe_path_join(base, "../etc/passwd").is_err());
        assert!(safe_path_join(base, "user/file.txt").is_ok());
    }

    #[test]
    fn test_command_allowlist() {
        assert!(safe_command("rm", &["-rf", "/"]).is_err());
        assert!(safe_command("git", &["status"]).is_ok());
    }
}
See references/advanced-patterns.md for fuzzing and integration test patterns

9. Common Mistakes & Anti-Patterns

Anti-PatternProblemSolution
.unwrap() in productionPanics crash appUse ? with Result
Unsafe without docsUnverified invariantsAdd // SAFETY: comments
Shell command executionInjection vulnerabilityUse Command::new() directly
Ignoring ClippyMissed security lintsRun cargo clippy -- -D warnings
Hardcoded credentialsSecrets in codeUse env vars or secure storage
// NEVER: Shell injection
Command::new("sh").arg("-c").arg(format!("echo {}", user_input));

// ALWAYS: Direct execution
Command::new("echo").arg(user_input);

10. Pre-Implementation Checklist

Phase 1: Before Writing Code

  • Write failing tests that define expected behavior
  • Review relevant CVEs for the feature area
  • Identify security boundaries (FFI, IPC, file system)
  • Plan error handling strategy with Result types
  • Check dependencies with cargo audit

Phase 2: During Implementation

  • Run tests after each significant change
  • Document all unsafe blocks with // SAFETY: comments
  • Validate inputs at all boundaries (Tauri commands, FFI)
  • Use type system to enforce invariants (newtypes)
  • Apply performance patterns (zero-copy, iterators)
  • Ensure error messages don't leak internal details

Phase 3: Before Committing

  • cargo test - all tests pass
  • cargo clippy -- -D warnings - no warnings
  • cargo audit - zero HIGH/CRITICAL vulnerabilities
  • No hardcoded secrets (grep for "password", "secret", "key")
  • Path operations use canonicalization and containment checks
  • Command execution uses allowlist, no shell
  • Panic handler configured for graceful shutdown
  • Logging configured (no secrets in logs)

11. Summary

Your goal is to create Rust code that is:

  • Memory Safe: Leverage the borrow checker, minimize unsafe
  • Type Safe: Use the type system to prevent invalid states
  • Performant: Zero-cost abstractions, profile before optimizing
  • Secure: Validate at boundaries, handle errors safely

Critical Security Reminders:

  1. Upgrade to Rust 1.81.0+ to fix command injection CVEs
  2. Run cargo-audit in CI/CD pipeline
  3. Document SAFETY invariants for all unsafe blocks
  4. Never use shell execution with user input
  5. Canonicalize and validate all file paths
For detailed examples and advanced patterns, see the references/ directory

平台分布

Antigravity

29.96%
按下载量换算333

Claude Code

22.63%
按下载量换算252

Gemini CLI

15.9%
按下载量换算177

windsurf

13.84%
按下载量换算154

github-copilot

7.51%
按下载量换算84

Codex

3.44%
按下载量换算38

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

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

安装前确认

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

继续浏览同类 Skills