Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use ManagedCode.Communication when a .NET application needs explicit result objects, structured errors, and predictable service or API boundaries instead of exception-driven control flow. USE FOR: integrating ManagedCode.Communication into services or APIs; replacing exception-driven result handling with explicit results; reviewing service boundaries that return. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit
.claude/skills/managedcode-managedcode-communication/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 0% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -17% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 13% | 0% |
ManagedCode.Communication into services or APIsUse the package that matches the boundary. Current upstream release reviewed: v10.0.4.
bashdotnet add package ManagedCode.Communication dotnet add package ManagedCode.Communication.AspNetCore dotnet add package ManagedCode.Communication.Extensions dotnet add package ManagedCode.Communication.Orleans
For pinned project files:
xml<PackageReference Include="ManagedCode.Communication" Version="10.0.4" /> <PackageReference Include="ManagedCode.Communication.AspNetCore" Version="10.0.4" /> <PackageReference Include="ManagedCode.Communication.Extensions" Version="10.0.4" /> <PackageReference Include="ManagedCode.Communication.Orleans" Version="10.0.4" />
ConfigureCommunication() for ASP.NET Core logging and convertersWithCommunicationResults() for Minimal API endpoint or group conversionmermaidflowchart LR A["Domain or service operation"] --> B["ManagedCode.Communication result"] B --> C["Application or API boundary"] C --> D["HTTP response or caller-visible contract"]
csharppublic sealed class OrderService(IOrderRepository orders) { public async Task<Result<OrderDto>> GetAsync(Guid id, CancellationToken ct) { var order = await orders.FindAsync(id, ct); return order is null ? Result<OrderDto>.FailNotFound($"Order {id} was not found.") : Result<OrderDto>.Succeed(OrderDto.From(order)); } }
Use this shape when absence, validation, authorization, or domain rejection is an expected outcome. Reserve exceptions for unexpected infrastructure faults.
csharpvar builder = WebApplication.CreateBuilder(args); builder.Services.ConfigureCommunication(); var app = builder.Build(); app.MapGroup("/orders") .WithCommunicationResults() .MapPost(string.Empty, async (CreateOrder command, OrderService orders, CancellationToken ct) => await orders.CreateAsync(command, ct));
Handlers can return Result or Result<T> and let the extension package map failures to HTTP results and problem details at the API boundary.
csharppublic async Task<Result<OrderReceipt>> CreateAsync(CreateOrder command, CancellationToken ct) { var validation = Validate(command); if (validation.IsFailed) { return Result<OrderReceipt>.Fail(validation.Problem!); } return await Result<Order>.From(() => BuildOrder(command)) .ThenAsync(order => SaveAsync(order, ct)) .Then(order => Result<OrderReceipt>.Succeed(new OrderReceipt(order.Id, order.CreatedAt))); }
Use railway-style composition when each step can return a result and the caller should stop at the first real failure.
Result, Result<T>, CollectionResult<T>, and Problem are the core surfaces. Keep them at service/API boundaries rather than leaking framework-specific HTTP results into domain code.CollectionResult<T> plus PaginationRequest / PaginationOptions should own paged API metadata instead of ad-hoc (items, total) tuples.WithCommunicationResults() on one endpoint or an entire group. Prefer the group form only when every child endpoint follows the same result contract.ManagedCode.Communication.Orleans is for grain-call integration and serialization boundaries; use it with the Orleans skill when reviewing grain APIs.v10.0.4 release notes call out error-handling fixes and dependency maintenance. Re-test negative paths after upgrading.CollectionResult<T> is usedOther measured skills in the registry, with their headline benchmark lift.