[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79XWCBQY2C9SQCS1HT0B52H":3,"skill-same:01M79XWCBQY2C9SQCS1HT0B52H":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M79XWCBQY2C9SQCS1HT0B52H","akka-net-best-practices",null,"Critical Akka.NET best practices including EventStream vs DistributedPubSub, supervision strategies, error handling, Props vs DependencyResolver, work distribution patterns, and cluster\u002Flocal mode abstractions for testability.","Blind-Striker\u002Fagent-skills-and-plugins","Blind-Striker","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1965259?v=4","01M79WFXTE5PH0C1VB7B54ANMN","Deniz İrgin","01M79WFXV5KZ5GST1K8G035DM5",1,"MIT","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-akka\u002Fskills\u002Fakka-net-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: akka-net-best-practices\ndescription: Critical Akka.NET best practices including EventStream vs\n  DistributedPubSub, supervision strategies, error handling, Props vs\n  DependencyResolver, work distribution patterns, and cluster\u002Flocal mode\n  abstractions for testability.\nuser-invocable: false\n---\n\n# Akka.NET Best Practices\n\n## When to Use This Skill\n\nUse this skill when:\n- Designing actor communication patterns\n- Deciding between EventStream and DistributedPubSub\n- Implementing error handling in actors\n- Understanding supervision strategies\n- Choosing between Props patterns and DependencyResolver\n- Designing work distribution across nodes\n- Creating testable actor systems that can run with or without cluster infrastructure\n- Abstracting over Cluster Sharding for local testing scenarios\n\n## Reference Files\n\n- [work-distribution-patterns.md](work-distribution-patterns.md): Database queues, Akka.Streams throttling, outbox pattern\n- [cluster-local-abstractions.md](cluster-local-abstractions.md): GenericChildPerEntityParent, IPubSubMediator, execution mode wiring\n- [async-cancellation-patterns.md](async-cancellation-patterns.md): Actor-scoped CancellationToken, linked CTS, timeout handling\n\n---\n\n## 1. EventStream vs DistributedPubSub\n\n### Critical: EventStream is LOCAL ONLY\n\n`Context.System.EventStream` is **local to a single ActorSystem process**. It does NOT work across cluster nodes.\n\n```csharp\n\u002F\u002F BAD: This only works on a single server\n\u002F\u002F When you add a second server, subscribers on server 2 won't receive events from server 1\nContext.System.EventStream.Subscribe(Self, typeof(PostCreated));\nContext.System.EventStream.Publish(new PostCreated(postId, authorId));\n```\n\n**When EventStream is appropriate:**\n- Logging and diagnostics within a single process\n- Local event bus for truly single-process applications\n- Development\u002Ftesting scenarios\n\n### Use DistributedPubSub for Multi-Node\n\nFor events that must reach actors across multiple cluster nodes, use `Akka.Cluster.Tools.PublishSubscribe`:\n\n```csharp\nusing Akka.Cluster.Tools.PublishSubscribe;\n\npublic class TimelineUpdatePublisher : ReceiveActor\n{\n    private readonly IActorRef _mediator;\n\n    public TimelineUpdatePublisher()\n    {\n        \u002F\u002F Get the DistributedPubSub mediator\n        _mediator = DistributedPubSub.Get(Context.System).Mediator;\n\n        Receive\u003CPublishTimelineUpdate>(msg =>\n        {\n            \u002F\u002F Publish to a topic - reaches all subscribers across all nodes\n            _mediator.Tell(new Publish($\"timeline:{msg.UserId}\", msg.Update));\n        });\n    }\n}\n```\n\n### Akka.Hosting Configuration for DistributedPubSub\n\n```csharp\nbuilder.WithDistributedPubSub(role: null); \u002F\u002F Available on all roles, or specify a role\n```\n\n### Topic Design Patterns\n\n| Pattern | Topic Format | Use Case |\n|---------|--------------|----------|\n| Per-user | `timeline:{userId}` | Timeline updates, notifications |\n| Per-entity | `post:{postId}` | Post engagement updates |\n| Broadcast | `system:announcements` | System-wide notifications |\n| Role-based | `workers:rss-poller` | Work distribution |\n\n---\n\n## 2. Supervision Strategies\n\n### Key Clarification: Supervision is for CHILDREN\n\nA supervision strategy defined on an actor dictates **how that actor supervises its children**, NOT how the actor itself is supervised.\n\n```csharp\npublic class ParentActor : ReceiveActor\n{\n    \u002F\u002F This strategy applies to children of ParentActor, NOT to ParentActor itself\n    protected override SupervisorStrategy SupervisorStrategy()\n    {\n        return new OneForOneStrategy(\n            maxNrOfRetries: 10,\n            withinTimeRange: TimeSpan.FromSeconds(30),\n            decider: ex => ex switch\n            {\n                ArithmeticException => Directive.Resume,\n                NullReferenceException => Directive.Restart,\n                ArgumentException => Directive.Stop,\n                _ => Directive.Escalate\n            });\n    }\n}\n```\n\n### Default Supervision Strategy\n\nThe default `OneForOneStrategy` already includes rate limiting:\n- **10 restarts within 1 second** = actor is permanently stopped\n- This prevents infinite restart loops\n\n**You rarely need a custom strategy** unless you have specific requirements.\n\n### When to Define Custom Supervision\n\n**Good reasons:**\n- Actor throws exceptions indicating irrecoverable state corruption -> Restart\n- Actor throws exceptions that should NOT cause restart (expected failures) -> Resume\n- Child failures should affect siblings -> Use `AllForOneStrategy`\n- Need different retry limits than the default\n\n**Bad reasons:**\n- \"Just to be safe\" - the default is already safe\n- Don't understand what the actor does - understand it first\n\n---\n\n## 3. Error Handling: Supervision vs Try-Catch\n\n### When to Use Try-Catch (Most Cases)\n\n**Use try-catch when:**\n- The failure is **expected** (network timeout, invalid input, external service down)\n- You know **exactly why** the exception occurred\n- You can handle it **gracefully** (retry, return error response, log and continue)\n- Restarting would **not help** (same error would occur again)\n\n```csharp\npublic class RssFeedPollerActor : ReceiveActor\n{\n    public RssFeedPollerActor()\n    {\n        ReceiveAsync\u003CPollFeed>(async msg =>\n        {\n            try\n            {\n                var feed = await _httpClient.GetStringAsync(msg.FeedUrl);\n                var items = ParseFeed(feed);\n                \u002F\u002F Process items...\n            }\n            catch (HttpRequestException ex)\n            {\n                \u002F\u002F Expected failure - log and schedule retry\n                _log.Warning(\"Feed {Url} unavailable: {Error}\", msg.FeedUrl, ex.Message);\n                Context.System.Scheduler.ScheduleTellOnce(\n                    TimeSpan.FromMinutes(5), Self, msg, Self);\n            }\n            catch (XmlException ex)\n            {\n                \u002F\u002F Invalid feed format - log and mark as bad\n                _log.Error(\"Feed {Url} has invalid format: {Error}\", msg.FeedUrl, ex.Message);\n                Sender.Tell(new FeedPollResult.InvalidFormat(msg.FeedUrl));\n            }\n        });\n    }\n}\n```\n\n### When to Let Supervision Handle It\n\n**Let exceptions propagate (trigger supervision) when:**\n- You have **no idea** why the exception occurred\n- The actor's **state might be corrupt**\n- A **restart would help** (fresh state, reconnect resources)\n- It's a **programming error** (NullReferenceException, InvalidOperationException from bad logic)\n\n### Anti-Pattern: Swallowing Unknown Exceptions\n\n```csharp\n\u002F\u002F BAD: Swallowing exceptions hides problems\ncatch (Exception ex)\n{\n    _log.Error(ex, \"Error processing work\");\n    \u002F\u002F Actor continues with potentially corrupt state\n}\n\n\u002F\u002F GOOD: Handle known exceptions, let unknown ones propagate\ncatch (HttpRequestException ex)\n{\n    \u002F\u002F Known, expected failure - handle gracefully\n    _log.Warning(\"HTTP request failed: {Error}\", ex.Message);\n    Sender.Tell(new WorkResult.TransientFailure());\n}\n\u002F\u002F Unknown exceptions propagate to supervision\n```\n\n---\n\n## 4. Props vs DependencyResolver\n\n### When to Use Plain Props\n\n**Use `Props.Create()` when:**\n- Actor doesn't need `IServiceProvider` or `IRequiredActor\u003CT>`\n- All dependencies can be passed via constructor\n- Actor is simple and self-contained\n\n```csharp\n\u002F\u002F Simple actor with no DI needs\npublic static Props Props(PostId postId, IPostWriteStore store)\n    => Akka.Actor.Props.Create(() => new PostEngagementActor(postId, store));\n```\n\n### When to Use DependencyResolver\n\n**Use `resolver.Props\u003CT>()` when:**\n- Actor needs `IServiceProvider` to create scoped services\n- Actor uses `IRequiredActor\u003CT>` to get references to other actors\n- Actor has many dependencies that are already in DI container\n\n```csharp\n\u002F\u002F Registration with DI\nbuilder.WithActors((system, registry, resolver) =>\n{\n    var actor = system.ActorOf(resolver.Props\u003COrderProcessorActor>(), \"order-processor\");\n    registry.Register\u003COrderProcessorActor>(actor);\n});\n```\n\n### Remote Deployment Considerations\n\n**You almost never need remote deployment.** If you're not doing remote deployment (and you probably aren't):\n- `Props.Create(() => new Actor(...))` with closures is fine\n- The \"serialization issue\" warning doesn't apply\n\nFor most applications, use **cluster sharding** instead of remote deployment - it handles distribution automatically.\n\n---\n\n## 5. Work Distribution Patterns\n\nWhen you have many background jobs (RSS feeds, email sending, etc.), don't process them all at once - this causes thundering herd problems.\n\n**Three patterns to solve this:**\n1. **Database-Driven Work Queue** - Use `FOR UPDATE SKIP LOCKED` for natural cross-node distribution\n2. **Akka.Streams Rate Limiting** - Throttle processing within a single node\n3. **Durable Queue (Outbox Pattern)** - Database-backed outbox for reliable processing\n\nSee [work-distribution-patterns.md](work-distribution-patterns.md) for full code samples.\n\n---\n\n## 6. Common Mistakes Summary\n\n| Mistake | Why It's Wrong | Fix |\n|---------|----------------|-----|\n| Using EventStream for cross-node pub\u002Fsub | EventStream is local only | Use DistributedPubSub |\n| Defining supervision to \"protect\" an actor | Supervision protects children | Understand the hierarchy |\n| Catching all exceptions | Hides bugs, corrupts state | Only catch expected errors |\n| Always using DependencyResolver | Adds unnecessary complexity | Use plain Props when possible |\n| Processing all background jobs at once | Thundering herd, resource exhaustion | Use database queue + rate limiting |\n| Throwing exceptions for expected failures | Triggers unnecessary restarts | Return result types, use messaging |\n\n---\n\n## 7. Quick Reference\n\n### Communication Pattern Decision Tree\n\n```\nNeed to communicate between actors?\n├── Same process only? -> EventStream is fine\n├── Across cluster nodes?\n│   ├── Point-to-point? -> Use ActorSelection or known IActorRef\n│   └── Pub\u002Fsub? -> Use DistributedPubSub\n└── Fire-and-forget to external system? -> Consider outbox pattern\n```\n\n### Error Handling Decision Tree\n\n```\nException occurred in actor?\n├── Expected failure (HTTP timeout, invalid input)?\n│   └── Try-catch, handle gracefully, continue\n├── State might be corrupt?\n│   └── Let supervision restart\n├── Unknown cause?\n│   └── Let supervision restart\n└── Programming error (null ref, bad logic)?\n    └── Let supervision restart, fix the bug\n```\n\n### Props Decision Tree\n\n```\nCreating actor Props?\n├── Actor needs IServiceProvider?\n│   └── Use resolver.Props\u003CT>()\n├── Actor needs IRequiredActor\u003CT>?\n│   └── Use resolver.Props\u003CT>()\n├── Simple actor with constructor params?\n│   └── Use Props.Create(() => new Actor(...))\n└── Remote deployment needed?\n    └── Probably not - use cluster sharding instead\n```\n\n---\n\n## 8. Cluster\u002FLocal Mode Abstractions\n\nFor applications that need to run both in clustered production and local\u002Ftest environments, use abstraction patterns to toggle between implementations:\n\n- **`AkkaExecutionMode` enum** - Controls which implementations are used (LocalTest vs Clustered)\n- **`GenericChildPerEntityParent`** - Mimics sharding behavior locally using the same `IMessageExtractor`\n- **`IPubSubMediator`** - Abstracts DistributedPubSub for swappable local\u002Fcluster implementations\n\nSee [cluster-local-abstractions.md](cluster-local-abstractions.md) for complete implementation code.\n\n---\n\n## 9. Actor Logging\n\n### Use ILoggingAdapter, Not ILogger\u003CT>\n\nIn actors, use `ILoggingAdapter` from `Context.GetLogger()` instead of DI-injected `ILogger\u003CT>`:\n\n```csharp\npublic class MyActor : ReceiveActor\n{\n    private readonly ILoggingAdapter _log = Context.GetLogger();\n\n    public MyActor()\n    {\n        Receive\u003CMyMessage>(msg =>\n        {\n            _log.Info(\"Processing message for user {UserId}\", msg.UserId);\n            _log.Error(ex, \"Failed to process {MessageType}\", msg.GetType().Name);\n        });\n    }\n}\n```\n\n**Why ILoggingAdapter:**\n- Integrates with Akka's logging pipeline and supervision\n- Supports semantic\u002Fstructured logging as of v1.5.57\n- Method names: `Info()`, `Debug()`, `Warning()`, `Error()` (not `Log*` variants)\n- No DI required - obtained directly from actor context\n\n**Don't inject ILogger\u003CT> into actors** - it bypasses Akka's logging infrastructure.\n\n### Semantic Logging (v1.5.57+)\n\n```csharp\n\u002F\u002F Named placeholders for better log aggregation and querying\n_log.Info(\"Order {OrderId} processed for customer {CustomerId}\", order.Id, order.CustomerId);\n\n\u002F\u002F Prefer named placeholders over positional\n\u002F\u002F Good: {OrderId}, {CustomerId}\n\u002F\u002F Avoid: {0}, {1}\n```\n\n---\n\n## 10. Managing Async Operations with CancellationToken\n\nWhen actors launch async operations via `PipeTo`, those operations can outlive the actor if not properly managed. Key practices:\n\n- **Actor CTS in PostStop** - Always cancel and dispose in `PostStop()`\n- **New CTS per operation** - Cancel previous before starting new work\n- **Pass token everywhere** - EF Core queries, HTTP calls, etc.\n- **Linked CTS for timeouts** - External calls get short timeouts to prevent hanging\n- **Graceful handling** - Distinguish timeout vs shutdown in catch blocks\n\nSee [async-cancellation-patterns.md](async-cancellation-patterns.md) for complete implementation code.\n","# Akka.NET Best Practices\n\n## When to Use This Skill\n\nUse this skill when:\n- Designing actor communication patterns\n- Deciding between EventStream and DistributedPubSub\n- Implementing error handling in actors\n- Understanding supervision strategies\n- Choosing between Props patterns and DependencyResolver\n- Designing work distribution across nodes\n- Creating testable actor systems that can run with or without cluster infrastructure\n- Abstracting over Cluster Sharding for local testing scenarios\n\n## Reference Files\n\n- [work-distribution-patterns.md](work-distribution-patterns.md): Database queues, Akka.Streams throttling, outbox pattern\n- [cluster-local-abstractions.md](cluster-local-abstractions.md): GenericChildPerEntityParent, IPubSubMediator, execution mode wiring\n- [async-cancellation-patterns.md](async-cancellation-patterns.md): Actor-scoped CancellationToken, linked CTS, timeout handling\n\n---\n\n## 1. EventStream vs DistributedPubSub\n\n### Critical: EventStream is LOCAL ONLY\n\n`Context.System.EventStream` is **local to a single ActorSystem process**. It does NOT work across cluster nodes.\n\n```csharp\n\u002F\u002F BAD: This only works on a single server\n\u002F\u002F When you add a second server, subscribers on server 2 won't receive events from server 1\nContext.System.EventStream.Subscribe(Self, typeof(PostCreated));\nContext.System.EventStream.Publish(new PostCreated(postId, authorId));\n```\n\n**When EventStream is appropriate:**\n- Logging and diagnostics within a single process\n- Local event bus for truly single-process applications\n- Development\u002Ftesting scenarios\n\n### Use DistributedPubSub for Multi-Node\n\nFor events that must reach actors across multiple cluster nodes, use `Akka.Cluster.Tools.PublishSubscribe`:\n\n```csharp\nusing Akka.Cluster.Tools.PublishSubscribe;\n\npublic class TimelineUpdatePublisher : ReceiveActor\n{\n    private readonly IActorRef _mediator;\n\n    public TimelineUpdatePublisher()\n    {\n        \u002F\u002F Get the DistributedPubSub mediator\n        _mediator = DistributedPubSub.Get(Context.System).Mediator;\n\n        Receive\u003CPublishTimelineUpdate>(msg =>\n        {\n            \u002F\u002F Publish to a topic - reaches all subscribers across all nodes\n            _mediator.Tell(new Publish($\"timeline:{msg.UserId}\", msg.Update));\n        });\n    }\n}\n```\n\n### Akka.Hosting Configuration for DistributedPubSub\n\n```csharp\nbuilder.WithDistributedPubSub(role: null); \u002F\u002F Available on all roles, or specify a role\n```\n\n### Topic Design Patterns\n\n| Pattern | Topic Format | Use Case |\n|---------|--------------|----------|\n| Per-user | `timeline:{userId}` | Timeline updates, notifications |\n| Per-entity | `post:{postId}` | Post engagement updates |\n| Broadcast | `system:announcements` | System-wide notifications |\n| Role-based | `workers:rss-poller` | Work distribution |\n\n---\n\n## 2. Supervision Strategies\n\n### Key Clarification: Supervision is for CHILDREN\n\nA supervision strategy defined on an actor dictates **how that actor supervises its children**, NOT how the actor itself is supervised.\n\n```csharp\npublic class ParentActor : ReceiveActor\n{\n    \u002F\u002F This strategy applies to children of ParentActor, NOT to ParentActor itself\n    protected override SupervisorStrategy SupervisorStrategy()\n    {\n        return new OneForOneStrategy(\n            maxNrOfRetries: 10,\n            withinTimeRange: TimeSpan.FromSeconds(30),\n            decider: ex => ex switch\n            {\n                ArithmeticException => Directive.Resume,\n                NullReferenceException => Directive.Restart,\n                ArgumentException => Directive.Stop,\n                _ => Directive.Escalate\n            });\n    }\n}\n```\n\n### Default Supervision Strategy\n\nThe default `OneForOneStrategy` already includes rate limiting:\n- **10 restarts within 1 second** = actor is permanently stopped\n- This prevents infinite restart loops\n\n**You rarely need a custom strategy** unless you have specific requirements.\n\n### When to Define Custom Supervision\n\n**Good reasons:**\n- Actor throws exceptions indicating irrecoverable state corruption -> Restart\n- Actor throws exceptions that should NOT cause restart (expected failures) -> Resume\n- Child failures should affect siblings -> Use `AllForOneStrategy`\n- Need different retry limits than the default\n\n**Bad reasons:**\n- \"Just to be safe\" - the default is already safe\n- Don't understand what the actor does - understand it first\n\n---\n\n## 3. Error Handling: Supervision vs Try-Catch\n\n### When to Use Try-Catch (Most Cases)\n\n**Use try-catch when:**\n- The failure is **expected** (network timeout, invalid input, external service down)\n- You know **exactly why** the exception occurred\n- You can handle it **gracefully** (retry, return error response, log and continue)\n- Restarting would **not help** (same error would occur again)\n\n```csharp\npublic class RssFeedPollerActor : ReceiveActor\n{\n    public RssFeedPollerActor()\n    {\n        ReceiveAsync\u003CPollFeed>(async msg =>\n        {\n            try\n            {\n                var feed = await _httpClient.GetStringAsync(msg.FeedUrl);\n                var items = ParseFeed(feed);\n                \u002F\u002F Process items...\n            }\n            catch (HttpRequestException ex)\n            {\n                \u002F\u002F Expected failure - log and schedule retry\n                _log.Warning(\"Feed {Url} unavailable: {Error}\", msg.FeedUrl, ex.Message);\n                Context.System.Scheduler.ScheduleTellOnce(\n                    TimeSpan.FromMinutes(5), Self, msg, Self);\n            }\n            catch (XmlException ex)\n            {\n                \u002F\u002F Invalid feed format - log and mark as bad\n                _log.Error(\"Feed {Url} has invalid format: {Error}\", msg.FeedUrl, ex.Message);\n                Sender.Tell(new FeedPollResult.InvalidFormat(msg.FeedUrl));\n            }\n        });\n    }\n}\n```\n\n### When to Let Supervision Handle It\n\n**Let exceptions propagate (trigger supervision) when:**\n- You have **no idea** why the exception occurred\n- The actor's **state might be corrupt**\n- A **restart would help** (fresh state, reconnect resources)\n- It's a **programming error** (NullReferenceException, InvalidOperationException from bad logic)\n\n### Anti-Pattern: Swallowing Unknown Exceptions\n\n```csharp\n\u002F\u002F BAD: Swallowing exceptions hides problems\ncatch (Exception ex)\n{\n    _log.Error(ex, \"Error processing work\");\n    \u002F\u002F Actor continues with potentially corrupt state\n}\n\n\u002F\u002F GOOD: Handle known exceptions, let unknown ones propagate\ncatch (HttpRequestException ex)\n{\n    \u002F\u002F Known, expected failure - handle gracefully\n    _log.Warning(\"HTTP request failed: {Error}\", ex.Message);\n    Sender.Tell(new WorkResult.TransientFailure());\n}\n\u002F\u002F Unknown exceptions propagate to supervision\n```\n\n---\n\n## 4. Props vs DependencyResolver\n\n### When to Use Plain Props\n\n**Use `Props.Create()` when:**\n- Actor doesn't need `IServiceProvider` or `IRequiredActor\u003CT>`\n- All dependencies can be passed via constructor\n- Actor is simple and self-contained\n\n```csharp\n\u002F\u002F Simple actor with no DI needs\npublic static Props Props(PostId postId, IPostWriteStore store)\n    => Akka.Actor.Props.Create(() => new PostEngagementActor(postId, store));\n```\n\n### When to Use DependencyResolver\n\n**Use `resolver.Props\u003CT>()` when:**\n- Actor needs `IServiceProvider` to create scoped services\n- Actor uses `IRequiredActor\u003CT>` to get references to other actors\n- Actor has many dependencies that are already in DI container\n\n```csharp\n\u002F\u002F Registration with DI\nbuilder.WithActors((system, registry, resolver) =>\n{\n    var actor = system.ActorOf(resolver.Props\u003COrderProcessorActor>(), \"order-processor\");\n    registry.Register\u003COrderProcessorActor>(actor);\n});\n```\n\n### Remote Deployment Considerations\n\n**You almost never need remote deployment.** If you're not doing remote deployment (and you probably aren't):\n- `Props.Create(() => new Actor(...))` with closures is fine\n- The \"serialization issue\" warning doesn't apply\n\nFor most applications, use **cluster sharding** instead of remote deployment - it handles distribution automatically.\n\n---\n\n## 5. Work Distribution Patterns\n\nWhen you have many background jobs (RSS feeds, email sending, etc.), don't process them all at once - this causes thundering herd problems.\n\n**Three patterns to solve this:**\n1. **Database-Driven Work Queue** - Use `FOR UPDATE SKIP LOCKED` for natural cross-node distribution\n2. **Akka.Streams Rate Limiting** - Throttle processing within a single node\n3. **Durable Queue (Outbox Pattern)** - Database-backed outbox for reliable processing\n\nSee [work-distribution-patterns.md](work-distribution-patterns.md) for full code samples.\n\n---\n\n## 6. Common Mistakes Summary\n\n| Mistake | Why It's Wrong | Fix |\n|---------|----------------|-----|\n| Using EventStream for cross-node pub\u002Fsub | EventStream is local only | Use DistributedPubSub |\n| Defining supervision to \"protect\" an actor | Supervision protects children | Understand the hierarchy |\n| Catching all exceptions | Hides bugs, corrupts state | Only catch expected errors |\n| Always using DependencyResolver | Adds unnecessary complexity | Use plain Props when possible |\n| Processing all background jobs at once | Thundering herd, resource exhaustion | Use database queue + rate limiting |\n| Throwing exceptions for expected failures | Triggers unnecessary restarts | Return result types, use messaging |\n\n---\n\n## 7. Quick Reference\n\n### Communication Pattern Decision Tree\n\n```\nNeed to communicate between actors?\n├── Same process only? -> EventStream is fine\n├── Across cluster nodes?\n│   ├── Point-to-point? -> Use ActorSelection or known IActorRef\n│   └── Pub\u002Fsub? -> Use DistributedPubSub\n└── Fire-and-forget to external system? -> Consider outbox pattern\n```\n\n### Error Handling Decision Tree\n\n```\nException occurred in actor?\n├── Expected failure (HTTP timeout, invalid input)?\n│   └── Try-catch, handle gracefully, continue\n├── State might be corrupt?\n│   └── Let supervision restart\n├── Unknown cause?\n│   └── Let supervision restart\n└── Programming error (null ref, bad logic)?\n    └── Let supervision restart, fix the bug\n```\n\n### Props Decision Tree\n\n```\nCreating actor Props?\n├── Actor needs IServiceProvider?\n│   └── Use resolver.Props\u003CT>()\n├── Actor needs IRequiredActor\u003CT>?\n│   └── Use resolver.Props\u003CT>()\n├── Simple actor with constructor params?\n│   └── Use Props.Create(() => new Actor(...))\n└── Remote deployment needed?\n    └── Probably not - use cluster sharding instead\n```\n\n---\n\n## 8. Cluster\u002FLocal Mode Abstractions\n\nFor applications that need to run both in clustered production and local\u002Ftest environments, use abstraction patterns to toggle between implementations:\n\n- **`AkkaExecutionMode` enum** - Controls which implementations are used (LocalTest vs Clustered)\n- **`GenericChildPerEntityParent`** - Mimics sharding behavior locally using the same `IMessageExtractor`\n- **`IPubSubMediator`** - Abstracts DistributedPubSub for swappable local\u002Fcluster implementations\n\nSee [cluster-local-abstractions.md](cluster-local-abstractions.md) for complete implementation code.\n\n---\n\n## 9. Actor Logging\n\n### Use ILoggingAdapter, Not ILogger\u003CT>\n\nIn actors, use `ILoggingAdapter` from `Context.GetLogger()` instead of DI-injected `ILogger\u003CT>`:\n\n```csharp\npublic class MyActor : ReceiveActor\n{\n    private readonly ILoggingAdapter _log = Context.GetLogger();\n\n    public MyActor()\n    {\n        Receive\u003CMyMessage>(msg =>\n        {\n            _log.Info(\"Processing message for user {UserId}\", msg.UserId);\n            _log.Error(ex, \"Failed to process {MessageType}\", msg.GetType().Name);\n        });\n    }\n}\n```\n\n**Why ILoggingAdapter:**\n- Integrates with Akka's logging pipeline and supervision\n- Supports semantic\u002Fstructured logging as of v1.5.57\n- Method names: `Info()`, `Debug()`, `Warning()`, `Error()` (not `Log*` variants)\n- No DI required - obtained directly from actor context\n\n**Don't inject ILogger\u003CT> into actors** - it bypasses Akka's logging infrastructure.\n\n### Semantic Logging (v1.5.57+)\n\n```csharp\n\u002F\u002F Named placeholders for better log aggregation and querying\n_log.Info(\"Order {OrderId} processed for customer {CustomerId}\", order.Id, order.CustomerId);\n\n\u002F\u002F Prefer named placeholders over positional\n\u002F\u002F Good: {OrderId}, {CustomerId}\n\u002F\u002F Avoid: {0}, {1}\n```\n\n---\n\n## 10. Managing Async Operations with CancellationToken\n\nWhen actors launch async operations via `PipeTo`, those operations can outlive the actor if not properly managed. Key practices:\n\n- **Actor CTS in PostStop** - Always cancel and dispose in `PostStop()`\n- **New CTS per operation** - Cancel previous before starting new work\n- **Pass token everywhere** - EF Core queries, HTTP calls, etc.\n- **Linked CTS for timeouts** - External calls get short timeouts to prevent hanging\n- **Graceful handling** - Distinguish timeout vs shutdown in catch blocks\n\nSee [async-cancellation-patterns.md](async-cancellation-patterns.md) for complete implementation code.\n",{"name":5,"description":7,"user-invocable":20},"master","b30b1c1908dbc56a8184128f18803053d762ccb5","plugins\u002Fdeniz-dotnet-akka\u002Fskills\u002Fakka-net-best-practices",0,"https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins","https:\u002F\u002Fgithub.com\u002FBlind-Striker","denizirgin.com","VP of Engineering - \r\n@armutcom @homeruntech @prontopro\r\n |  Speaker \r\n@CodeFiction\r\n, http:\u002F\u002Fcodefiction.tech | Developer, gamer, blogger, maiden iron fan","2026-11-13 00:23:18",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Blind-Striker\u002Fagent-skills-and-plugins --skill akka-net-best-practices",{"tool":39,"command":40},"bunx","bunx skills add Blind-Striker\u002Fagent-skills-and-plugins --skill akka-net-best-practices",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Blind-Striker\u002Fagent-skills-and-plugins --skill akka-net-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-akka\u002Fskills\u002Fakka-net-best-practices\u002FSKILL.md",true,[47,53,57],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"async-cancellation-patterns.md","REFERENCE","参考文档",4210,"https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-akka\u002Fskills\u002Fakka-net-best-practices\u002Fasync-cancellation-patterns.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"cluster-local-abstractions.md",11235,"https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-akka\u002Fskills\u002Fakka-net-best-practices\u002Fcluster-local-abstractions.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"work-distribution-patterns.md",4862,"https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-akka\u002Fskills\u002Fakka-net-best-practices\u002Fwork-distribution-patterns.md",[62,69,76,83,90,97],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M79YGWBJ52PHMSTKJ3RJ3AWR","writing-tunit-tests","Write tests in TUnit — the attributes, the async assertion model, data-driven cases, lifecycle hooks, and the parallelism rules. USE FOR writing or fixing a test in a TUnit project, translating a test idea into TUnit syntax, or reviewing TUnit test code for API mistakes. DO NOT USE FOR deciding what to test, judging whether a test is any good, or running tests.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-dotnet-general\u002Fwriting-tunit-tests\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79YGR3Y9RCRS6TD71D0KKP8","dotnet-walls","Walls for a .NET change in a repository without its own quality gates — pinned, ephemeral analyzer, format, clone and scanner commands for the verify step, their identity ratchet, and the build traps. Use during a walls preflight, or when a worker's verify step needs .NET quality gates.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-dotnet-general\u002Fdotnet-walls\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M79YGFNJBST7D803NQW3SBYM","csharp-15","Write, review and modernize C# 15 (.NET 11) code correctly. Covers every C# 15 feature - collection expression arguments (`[with(...), ...]`), union types (`union`, `[Union]`, `IUnion`, custom unions), closed class hierarchies (`closed`), extension indexers, labeled `break`\u002F`continue`, non-virtual static interface members on runtimes without default interface methods, and the preview memory-safety model (`unsafe(expr)`, `safe`, requires-unsafe members). Use when code targets net11.0 or LangVersion 15\u002Fpreview, when the user mentions any of these features, when replacing marker interfaces, OneOf-style results, `goto`\u002Fflag loop exits or capacity\u002Fcomparer boilerplate, or when the build reports CS8121, CS8509, CS8655, CS8510, CS0121\u002FCS0411 on a `with(...)` element, CS9370, CS9380 or CS9363.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-dotnet-general\u002Fcsharp-15\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M79YGAV031473HSX6FN87ENH","verified-waves","Run one task as verified multi-agent waves. Plans the fan-out, sends findings to fresh skeptics, keeps a ledger, and reports N of M done; small tasks stay solo.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-coordination\u002Fverified-waves\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M79YG6QXNND4WRPP3GATSY8J","harness","The bundled dispatch harness, which runs a task file on worker models through OpenCode or Codex, fences their writes, escalates their asks to the operator, settles each result from git and its verify commands, and records every step in a ledger. Its commands, task file, modes and write fence, configuration, runs and their recovery, ledger and exit codes.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-coordination\u002Fharness\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M79YG2P5S91SDTA5912XJ4FV","delegating-to-worker-models","Use when you hand off implementation, a plan, research a decision will rely on, or a review, and you brief the worker and check what comes back. A subagent that searches, reads in parallel, or keeps your context small is ordinary tool use. Covers what stays with you, the mechanism, assigning work by strength, the walls preflight, prompts without contradictions, the worker contract and model profiles, evidence from your own run, review, and the fix-up loop.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-coordination\u002Fdelegating-to-worker-models\u002FSKILL.md",[],[]]