Skip to main content
ClaudeWave
Skill429 repo starsupdated 9d ago

managedcode-orleans-graph

The managedcode-orleans-graph skill provides guidance for integrating ManagedCode.Orleans.Graph into Orleans-based .NET applications to model graph-oriented relationships, manage edges, and implement traversal logic across Orleans grains. Use this skill when designing distributed graph systems where nodes map to grain identities and edges represent inter-grain relationships, or when evaluating whether a graph abstraction better fits your Orleans architecture than relational or hierarchical patterns.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/managedcode/dotnet-skills /tmp/managedcode-orleans-graph && cp -r /tmp/managedcode-orleans-graph/catalog/Libraries/ManagedCode-Orleans-Graph/skills/managedcode-orleans-graph ~/.claude/skills/managedcode-orleans-graph
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# ManagedCode.Orleans.Graph

## Trigger On

- integrating `ManagedCode.Orleans.Graph` into an Orleans-based system
- modeling graph relationships, edges, or traversal behavior with Orleans grains
- reviewing graph-oriented distributed workflows on top of Orleans
- deciding whether a graph abstraction is the right fit vs relational modeling

## Workflow

1. **Install the library:**
   ```bash
   dotnet add package ManagedCode.Orleans.Graph
   ```
2. **Confirm the application has a real graph problem** — node-to-node relationships, directed/undirected edges, or traversal queries. If the data is tabular or hierarchical, prefer standard Orleans grain patterns instead.
3. **Model graph entities as grains:**
   - nodes map to grain identities
   - edges represent relationships between grains
   - traversal operations query across grain boundaries
4. **Implement graph operations:**
   ```csharp
   // Define a graph grain interface
   public interface IGraphGrain : IGrainWithStringKey
   {
       Task AddEdge(string targetId, string edgeType);
       Task<IReadOnlyList<string>> GetNeighbors(string edgeType);
       Task<bool> HasEdge(string targetId, string edgeType);
       Task RemoveEdge(string targetId, string edgeType);
   }
   ```
5. **Keep Orleans runtime concerns explicit:**
   - grain identity determines the node identity
   - persistence provider stores edge state
   - grain activation lifecycle affects traversal latency
6. **Add traversal logic for multi-hop queries:**
   ```csharp
   // Breadth-first traversal across grains
   public async Task<IReadOnlyList<string>> TraverseAsync(
       IGrainFactory grainFactory, string startId, string edgeType, int maxDepth)
   {
       var visited = new HashSet<string>();
       var queue = new Queue<(string Id, int Depth)>();
       queue.Enqueue((startId, 0));

       while (queue.Count > 0)
       {
           var (currentId, depth) = queue.Dequeue();
           if (!visited.Add(currentId) || depth >= maxDepth) continue;

           var grain = grainFactory.GetGrain<IGraphGrain>(currentId);
           var neighbors = await grain.GetNeighbors(edgeType);
           foreach (var neighbor in neighbors)
               queue.Enqueue((neighbor, depth + 1));
       }
       return visited.ToList();
   }
   ```
7. **Validate** that traversal and relationship operations work against real Orleans clusters, not only unit tests with mock grain factories.

```mermaid
flowchart LR
  A["Graph request"] --> B["Resolve node grain"]
  B --> C["Query edges from grain state"]
  C --> D{"Traversal needed?"}
  D -->|Yes| E["Multi-hop grain calls"]
  D -->|No| F["Return direct neighbors"]
  E --> G["Aggregate results"]
  F --> G
```

## Deliver

- concrete guidance on when Orleans.Graph is the right abstraction vs standard grain patterns
- graph grain interface patterns with edge management
- traversal implementation that respects Orleans distributed execution
- verification expectations for real graph flows

## Validate

- the application has a genuine graph problem, not a generic relational one
- graph integration does not blur grain identity and traversal concerns
- edge persistence is configured for the correct Orleans storage provider
- traversal operations are tested against a real Orleans cluster, not only mocks
- multi-hop queries have bounded depth to prevent runaway grain activations
aspnet-coreSkill

Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging, and deployment patterns on current .NET. USE FOR: working on ASP.NET Core apps, services, or middleware; changing auth, routing, configuration, hosting, or deployment behavior; deciding between ASP.NET Core sub-stacks. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

aspireSkill

Build, upgrade, and operate .NET Aspire 13.3.x application hosts with current CLI, AppHost, ServiceDefaults, integrations, dashboard, testing, and Azure deployment patterns for distributed apps. USE FOR: Aspire.AppHost.Sdk, Aspire.Hosting.*, DistributedApplication.CreateBuilder, WithReference, WaitFor, AddProject, AddRedis, AddPostgres, aspire run, aspire init, aspire. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

azure-functionsSkill

Build, review, or migrate Azure Functions in .NET with correct execution model, isolated worker setup, bindings, DI, and Durable Functions patterns. USE FOR: working on Azure Functions in .NET; migrating from the in-process model to the isolated worker model; adding Durable Functions, bindings, or host configuration. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

blazorSkill

Build and review Blazor applications across server, WebAssembly, web app, and hybrid scenarios with correct component design, state flow, rendering, and hosting choices. USE FOR: building interactive web UIs with C# instead of JavaScript; choosing between Server, WebAssembly, or Auto render modes; designing component hierarchies and state. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

entity-framework6Skill

Maintain or migrate EF6-based applications with realistic guidance on what to keep, what to modernize, and when EF Core is or is not the right next step. USE FOR: EF6 codebases; runtime versus ORM migration decisions; EDMX, code-first, ObjectContext, and legacy data-access review. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

entity-framework-coreSkill

Design, tune, or review EF Core data access with proper modeling, migrations, query translation, performance, and lifetime management for modern .NET applications. USE FOR: DbContext, migrations, model configuration, EF queries, tracking, loading, performance, transactions, and EF6 migration decisions. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

mauiSkill

Build, review, or migrate .NET MAUI applications across Android, iOS, macOS, and Windows with correct cross-platform UI, platform integration, and native packaging assumptions. USE FOR: working on cross-platform mobile or desktop UI in .NET MAUI; integrating device capabilities, navigation, or platform-specific code; migrating Xamarin.Forms or aligning. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

mlnetSkill

Use ML.NET to train, evaluate, or integrate machine-learning models into .NET applications with realistic data preparation, inference, and deployment expectations. USE FOR: ML.NET integration; local model training or retraining; inference pipelines, model loading, evaluation, and deployment review. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.