dotnet-grpc
Installation
SKILL.md
.NET gRPC
gRPC is a contract-first RPC system: you declare services and messages in a .proto, code is generated from it on both ends, and calls travel as Protobuf over HTTP/2. Reach for it when the producer and consumer are both yours and you want a typed contract, low overhead, and streaming - internal service-to-service traffic above all. Stay on REST when the surface is a public or browser-facing API where ubiquity and human-readable bodies matter more; those endpoints are dotnet-minimal-api. This skill covers gRPC and nothing else. Baseline is .NET 8 / C# 12.
The .proto is the single source of truth
The contract lives in the .proto, not in C#. Define every service and message there and let codegen produce the C# types; treat the generated *.cs as build output you never open or edit.
- Generate with
Grpc.Tools(a build-time, dev-only package). Reference each proto in the csproj and pick the side that project needs:
Use<ItemGroup> <Protobuf Include="Protos\orders.proto" GrpcServices="Server" /> </ItemGroup>GrpcServices="Client"in a consumer,"Both"only when a project is both. The server generates an abstract base to override; the client generates a strongly typed stub. - Share the contract by sharing the
.proto, not the compiled assembly: keep protos in one folder (or a dedicated contracts project / package) that both sides reference, so server and client always regenerate from the same file.