service-definition

Design gRPC service contracts and C# implementations for .NET microservices.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill service-definition
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: service-definition
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/microservice/grpc/service-definition
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill service-definition

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent or incorrect gRPC proto files and service implementations that leak business logic, use improper proto types for nullability and timestamps, and lack consistent mapping to domain models are common sources of bugs and runtime errors in .NET microservices.

Core Features & Use Cases

  • Proto-first service contracts: Guidance for structuring command and query proto files with clear naming and package conventions.
  • Clean service implementations: Patterns for inheriting generated Base classes and delegating work to MediatR handlers.
  • Mapping & types: Best practices for mapping extensions, using google.protobuf wrappers for nullable fields and timestamp handling for DateTime.
  • Registration & runtime: Instructions for registering GRPC services, interceptors, and pagination message patterns.
  • Use Case: Create OrderCommands and OrderQueries proto files, generate C# stubs, add mapping extensions, and register services so the application delegates business logic to MediatR handlers.

Quick Start

Generate proto templates and C# gRPC service stubs for an Order domain with MediatR-based handlers.

Frequently Asked Questions about service-definition

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design gRPC proto files for .NET microservices?

Design gRPC proto files for .NET microservices by structuring command and query contracts with clear package conventions, enforcing proper proto naming rules, and defining messages that map cleanly to domain models. This prevents inconsistent service contracts and runtime serialization errors.

How do I handle nullable fields and timestamps in protobuf?

Handle nullable fields and timestamps in protobuf by using google.protobuf wrappers for nullability and the Timestamp type for DateTime values. This ensures accurate runtime serialization and prevents mapping errors in C# microservices.

Can I use MediatR handlers with gRPC service implementations in C#?

Yes, you can use MediatR handlers with gRPC service implementations by inheriting generated C# Base classes and delegating incoming requests to MediatR commands and queries. This keeps business logic out of the service layer entirely.

What is the best way to register gRPC services in a .NET application?

The best way to register gRPC services in a .NET application is using the MapGrpcService registration pattern. This correctly wires up generated service stubs, interceptors, and pagination messages for accurate runtime execution.

Does this gRPC service definition approach support pagination patterns?

Yes, this gRPC service definition approach supports pagination patterns by providing specific message structures and mapping extensions. These patterns ensure efficient data retrieval over gRPC contracts without leaking business logic.