rust-actor_skill

This skill helps design and optimize Rust actor systems for reliable message passing, isolation, and fault tolerance using supervision patterns.
  • Shell

20

GitHub Stars

3

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill huiali/rust-skills --skill rust-actor

  • SKILL_EN.md5.1 KB
  • SKILL_ZH.md6.5 KB
  • SKILL.md15.1 KB

Overview

This skill is an actor-model expert for Rust engineers focused on message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, and pragmatic patterns (including Actix and Erlang-style concurrency). It turns actor design and diagnostics into actionable guidance, code patterns, and verification steps for production systems. The content centers on safe, scalable Rust actor architectures and operational checks.

How this skill works

The skill inspects actor design choices and suggests concrete refactors: actor boundaries, mailbox sizing, messaging patterns (fire-and-forget, request-response, streaming, broadcast), and supervision strategies. It diagnoses common faults (deadlocks, unbounded mailboxes, blocking handlers) and produces targeted fixes, lifecycle hooks, and verification commands. It also suggests Actix-compatible implementations and operational checks like tests, benches, and logging knobs.

When to use it

  • Designing new concurrent Rust systems that require isolated state and high scalability
  • Refactoring threaded code to actor-based message passing to reduce locks and races
  • Implementing or tuning supervision trees and restart strategies for fault tolerance
  • Diagnosing deadlocks, mailbox growth, or unresponsive actors
  • Integrating Actix actors or replacing ad-hoc async actors with structured lifecycle hooks

Best practices

  • Give each actor a single responsibility and keep state private to the actor
  • Use bounded mailboxes with backpressure to prevent unbounded memory growth
  • Prefer oneshot channels for request-response with explicit timeouts
  • Avoid circular request dependencies; enforce timeouts and redesign flows to be non-blocking
  • Use supervision trees with appropriate restart policies and restart windows
  • Keep blocking work off the actor thread by spawning blocking tasks or using async I/O

Example use cases

  • Simple counter actor with message handlers and reply channels for queries
  • Request-response pattern using oneshot and tokio::time::timeout to avoid hung requests
  • Supervisor managing children with OneForOne, AllForOne, and restart rate limiting
  • Bounded mailbox pattern to enforce backpressure under load and signal overload scenarios
  • Lifecycle-managed database actor that opens/closes connections in pre_start/post_stop

FAQ

Avoid synchronous circular requests, use timeouts on request-response calls, and redesign dependencies so actors do not wait on each other in a cycle.

When should I choose AllForOne vs OneForOne supervision?

Use OneForOne for independent failures. Use AllForOne when actors share tightly coupled state and must be restarted together to maintain consistency.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
rust-actor skill by huiali/rust-skills | VeilStrat