akka-net-best-practices
Agent skill fromAaronontheweb/dotnet-skills
Critical Akka.NET best practices including EventStream vs DistributedPubSub, supervision strategies, error handling, Props vs DependencyResolver, work distribution patterns, and cluster/local mode abstractions for testability.
How to install akka-net-best-practices
install akka-net-best-practices
# install the dotnet-skills pack with the skills CLI
npx skills add Aaronontheweb/dotnet-skills# or add only this skill to Claude Code: copy the folder
skills/akka-best-practices/
# into
~/.claude/skills/akka-best-practices/ (all projects)
.claude/skills/akka-best-practices/ (one project)
1# Akka.NET Best Practices23## When to Use This Skill45Use this skill when:6- Designing actor communication patterns7- Deciding between EventStream and DistributedPubSub8- Implementing error handling in actors9- Understanding supervision strategies10- Choosing between Props patterns and DependencyResolver11- Designing work distribution across nodes12- Creating testable actor systems that can run with or without cluster infrastructure13- Abstracting over Cluster Sharding for local testing scenarios1415## Reference Files1617- [work-distribution-patterns.md](work-distribution-patterns.md): Database queues, Akka.Streams throttling, outbox pattern18- [cluster-local-abstractions.md](cluster-local-abstractions.md): GenericChildPerEntityParent, IPubSubMediator, execution mode wiring19- [async-cancellation-patterns.md](async-cancellation-patterns.md): Actor-scoped CancellationToken, linked CTS, timeout handling2021---2223## 1. EventStream vs DistributedPubSub2425### Critical: EventStream is LOCAL ONLY2627`Context.System.EventStream` is **local to a single ActorSystem process**. It does NOT work across cluster nodes.2829```csharp30// BAD: This only works on a single server31// When you add a second server, subscribers on server 2 won't receive events from server 132Context.System.EventStream.Subscribe(Self, typeof(PostCreated));33Context.System.EventStream.Publish(new PostCreated(postId, authorId));34```3536**When EventStream is appropriate:**37- Logging and diagnostics within a single process38…
Excerpt shown under the repository's MIT license.
