AgentSkillsCN

rust

Rust性能优化指南:在编写、审查或重构Rust代码时,这一技能将助您锁定最优性能模式。当您涉及内存分配、所有权机制、借用规则、迭代器、异步代码,或需要进行性能优化时,这一技能将自动触发,为您提供专业建议。

SKILL.md
--- frontmatter
name: rust
description: Rust performance optimization guidelines. This skill should be used when writing, reviewing, or refactoring Rust code to ensure optimal performance patterns. Triggers on tasks involving memory allocation, ownership, borrowing, iterators, async code, or performance optimization.

Community Rust Best Practices

Comprehensive performance optimization guide for Rust applications. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new Rust code
  • Optimizing memory allocation and ownership patterns
  • Working with iterators and collections
  • Writing async code with Tokio or other runtimes
  • Reviewing code for performance issues

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Memory AllocationCRITICALmem-
2Ownership & BorrowingCRITICALown-
3Data Structure SelectionHIGHds-
4Iterator & Collection PatternsHIGHiter-
5Async & ConcurrencyMEDIUM-HIGHasync-
6Algorithm ComplexityMEDIUMalgo-
7Compile-Time OptimizationMEDIUMcomp-
8Micro-optimizationsLOWmicro-

Quick Reference

1. Memory Allocation (CRITICAL)

2. Ownership & Borrowing (CRITICAL)

3. Data Structure Selection (HIGH)

4. Iterator & Collection Patterns (HIGH)

5. Async & Concurrency (MEDIUM-HIGH)

6. Algorithm Complexity (MEDIUM)

7. Compile-Time Optimization (MEDIUM)

8. Micro-optimizations (LOW)

How to Use

Read individual reference files for detailed explanations and code examples:

Full Compiled Document

For a comprehensive guide with all rules in a single document, see AGENTS.md.

Reference Files

FileDescription
AGENTS.mdComplete compiled guide with all rules
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information