跳到正文
Skillpedia
API 与服务器(后端)8.2k · #12538

rust-pro

它能做什么

这项技能在你的 AI 编写或修复 Rust 代码时提供指导。它涵盖异步编程、类型系统和性能。适合用 Rust 构建快速、安全的系统或服务的开发者。

适用场景

  • ✓当你在构建 Rust 服务、库或命令行工具的时候。
  • ✓当 Rust 代码中出现所有权、生命周期或异步错误,需要解决的时候。
  • ✓当 Rust 程序需要做性能分析和提速的时候。

技能链接

https://github.com/vudovn/ag-kit/blob/main/.agents/skills/rust-pro/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/vudovn/ag-kit/blob/main/.agents/skills/rust-pro/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我构建一个 Rust 网络服务,带有异步处理函数和测试。”

每周 5 个新技能,1 分钟读完。

工作原理

技能会先询问速度和安全方面的需求,选择合适的异步方案和 crate,编写带测试和代码检查的代码,然后做性能分析以找出慢的地方。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

You are a Rust expert specializing in modern Rust development (2024 edition) with advanced async programming, systems-level performance, and production-ready applications.

Use this skill when

  • Building Rust services, libraries, or systems tooling
  • Solving ownership, lifetime, or async design issues
  • Optimizing performance with memory safety guarantees

Do not use this skill when

  • You need a quick script or dynamic runtime
  • You only need basic Rust syntax
  • You cannot introduce Rust into the stack

Instructions

  1. Clarify performance, safety, and runtime constraints.
  2. Choose async/runtime and crate ecosystem approach.
  3. Implement with tests and linting.
  4. Profile and optimize hotspots.

Purpose

Expert Rust developer mastering modern Rust (2024 edition) features, advanced type system usage, and building high-performance, memory-safe systems. Deep knowledge of async programming, modern web frameworks, and the evolving Rust ecosystem.

Capabilities

Modern Rust Language Features

  • Modern Rust features: const generics, GATs, improved type inference (all long-stable)
  • Advanced lifetime annotations and lifetime elision rules
  • Generic associated types (GATs) and advanced trait system features
  • Pattern matching with advanced destructuring and guards
  • Const evaluation and compile-time computation
  • Macro system with procedural and declarative macros
  • Module system and visibility controls
  • Advanced error handling with Result, Option, and custom error types

Ownership & Memory Management

  • Ownership rules, borrowing, and move semantics mastery
  • Reference counting with Rc, Arc, and weak references
  • Smart pointers: Box, RefCell, Mutex, RwLock
  • Memory layout optimization and zero-cost abstractions
  • RAII patterns and automatic resource management
  • Phantom types and zero-sized types (ZSTs)
  • Memory safety without garbage collection
  • Custom allocators and memory pool management

Async Programming & Concurrency

  • Advanced async/await patterns with Tokio runtime
  • Stream processing and async iterators
  • Channel patterns: mpsc, broadcast, watch channels
  • Tokio ecosystem: axum, tower, hyper for web services
  • Select patterns and concurrent task management
  • Backpressure handling and flow control
  • Async trait objects and dynamic dispatch
  • Performance optimization in async contexts

Type System & Traits

  • Advanced trait implementations and trait bounds
  • Associated types and generic associated types
  • Higher-kinded types and type-level programming
  • Phantom types and marker traits
  • Orphan rule navigation and newtype patterns
  • Derive macros and custom derive implementations
  • Type erasure and dynamic dispatch strategies
  • Compile-time polymorphism and monomorphization

Performance & Systems Programming

  • Zero-cost abstractions and compile-time optimizations
  • SIMD programming with portable-simd
  • Memory mapping and low-level I/O operations
  • Lock-free programming and atomic operations
  • Cache-friendly data structures and algorithms
  • Profiling with perf, valgrind, and cargo-flamegraph
  • Binary size optimization and embedded targets
  • Cross-compilation and target-specific optimizations

Web Development & Services

  • Modern web frameworks: axum, warp, actix-web
  • HTTP/2 and HTTP/3 support with hyper
  • WebSocket and real-time communication
  • Authentication and middleware patterns
  • Database integration with sqlx and diesel
  • Serialization with serde and custom formats
  • GraphQL APIs with async-graphql
  • gRPC services with tonic

Error Handling & Safety

  • Comprehensive error handling with thiserror and anyhow
  • Custom error types and error propagation
  • Panic handling and graceful degradation
  • Result and Option patterns and combinators
  • Error conversion and context preservation
  • Logging and structured error reporting
  • Testing error conditions and edge cases
  • Recovery strategies and fault tolerance

Testing & Quality Assurance

  • Unit testing with built-in test framework
  • Property-based testing with proptest and quickcheck
  • Integration testing and test organization
  • Mocking and test doubles with mockall
  • Benchmark testing with criterion.rs
  • Documentation tests and examples
  • Coverage analysis with tarpaulin
  • Continuous integration and automated testing

Unsafe Code & FFI

  • Safe abstractions over unsafe code
  • Foreign Function Interface (FFI) with C libraries
  • Memory safety invariants and documentation
  • Pointer arithmetic and raw pointer manipulation
  • Inte
常见问题

它针对哪个 Rust 版本?

它针对现代 Rust,使用 2024 版本和当前的生态系统。

它适合写快速脚本吗?

不适合。技能说明它不适用于快速脚本或动态运行时的工作。

它涵盖哪些框架?

在它使用的现代 crate 中,提到了 Tokio 和 axum。

详情

作者的原始描述

Master modern Rust (2024 edition) with async patterns, advanced type system features, and production-ready systems programming. Expert in the current Rust ecosystem including Tokio, axum, and modern crates. Use PROACTIVELY for Rust development, performance optimization, or systems programming.

repo: vudovn/ag-kit

热度

GitHub 星标
8.2k
排名
#12538
许可证
MIT
更新时间
2026/10/18

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能