
Grpc Service Development
- 478 installs
- 305 repo stars
- Updated March 4, 2026
- aj-geddes/useful-ai-prompts
grpc-service-development is a Claude Code skill that generates production-ready gRPC service definitions, Protocol Buffer schemas, and unary plus streaming server implementations for developers building high-performance
About
grpc-service-development is a skill from aj-geddes/useful-ai-prompts for building gRPC microservices with Protocol Buffers. It covers service contract design in .proto files and server implementations supporting unary RPC plus client streaming, server streaming, and bidirectional streaming patterns. Reference guides and best-practices sections walk through quick-start scaffolding and inter-service communication setups. Developers reach for this skill when replacing REST with gRPC, defining protobuf messages and services, or implementing streaming APIs between backend services. Output targets production-ready patterns rather than toy examples, emphasizing efficient binary serialization and strongly typed contracts across language stacks that support gRPC codegen.
- Generates full Protocol Buffer (.proto) service contracts with messages and RPCs
- Supports all four streaming patterns: unary, client, server, and bidirectional
- Produces ready-to-compile server and client stubs in multiple languages
- Includes microservice communication patterns and error handling
- Optimizes for high-performance, bandwidth-constrained, and polyglot environments
Grpc Service Development by the numbers
- 478 all-time installs (skills.sh)
- Ranked #864 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill grpc-service-developmentAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 478 |
|---|---|
| repo stars | ★ 305 |
| Last updated | March 4, 2026 |
| Repository | aj-geddes/useful-ai-prompts ↗ |
How do you build gRPC services with protobuf?
Generate complete, production-ready gRPC service definitions, Protocol Buffer schemas, and streaming implementations for microservices.
Who is it for?
Backend developers designing microservice contracts who need protobuf schemas plus unary and streaming gRPC server code.
Skip if: REST-only APIs, browser-facing GraphQL layers, or teams without protobuf/gRPC toolchain adoption.
When should I use this skill?
User asks to define gRPC services, write protobuf schemas, or implement client/server/bidi streaming between microservices.
What you get
.proto service schemas, gRPC server stubs, streaming RPC handler implementations
- .proto schema files
- gRPC server implementation
By the numbers
- Covers 4 gRPC call patterns: unary, client streaming, server streaming, and bidirectional streaming
Files
gRPC Service Development
Table of Contents
Overview
Develop efficient gRPC services using Protocol Buffers for service definition, with support for unary calls, client streaming, server streaming, and bidirectional streaming patterns.
When to Use
- Building microservices that require high performance
- Defining service contracts with Protocol Buffers
- Implementing real-time bidirectional communication
- Creating internal service-to-service APIs
- Optimizing bandwidth-constrained environments
- Building polyglot service architectures
Quick Start
Minimal working example:
syntax = "proto3";
package user.service;
message User {
string id = 1;
string email = 2;
string first_name = 3;
string last_name = 4;
string role = 5;
int64 created_at = 6;
int64 updated_at = 7;
}
message CreateUserRequest {
string email = 1;
string first_name = 2;
string last_name = 3;
string role = 4;
}
message UpdateUserRequest {
string id = 1;
string email = 2;
string first_name = 3;
// ... (see reference guides for full implementation)Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Protocol Buffer Service Definition | Protocol Buffer Service Definition |
| Node.js gRPC Server Implementation | Node.js gRPC Server Implementation |
| Python gRPC Server (grpcio) | Python gRPC Server (grpcio) |
| Client Implementation | Client Implementation |
Best Practices
✅ DO
- Use clear message and service naming
- Implement proper error handling with gRPC status codes
- Add metadata for logging and tracing
- Version your protobuf definitions
- Use streaming for large datasets
- Implement timeouts and deadlines
- Monitor gRPC metrics
❌ DON'T
- Use gRPC for browser-based clients (use gRPC-Web)
- Expose sensitive data in proto definitions
- Create deeply nested messages
- Ignore error status codes
- Send uncompressed large payloads
- Skip security with TLS in production
Client Implementation
Client Implementation
const grpc = require("@grpc/grpc-js");
const protoLoader = require("@grpc/proto-loader");
const path = require("path");
const packageDef = protoLoader.loadSync(path.join(__dirname, "user.proto"));
const userProto = grpc.loadPackageDefinition(packageDef).user.service;
const client = new userProto.UserService(
"localhost:50051",
grpc.credentials.createInsecure(),
);
// Unary call
client.getUser({ id: "123" }, (err, user) => {
if (err) console.error(err);
console.log("User:", user);
});
// Server streaming
const stream = client.streamUsers({});
stream.on("data", (user) => {
console.log("Received user:", user);
});
stream.on("end", () => {
console.log("Stream ended");
});
// Client streaming
const writeStream = client.bulkCreateUsers((err, response) => {
if (err) console.error(err);
console.log("Created users:", response.users.length);
});
writeStream.write({
email: "user1@example.com",
first_name: "John",
last_name: "Doe",
});
writeStream.write({
email: "user2@example.com",
first_name: "Jane",
last_name: "Smith",
});
writeStream.end();Node.js gRPC Server Implementation
Node.js gRPC Server Implementation
const grpc = require("@grpc/grpc-js");
const protoLoader = require("@grpc/proto-loader");
const path = require("path");
const packageDef = protoLoader.loadSync(path.join(__dirname, "user.proto"), {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
});
const userProto = grpc.loadPackageDefinition(packageDef).user.service;
const users = new Map();
let userIdCounter = 1;
const userServiceImpl = {
getUser: (call, callback) => {
const user = users.get(call.request.id);
if (!user) {
return callback({
code: grpc.status.NOT_FOUND,
details: "User not found",
});
}
callback(null, user);
},
listUsers: (call, callback) => {
const page = call.request.page || 1;
const limit = call.request.limit || 20;
const offset = (page - 1) * limit;
const userArray = Array.from(users.values());
const paginatedUsers = userArray.slice(offset, offset + limit);
callback(null, {
users: paginatedUsers,
total: userArray.length,
page: page,
});
},
createUser: (call, callback) => {
const id = String(userIdCounter++);
const user = {
id,
email: call.request.email,
first_name: call.request.first_name,
last_name: call.request.last_name,
role: call.request.role,
created_at: Date.now(),
updated_at: Date.now(),
};
users.set(id, user);
callback(null, user);
},
updateUser: (call, callback) => {
const user = users.get(call.request.id);
if (!user) {
return callback({
code: grpc.status.NOT_FOUND,
details: "User not found",
});
}
Object.assign(user, {
email: call.request.email || user.email,
first_name: call.request.first_name || user.first_name,
last_name: call.request.last_name || user.last_name,
updated_at: Date.now(),
});
callback(null, user);
},
deleteUser: (call, callback) => {
users.delete(call.request.id);
callback(null, {});
},
streamUsers: (call) => {
Array.from(users.values()).forEach((user) => {
call.write(user);
});
call.end();
},
bulkCreateUsers: (call, callback) => {
const createdUsers = [];
call.on("data", (request) => {
const id = String(userIdCounter++);
const user = {
id,
email: request.email,
first_name: request.first_name,
last_name: request.last_name,
role: request.role,
created_at: Date.now(),
updated_at: Date.now(),
};
users.set(id, user);
createdUsers.push(user);
});
call.on("end", () => {
callback(null, {
users: createdUsers,
total: createdUsers.length,
page: 1,
});
});
call.on("error", (err) => {
callback(err);
});
},
};
const server = new grpc.Server();
server.addService(userProto.UserService.service, userServiceImpl);
server.bindAsync(
"0.0.0.0:50051",
grpc.ServerCredentials.createInsecure(),
() => {
console.log("gRPC server running on port 50051");
server.start();
},
);Protocol Buffer Service Definition
Protocol Buffer Service Definition
syntax = "proto3";
package user.service;
message User {
string id = 1;
string email = 2;
string first_name = 3;
string last_name = 4;
string role = 5;
int64 created_at = 6;
int64 updated_at = 7;
}
message CreateUserRequest {
string email = 1;
string first_name = 2;
string last_name = 3;
string role = 4;
}
message UpdateUserRequest {
string id = 1;
string email = 2;
string first_name = 3;
string last_name = 4;
}
message GetUserRequest {
string id = 1;
}
message ListUsersRequest {
int32 page = 1;
int32 limit = 2;
}
message ListUsersResponse {
repeated User users = 1;
int32 total = 2;
int32 page = 3;
}
message DeleteUserRequest {
string id = 1;
}
message Empty {}
service UserService {
rpc GetUser(GetUserRequest) returns (User);
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse);
rpc CreateUser(CreateUserRequest) returns (User);
rpc UpdateUser(UpdateUserRequest) returns (User);
rpc DeleteUser(DeleteUserRequest) returns (Empty);
rpc StreamUsers(Empty) returns (stream User);
rpc BulkCreateUsers(stream CreateUserRequest) returns (ListUsersResponse);
}
message Event {
string type = 1;
string user_id = 2;
string data = 3;
int64 timestamp = 4;
}
service EventService {
rpc Subscribe(Empty) returns (stream Event);
rpc PublishEvent(Event) returns (Empty);
}Python gRPC Server (grpcio)
Python gRPC Server (grpcio)
import grpc
from concurrent import futures
import user_pb2
import user_pb2_grpc
from datetime import datetime
class UserServicer(user_pb2_grpc.UserServiceServicer):
def __init__(self):
self.users = {}
self.user_counter = 1
def GetUser(self, request, context):
if request.id not in self.users:
context.set_code(grpc.StatusCode.NOT_FOUND)
context.set_details('User not found')
return user_pb2.User()
return self.users[request.id]
def ListUsers(self, request, context):
users_list = list(self.users.values())
page = request.page or 1
limit = request.limit or 20
offset = (page - 1) * limit
return user_pb2.ListUsersResponse(
users=users_list[offset:offset + limit],
total=len(users_list),
page=page
)
def CreateUser(self, request, context):
user_id = str(self.user_counter)
self.user_counter += 1
user = user_pb2.User(
id=user_id,
email=request.email,
first_name=request.first_name,
last_name=request.last_name,
role=request.role,
created_at=int(datetime.now().timestamp()),
updated_at=int(datetime.now().timestamp())
)
self.users[user_id] = user
return user
def StreamUsers(self, request, context):
for user in self.users.values():
yield user
def BulkCreateUsers(self, request_iterator, context):
created_users = []
for request in request_iterator:
user = self.CreateUser(request, context)
created_users.append(user)
return user_pb2.ListUsersResponse(
users=created_users,
total=len(created_users),
page=1
)
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
user_pb2_grpc.add_UserServiceServicer_to_server(
UserServicer(), server
)
server.add_insecure_port('[::]:50051')
server.start()
print('gRPC server running on port 50051')
server.wait_for_termination()
if __name__ == '__main__':
serve()#!/bin/bash
# validate-api.sh - Validate API specification
# Usage: ./validate-api.sh <openapi_spec>
set -euo pipefail
SPEC_FILE="${{1:?Usage: $0 <openapi_spec>}}"
echo "Validating API spec: $SPEC_FILE"
# TODO: Add API validation
# - Validate OpenAPI/Swagger syntax
# - Check endpoint naming conventions
# - Verify response schemas
# - Check for required headers
# - Validate authentication definitions
echo "API validation complete."
# API Endpoint Scaffold
# TODO: Customize for your API framework
openapi: "3.0.3"
info:
title: "API Service"
version: "1.0.0"
paths:
/api/v1/resource:
get:
summary: "List resources"
# TODO: Define parameters and responses
responses:
"200":
description: "Success"
post:
summary: "Create resource"
# TODO: Define request body and responses
responses:
"201":
description: "Created"
Related skills
How it compares
Choose grpc-service-development for protobuf-first microservice RPC; use REST/OpenAPI skills for browser-facing HTTP APIs.
FAQ
Which RPC patterns does grpc-service-development cover?
grpc-service-development supports unary calls plus client streaming, server streaming, and bidirectional streaming, generating protobuf contracts and matching server handler scaffolding for each pattern.
What files does grpc-service-development produce?
grpc-service-development outputs Protocol Buffer .proto definitions with service and message types alongside gRPC server implementation guidance for microservice communication.