Tooluck logoTooluck
SKILL.md

akka-hosting-actor-patterns

Agent skill fromAaronontheweb/dotnet-skills

Patterns for building entity actors with Akka.Hosting - GenericChildPerEntityParent, message extractors, cluster sharding abstraction, akka-reminders, and ITimeProvider. Supports both local testing and clustered production modes.

How to install akka-hosting-actor-patterns

install akka-hosting-actor-patterns
# 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-hosting-actor-patterns/

# into

~/.claude/skills/akka-hosting-actor-patterns/ (all projects)

.claude/skills/akka-hosting-actor-patterns/ (one project)

skills/akka-hosting-actor-patterns/SKILL.md

MITFull file
1# Akka.Hosting Actor Patterns
2
3## When to Use This Skill
4
5Use this skill when:
6- Building entity actors that represent domain objects (users, orders, invoices, etc.)
7- Need actors that work in both unit tests (no clustering) and production (cluster sharding)
8- Setting up scheduled tasks with akka-reminders
9- Registering actors with Akka.Hosting extension methods
10- Creating reusable actor configuration patterns
11
12## Core Principles
13
141. **Execution Mode Abstraction** - Same actor code runs locally (tests) or clustered (production)
152. **GenericChildPerEntityParent for Local** - Mimics sharding semantics without cluster overhead
163. **Message Extractors for Routing** - Reuse Akka.Cluster.Sharding's IMessageExtractor interface
174. **Akka.Hosting Extension Methods** - Fluent configuration that composes well
185. **ITimeProvider for Testability** - Use ActorSystem.Scheduler instead of DateTime.Now
19
20## Execution Modes
21
22Define an enum to control actor behavior:
23
24```csharp
25/// <summary>
26/// Determines how Akka.NET should be configured
27/// </summary>
28public enum AkkaExecutionMode
29{
30 /// <summary>
31 /// Pure local actor system - no remoting, no clustering.
32 /// Use GenericChildPerEntityParent instead of ShardRegion.
33 /// Ideal for unit tests and simple scenarios.
34 /// </summary>
35 LocalTest,
36
37 /// <summary>
38 /// Full clustering with ShardRegion.
39 /// Use for integration testing and production.
40 /// </summary>
41 Clustered
42}
43```
44
45## GenericChildPerEntityParent
46…

Excerpt shown under the repository's MIT license.

More skills in dotnet-skills

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates