Grpc

From managedcode/dotnet-skills · View interactive version

Grpc is an AI agent skill from the GitHub repository managedcode/dotnet-skills. Build or review gRPC services and clients in .NET. USE FOR: ASP.NET Core gRPC, protobuf contracts, unary or streaming RPC, gRPC client factory, interceptors, deadlines, cancellation, channel reuse, backend service integration. DO NOT USE FOR: broad browser-facing APIs without gRPC-Web tradeoff revie

How to use this skill

Skill file

gRPC for .NET

Trigger On

Do Not Use For

Load References

Workflow

  1. Validate the architecture fit before touching code.
  1. Treat .proto files as the source of truth.
  1. Choose the RPC shape from the interaction model.
  1. Wire server and client behavior together.
  1. Add observability and resilience where the boundary justifies it.
  1. Validate with the repo's normal build and tests, plus a focused smoke call when runnable.

Current Upstream Notes

flowchart LR
  A["RPC requirement"] --> B["proto contract"]
  B --> C["server implementation"]
  B --> D["client factory or channel"]
  C --> E["deadlines / cancellation / status codes"]
  D --> E
  E --> F["build, tests, smoke call"]

Examples

Use client factory for normal app integration:

builder.Services.AddGrpcClient<Greeter.GreeterClient>(options =>
{
    options.Address = new Uri("https://localhost:5001");
});

Always set a deadline and pass cancellation:

var response = await client.SayHelloAsync(
    new HelloRequest { Name = name },
    deadline: DateTime.UtcNow.AddSeconds(5),
    cancellationToken: cancellationToken);

For streaming, check cancellation inside the read/write loop and keep message sizes bounded. Load references/patterns.md before writing detailed streaming code.

Anti-Patterns

Deliver

Validate

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.