About rust-system-event-driven
A reference skill for Rust developers building event-driven systems, with 42 prioritized rules covering async runtimes, communication, concurrency, I/O, and event-loop design. It includes guidance for network services, terminal interfaces, and graceful shutdown.
Key features
- 0142 rules across eight categories
- 02Prioritized async runtime guidance
- 03Channel and synchronization patterns
- 04Network and terminal I/O practices
- 05Signal and shutdown handling
Use cases
- 01Reviewing Tokio or async-std applications
- 02Designing network clients and servers
- 03Building terminal user interfaces
- 04Managing concurrent tasks and shutdown
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ pproenca/ dot-skills --skill rust-system-event-drivenAfter installing, type/rust-system-event-drivenin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
README.mdmetadata.jsonassets/templates/_template.mdreferences/_sections.mdasync-cancellation-safe.mdasync-no-std-block.mdasync-select-biased.mdasync-spawn-blocking.mdasync-structured-concurrency.mdasync-task-local.mdchan-bounded-backpressure.mdchan-broadcast-fanout.mdchan-graceful-shutdown.mdchan-oneshot-response.mdchan-watch-state.mdio-async-file-ops.mdio-copy-bidirectional.mdio-flush-before-read.mdio-pipe-communication.mdio-stream-large-files.mdloop-actor-model.mdloop-cancellation-token.mdloop-event-types.mdloop-layered-architecture.mdloop-state-machine.mdnet-connection-pool.mdnet-framing-codec.mdnet-graceful-disconnect.mdnet-split-reader-writer.mdnet-tcp-nodelay.mdDetails
From the project READMERust 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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Async Runtime Patterns | CRITICAL | async- |
| 2 | Channel Communication | CRITICAL | chan- |
| 3 | Threading & Synchronization | HIGH | sync- |
| 4 | Socket & Network I/O | HIGH | net- |
| 5 | Terminal & TTY Handling | MEDIUM-HIGH | term- |
| 6 | Signal & Process Control | MEDIUM | sig- |
| 7 | File I/O Streaming | MEDIUM | io- |
| 8 | Event Loop Architecture | LOW-MEDIUM | loop- |
Quick Reference
1. Async Runtime Patterns (CRITICAL)
async-spawn-blocking- Use spawn_blocking for CPU-bound workasync-select-biased- Use biased select for priority handlingasync-no-std-block- Avoid std blocking calls in async contextasync-cancellation-safe- Design cancellation-safe async operationsasync-task-local- Use task-local storage for request contextasync-structured-concurrency- Use JoinSet for structured concurrency
2. Channel Communication (CRITICAL)
chan-bounded-backpressure- Use bounded channels for backpressurechan-oneshot-response- Use oneshot channels for request-responsechan-broadcast-fanout- Use broadcast channels for fan-outchan-watch-state- Use watch channels for shared statechan-graceful-shutdown- Use channel closure for graceful shutdown
3. Threading & Synchronization (HIGH)
sync-arc-mutex-shared- Use Arc for shared mutable statesync-rwlock-read-heavy- Use RwLock for read-heavy workloadssync-atomic-counters- Use atomics for simple counters and flagssync-avoid-lock-await- Avoid holding std Mutex across awaitsync-semaphore-limit- Use Semaphore to limit concurrencysync-parking-lot- Use parking_lot for high-contention locks
4. Socket & Network I/O (HIGH)
net-split-reader-writer- Split sockets into reader and writer halvesnet-framing-codec- Use framing for message-based protocolsnet-connection-pool- Use connection pools for repeated connectionsnet-timeout-all-io- Add timeouts to all network operationsnet-tcp-nodelay- Set TCP_NODELAY for low-latency protocolsnet-graceful-disconnect- Implement graceful connection shutdown
5. Terminal & TTY Handling (MEDIUM-HIGH)
term-raw-mode-restore- Always restore terminal state on exitterm-alternate-screen- Use alternate screen for full-screen appsterm-async-event-stream- Use async event stream for terminal inputterm-buffered-output- Buffer terminal output for performanceterm-handle-resize- Handle terminal resize events
6. Signal & Process Control (MEDIUM)
sig-ctrl-c-graceful- Handle Ctrl-C for graceful shutdownsig-unix-signals- Handle Unix signals asynchronouslysig-child-reap- Reap child processes to avoid zombiessig-timeout-shutdown- Set shutdown timeout to force exit
7. File I/O Streaming (MEDIUM)
io-async-file-ops- Use async file operations in async contextio-stream-large-files- Stream large files instead of loading entirelyio-copy-bidirectional- Use copy_bidirectional for proxyingio-pipe-communication- Use pipes for process communicationio-flush-before-read- Flush writes before expecting responses
8. Event Loop Architecture (LOW-MEDIUM)
loop-actor-model- Use actor pattern for stateful componentsloop-event-types- Use typed events over dynamic dispatchloop-state-machine- Model protocol state as type-safe state machineloop-layered-architecture- Separate I/O from business logicloop-cancellation-token- Use CancellationToken for coordinated shutdown
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |