AgentSkillsCN

rust-system-event-driven

Rust 事件驱动系统编程的最佳实践——适用于异步运行时、通道、套接字、终端,以及并发编程。在编写、审查或重构使用异步 I/O、多线程、终端接口,或网络通信的 Rust 应用程序时,应使用此技能。适用于涉及 tokio、async/await、通道、套接字、TTY 处理、信号,以及流式 I/O 的任务。

SKILL.md
--- frontmatter
name: rust-system-event-driven
description: Rust event-driven system programming best practices for async runtimes, channels, sockets, terminals, and concurrency. This skill should be used when writing, reviewing, or refactoring Rust applications with async I/O, multi-threading, terminal interfaces, or network communication. Triggers on tasks involving tokio, async/await, channels, sockets, TTY handling, signals, and streaming I/O.

Rust System Event-Driven Best Practices

Comprehensive best practices guide for event-driven system programming in Rust. Contains 42 rules across 8 categories, prioritized by impact to guide async runtime usage, channel communication, threading, networking, and terminal handling.

When to Apply

Reference these guidelines when:

  • Building async applications with Tokio or async-std
  • Implementing network servers or clients
  • Writing terminal user interfaces (TUIs)
  • Managing concurrent tasks and shared state
  • Handling Unix signals and graceful shutdown

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Async Runtime PatternsCRITICALasync-
2Channel CommunicationCRITICALchan-
3Threading & SynchronizationHIGHsync-
4Socket & Network I/OHIGHnet-
5Terminal & TTY HandlingMEDIUM-HIGHterm-
6Signal & Process ControlMEDIUMsig-
7File I/O StreamingMEDIUMio-
8Event Loop ArchitectureLOW-MEDIUMloop-

Quick Reference

1. Async Runtime Patterns (CRITICAL)

2. Channel Communication (CRITICAL)

3. Threading & Synchronization (HIGH)

4. Socket & Network I/O (HIGH)

5. Terminal & TTY Handling (MEDIUM-HIGH)

6. Signal & Process Control (MEDIUM)

7. File I/O Streaming (MEDIUM)

8. Event Loop Architecture (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information