Tooluck logoTooluck
SKILL.md

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)

skills/akka-best-practices/SKILL.md

MITFull file
1# Akka.NET Best Practices
2
3## When to Use This Skill
4
5Use this skill when:
6- Designing actor communication patterns
7- Deciding between EventStream and DistributedPubSub
8- Implementing error handling in actors
9- Understanding supervision strategies
10- Choosing between Props patterns and DependencyResolver
11- Designing work distribution across nodes
12- Creating testable actor systems that can run with or without cluster infrastructure
13- Abstracting over Cluster Sharding for local testing scenarios
14
15## Reference Files
16
17- [work-distribution-patterns.md](work-distribution-patterns.md): Database queues, Akka.Streams throttling, outbox pattern
18- [cluster-local-abstractions.md](cluster-local-abstractions.md): GenericChildPerEntityParent, IPubSubMediator, execution mode wiring
19- [async-cancellation-patterns.md](async-cancellation-patterns.md): Actor-scoped CancellationToken, linked CTS, timeout handling
20
21---
22
23## 1. EventStream vs DistributedPubSub
24
25### Critical: EventStream is LOCAL ONLY
26
27`Context.System.EventStream` is **local to a single ActorSystem process**. It does NOT work across cluster nodes.
28
29```csharp
30// BAD: This only works on a single server
31// When you add a second server, subscribers on server 2 won't receive events from server 1
32Context.System.EventStream.Subscribe(Self, typeof(PostCreated));
33Context.System.EventStream.Publish(new PostCreated(postId, authorId));
34```
35
36**When EventStream is appropriate:**
37- Logging and diagnostics within a single process
38…

Excerpt shown under the repository's MIT license.

More skills in dotnet-skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates