What this prompt does
This prompt builds gRPC services for a [service_purpose] in [dotnet_version], covering the full contract-to-client path. It asks for a [proto_file_name].proto with [method_count] methods across unary and streaming styles, message types for [message_types], a server implementation with [business_logic], correct status-code error handling, interceptors for [interceptor_purposes], server streaming for [streaming_scenario], a typed client with [client_config], health checks, and HTTP/2 tuning for [performance_target].
The variables anchor the answer to a real service. [message_types] and [business_logic] define the proto contract and what the methods actually do, while [interceptor_purposes] and [client_config] shape cross-cutting concerns like logging, JWT validation, deadlines, and retries. [performance_target] pushes the model to address HTTP/2 settings, connection pooling, and compression rather than leaving performance vague. Because the prompt covers both the proto contract and the generated client, you avoid the common trap of a beautifully designed service that no one can call cleanly: deadline propagation and retry policy on the client side are treated as first-class, not afterthoughts.
When to use it
- Services need high-throughput, low-latency communication and HTTP/JSON is the bottleneck
- Designing a proto contract with both unary and streaming methods
- You want correct gRPC status-code mapping from domain exceptions, not generic Unknown errors
- Adding interceptors for
[interceptor_purposes]like correlation IDs and auth - Implementing server streaming for
[streaming_scenario]with cancellation handling - Preparing gRPC health checks for Kubernetes readiness probes
Example output
You get a proto file defining the [message_types] and service, generated-then-implemented C# service classes with async methods and CancellationToken support, an exception-to-status-code mapping, interceptor classes, a server streaming method, a typed client configured per [client_config], a health check registration, and HTTP/2 performance settings. It is organized as proto plus server plus client plus ops, each with explanation.
Pro tips
- Make
[message_types]reflect your real domain; vague names like Request and Response produce a proto you will rewrite immediately - Be explicit in
[business_logic]so the server methods do something concrete rather than returning placeholders - Spell out
[performance_target](for example a p99 latency under load) so the model justifies the HTTP/2 and compression choices instead of guessing - Set realistic deadlines in
[client_config]— a missing deadline is the classic cause of gRPC calls hanging forever - Map domain exceptions to specific status codes (NotFound, InvalidArgument, PermissionDenied); returning Unknown for everything makes clients unable to react
- Don't skip the health-check step if you deploy to Kubernetes — readiness probes need the gRPC health protocol to route traffic correctly
- Keep
[interceptor_purposes]focused on cross-cutting concerns like logging, auth, and metrics; business rules belong in the service method, not an interceptor - For
[streaming_scenario], make sure cancellation is honored — a client that disconnects mid-stream should stop server work promptly, or you leak resources under load