Postpartum-genushyacinthus29/dotnet-skills/skills/dotnet-orleans/SKILL.md
dotnet-orleans
Build or review distributed .NET applications with Orleans grains, silos, persistence, streaming, reminders, placement, transactions, serialization, event sourcing, testing, and cloud-native hosting.
- Source repository stars
- 9
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-08-23
- Source checked
- 2026-08-25
Decision brief
What it does: where it fits
Build or review distributed . NET applications with Orleans grains, silos, persistence, streaming, reminders, placement, transactions, serialization, event sourcing, testing, and cloud-native hosting.
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/Postpartum-genushyacinthus29/dotnet-skills --skill "skills/dotnet-orleans"Inspect the Agent Skill "dotnet-orleans" from https://github.com/Postpartum-genushyacinthus29/dotnet-skills/blob/f9c1a213bc25d95641adc3a59f8048cb5656741c/skills/dotnet-orleans/SKILL.md at commit f9c1a213bc25d95641adc3a59f8048cb5656741c. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Workflow
1. Decide whether Orleans fits. Use it when the system has many loosely coupled interactive entities that can each stay small and single-threaded. Do not force Orleans onto shared-memory workloads, long batch jobs, or systems dominated by constant global coordination.
Decide whether Orleans fits. Use it when the system has many loosely coupled interactive entities that can each stay small and single-threaded. Do not force Orleans onto shared-memory workloads, long batch jobs, or syst…Model grain boundaries around business identity. Prefer one grain per user, cart, device, room, order, or other durable entity. Never create unique grains per request — use [StatelessWorker] for stateless fan-out. Grain…IGrainWithGuidKey — globally unique entities - 02
Trigger On
building or reviewing .NET code that uses Microsoft.Orleans., Grain, IGrainWith, UseOrleans, UseOrleansClient, IGrainFactory, JournaledGrain, ITransactionalState, or Orleans silo/client builders
building or reviewing .NET code that uses Microsoft.Orleans., Grain, IGrainWith, UseOrleans, UseOrleansClient, IGrainFactory, JournaledGrain, ITransactionalState, or Orleans silo/client builderstesting Orleans code with InProcessTestCluster, Aspire.Hosting.Testing, WebApplicationFactory, or shared AppHost fixturesmodeling high-cardinality stateful entities such as users, carts, devices, rooms, orders, digital twins, sessions, or collaborative documents - 03
Architecture
Review the “Architecture” section in the pinned source before continuing.
Review and apply the “Architecture” source section. - 04
Deliver
a justified Orleans fit, or a clear rejection when the problem should stay as plain .NET code
a justified Orleans fit, or a clear rejection when the problem should stay as plain .NET codegrain boundaries, grain identities, and activation behavior aligned to the domain modelconcrete choices for clustering, persistence, reminders, streams, placement, transactions, and hosting topology - 05
Validate
Orleans is being used for many loosely coupled entities, not as a generic distributed hammer
Orleans is being used for many loosely coupled entities, not as a generic distributed hammergrain interfaces are coarse enough to avoid chatty cross-grain trafficno grain code blocks threads or mixes sync-over-async with runtime calls
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 93/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 9 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- Postpartum-genushyacinthus29/dotnet-skills
- Skill path
- skills/dotnet-orleans/SKILL.md
- Commit
- f9c1a213bc25d95641adc3a59f8048cb5656741c
- License
- MIT
- Collected
- 2026-08-25
- Default branch
- main
View the original SKILL.md
Microsoft Orleans
Trigger On
- building or reviewing
.NETcode that usesMicrosoft.Orleans.*,Grain,IGrainWith*,UseOrleans,UseOrleansClient,IGrainFactory,JournaledGrain,ITransactionalState, or Orleans silo/client builders - testing Orleans code with
InProcessTestCluster,Aspire.Hosting.Testing,WebApplicationFactory, or shared AppHost fixtures - modeling high-cardinality stateful entities such as users, carts, devices, rooms, orders, digital twins, sessions, or collaborative documents
- choosing between grains, streams, broadcast channels, reminders, stateless workers, persistence providers, placement strategies, transactions, event sourcing, and external client/frontend topologies
- deploying or operating Orleans with Redis, Azure Storage, Cosmos DB, ADO.NET, .NET Aspire, Kubernetes, Azure Container Apps, or built-in/dashboard observability
- designing grain serialization contracts, versioning grain interfaces, configuring custom placement, or implementing grain call filters and interceptors
Workflow
-
Decide whether Orleans fits. Use it when the system has many loosely coupled interactive entities that can each stay small and single-threaded. Do not force Orleans onto shared-memory workloads, long batch jobs, or systems dominated by constant global coordination.
-
Model grain boundaries around business identity. Prefer one grain per user, cart, device, room, order, or other durable entity. Never create unique grains per request — use
[StatelessWorker]for stateless fan-out. Grain identity types:IGrainWithGuidKey— globally unique entitiesIGrainWithIntegerKey— relational DB integrationIGrainWithStringKey— flexible string keysIGrainWithGuidCompoundKey/IGrainWithIntegerCompoundKey— composite identity with extension string
-
Design coarse-grained async APIs. All grain interface methods must return
Task,Task<T>, orValueTask<T>. UseIAsyncEnumerable<T>for streaming responses. Avoid.Result,.Wait(), blocking I/O, lock-based coordination. UseTask.WhenAllfor parallel cross-grain calls. Apply[ResponseTimeout("00:00:05")]on interface methods when needed. -
Choose the right state pattern:
IPersistentState<TState>with[PersistentState("name", "provider")]for named persistent state (preferred)- Multiple named states per grain for different storage providers
JournaledGrain<TState, TEvent>for event-sourced grainsITransactionalState<TState>for ACID transactions across grainsGrain<TState>is legacy — use only when constrained by existing code
-
Pick the right runtime primitive deliberately:
- Standard grains for stateful request/response logic
[StatelessWorker]for pure stateless fan-out or compute helpers- Orleans streams for decoupled event flow and pub/sub with
[ImplicitStreamSubscription] - Broadcast channels for fire-and-forget fan-out with
[ImplicitChannelSubscription] RegisterGrainTimerfor activation-local periodic work (non-durable)- Reminders via
IRemindablefor durable low-frequency wakeups - Observers via
IGrainObserverandObserverManager<T>for one-way push notifications
-
Configure serialization correctly:
[GenerateSerializer]on all state and message types[Id(N)]on each serialized member for stable identification[Alias("name")]for safe type renaming[Immutable]to skip copy overhead on immutable types- Use surrogates (
IConverter<TOriginal, TSurrogate>) for types you don't own
-
Handle reentrancy and scheduling deliberately:
- Default is non-reentrant single-threaded execution (safe but deadlock-prone with circular calls)
[Reentrant]on grain class for full interleaving[AlwaysInterleave]on interface method for specific method interleaving[ReadOnly]for concurrent read-only methodsRequestContext.AllowCallChainReentrancy()for scoped reentrancy- Native
CancellationTokensupport (last parameter, optional default)
-
Choose hosting intentionally.
UseOrleansfor silos,UseOrleansClientfor separate clients- Co-hosted client runs in same process (reduced latency, no extra serialization)
- In Aspire, declare Orleans resource in AppHost, wire clustering/storage/reminders there, use
.AsClient()for frontend-only consumers - In Aspire-backed tests, resolve Orleans backing-resource connection strings from the distributed app and feed them into the test host instead of duplicating local settings
- Prefer
TokenCredentialwithDefaultAzureCredentialfor Azure-backed providers
-
Configure providers with production realism.
- In-memory storage, reminders, and stream providers are dev/test only
- Persistence: Redis, Azure Table/Blob, Cosmos DB, ADO.NET, DynamoDB
- Reminders: Azure Table, Redis, Cosmos DB, ADO.NET
- Clustering: Azure Table, Redis, Cosmos DB, ADO.NET, Consul, Kubernetes
- Streams: Azure Event Hubs, Azure Queue, Memory (dev only)
-
Treat placement as an optimization tool, not a default to cargo-cult.
ResourceOptimizedPlacementis default since 9.2 (CPU, memory, activation count weighted)RandomPlacement,PreferLocalPlacement,HashBasedPlacement,ActivationCountBasedPlacementSiloRoleBasedPlacementfor role-targeted placement- Custom placement via
IPlacementDirector+PlacementStrategy+PlacementAttribute - Placement filtering (9.0+) for zone-aware and hardware-affinity placement
- Activation repartitioning and rebalancing are experimental
-
Make the cluster observable.
- Standard
Microsoft.Extensions.Logging System.Diagnostics.Metricswith meter"Microsoft.Orleans"- OpenTelemetry export via
AddOtlpExporter+AddMeter("Microsoft.Orleans") - Distributed tracing via
AddActivityPropagation()with sources"Microsoft.Orleans.Runtime"and"Microsoft.Orleans.Application" - Orleans Dashboard for operational visibility (secure with ASP.NET Core auth)
- Health checks for cluster readiness
- Standard
-
Test the cluster behavior you actually depend on.
InProcessTestClusterfor new tests- Shared Aspire/AppHost fixtures for real HTTP, SignalR, SSE, or UI flows that must exercise the co-hosted Orleans topology
WebApplicationFactory<TEntryPoint>layered over a shared AppHost when tests need Host DI services,IGrainFactory, or direct grain/runtime access while keeping real infrastructure- Multi-silo coverage when placement, reminders, persistence, or failover matters
- Benchmark hot grains before claiming the design scales
- Use memory providers in test, real providers in integration tests
Architecture
flowchart LR
A["Distributed requirement"] --> B{"Many independent<br/>interactive entities?"}
B -->|No| C["Plain service / worker / ASP.NET Core"]
B -->|Yes| D["Model one grain per business identity"]
D --> E{"State pattern?"}
E -->|"Persistent"| F["IPersistentState<T>"]
E -->|"Event-sourced"| F2["JournaledGrain<S,E>"]
E -->|"Transactional"| F3["ITransactionalState<T>"]
E -->|"In-memory only"| G["Activation state"]
D --> H{"Communication?"}
H -->|"Pub/sub"| I["Orleans streams"]
H -->|"Broadcast"| I2["Broadcast channels"]
H -->|"Push to client"| I3["Observers"]
H -->|"Request/response"| I4["Direct grain calls"]
D --> J{"Periodic work?"}
J -->|"Activation-local"| K["RegisterGrainTimer"]
J -->|"Durable wakeups"| L["Reminders"]
D --> M{"Client topology?"}
M -->|"Separate process"| N["UseOrleansClient / .AsClient()"]
M -->|"Same process"| O["Co-hosted silo+client"]
F & F2 & F3 & G & I & I2 & I3 & I4 & K & L & N & O --> P["Serialization → Placement → Observability → Testing → Deploy"]
Deliver
- a justified Orleans fit, or a clear rejection when the problem should stay as plain
.NETcode - grain boundaries, grain identities, and activation behavior aligned to the domain model
- concrete choices for clustering, persistence, reminders, streams, placement, transactions, and hosting topology
- serialization contracts with
[GenerateSerializer],[Id], versioning via[Alias], and immutability annotations - an async-safe grain API surface with bounded state, proper reentrancy, and reduced hot-spot risk
- an explicit testing and observability plan for local development and production
- a test-harness choice that matches the assertion level: runtime-only, API/SignalR/UI, or direct Host DI/grain access
Validate
- Orleans is being used for many loosely coupled entities, not as a generic distributed hammer
- grain interfaces are coarse enough to avoid chatty cross-grain traffic
- no grain code blocks threads or mixes sync-over-async with runtime calls
- state is bounded, version-tolerant, and persisted only through intentional provider-backed writes
- all state and message types use
[GenerateSerializer]and[Id(N)]correctly - timers are not used where durable reminders are required; reminders are not used for high-frequency ticks
- in-memory storage, reminders, and stream providers are confined to dev/test usage
- Aspire projects register required keyed backing resources before
UseOrleans()orUseOrleansClient() - reentrancy is handled deliberately — circular call patterns use
[Reentrant],[AlwaysInterleave], orAllowCallChainReentrancy - transactional grains are marked
[Reentrant]and usePerformRead/PerformUpdate - hot grains, global coordinators, and affinity-heavy grains are measured and justified
- tests cover multi-silo behavior, persistence, and failover-sensitive logic when those behaviors matter
- Aspire-backed tests reuse one shared AppHost fixture and do not boot the distributed topology inside individual tests
- co-hosted Host tests do not start a redundant Orleans client unless external-client behavior is the thing under test
- Host or API test factories resolve connection strings from the AppHost resource graph instead of copied local config
- deployment uses production clustering, real providers, and proper GC configuration
Load References
Open only what you need. Each reference is topic-focused for token economy:
- references/official-docs-index.md — full Orleans documentation map with direct links to the official Learn tree
- references/grains.md — grain modeling, persistence, event sourcing, reminders, transactions, versioning links
- references/grain-api.md — grain identity, placement, lifecycle, reentrancy, cancellation API details with code
- references/persistence-api.md — IPersistentState API, provider configuration, event sourcing, transactions with code
- references/streaming-api.md — streams, broadcast channels, observers, IAsyncEnumerable patterns with code
- references/serialization-api.md — GenerateSerializer, Id, Alias, surrogates, copier, immutability details
- references/hosting.md — clients, Aspire, configuration, observability, dashboard, deployment links
- references/configuration-api.md — silo/client config, GC tuning, deployment targets, observability setup with code
- references/implementation.md — runtime internals, testing, load balancing, messaging guarantees
- references/testing-patterns.md — practical Orleans test harness selection with
InProcessTestCluster, shared AppHost fixtures,WebApplicationFactory, SignalR, and Playwright - references/patterns.md — grain, persistence, streaming, coordination, and performance patterns with code
- references/anti-patterns.md — blocking calls, unbounded state, chatty grains, bottlenecks, deadlocks with code
- references/examples.md — quickstarts, samples browser entries, and official Orleans example hubs
Official sources:
Frequently asked questions
What to verify before installation and use
What does the dotnet-orleans source document cover?
Build or review distributed . NET applications with Orleans grains, silos, persistence, streaming, reminders, placement, transactions, serialization, event sourcing, testing, and cloud-native hosting.
How do I install dotnet-orleans?
The source record exposes this install command: npx skills add https://github.com/Postpartum-genushyacinthus29/dotnet-skills --skill "skills/dotnet-orleans". Inspect the command and pinned source before running it.
Alternatives
Compare before choosing
vasilyu1983/AI-Agents-public
qa-testing-ios
Guides iOS testing with XCTest, XCUITest, Swift Testing, simctl, and xcresult. Use when choosing destinations, controlling flakes, or parsing test artifacts for native apps.
steipete/agent-scripts
one-password
REQUIRED before ANY `op` command or whenever a task needs an API key, token, password, credential, or secret (OPENAI_API_KEY, ANTHROPIC_API_KEY, deploy tokens, live-test keys). Prompt-free 1Password service-account reads; wrong invocations spam macOS dialogs.
microsoft/Sico
android-tester
Execute Android UI workflows on a sandbox device, review results, and produce a structured execution report.
mission69b/t2000
sui-publish
Publishing, upgrading, and deploying Sui Move packages. Use this skill when the user needs to publish a package, upgrade a published package, deploy to multiple networks, serialize transactions for multisig signing, run a local Sui network (localnet), prepare for Mainnet launch, monitor production deployments, or debug dry run failures. Also use when the user asks about sui client publish, sui client upgrade, UpgradeCap, upgrade policies, Published.toml, --serialize-output, localnet, mainnet lau