backend-grpc-patterns
Use when the user asks about gRPC, protobuf messages and a gRPC service, unary or streaming RPCs, deadlines, interceptors, gRPC status codes or proto…
от j4flmao★ 47 звёзд на GitHub
Установить backend-grpc-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Backend gRPC Patterns
Purpose
Design consistent, production-grade gRPC services. Every RPC must follow the same conventions for protobuf schemas, streaming patterns, interceptors, error handling, and service versioning.
Agent Protocol
Trigger
Exact user phrases: "gRPC", "protobuf", "protocol buffers", "streaming RPC", "unary call", "server streaming", "client streaming", "bidirectional streaming", "gRPC interceptor", "gRPC error handling", "protobuf schema", "service definition", "design an RPC", "gRPC contract".
Input Context
Before activating, verify:
- The service or feature being designed is known.
- The proto package name and version are known.
- The streaming model (unary/server-stream/client-stream/bidi) is chosen. If not, ask: "What streaming model do you need?"
- The language/runtime for code generation is known.
Output Artifact
No file output unless the user requests it. Produces protobuf schema and RPC specifications as text.
Response Format
For each RPC:
rpc {MethodName}({RequestType}) returns ({ResponseType})
Streaming: {none/server/client/bidirectional}
Auth: {required/optional/none}
Deadline: {timeout suggestion}
Errors: {list of gRPC status codes}
For a full service definition:
service {ServiceName} {
{list of RPCs}
}
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.
Completion Criteria
- All protobuf packages follow the naming conventions below.
- Every RPC has: method signature, streaming type, auth requirement, deadline, error codes.
- Protobuf messages are versioned in the package name.
- Error responses use standard gRPC status codes with rich detail.
- All streaming RPCs include proper backpressure handling.
- Interceptor chain is documented.
Max Response Length
Per RPC: 6 lines. Per service: unlimited.
Decision Tree
Which RPC Pattern?
What is the communication pattern?
├── Request → Response (standard CRUD)
│ └── Unary RPC — simplest, HTTP/2 under the hood
├── Request → stream of events (subscribe, watch, notifications)
│ └── Server-streaming RPC — send multiple responses for one request
├── Stream of requests → single response (batch upload, long-form input)
│ └── Client-streaming RPC — aggregate client data into one result
├── Stream → stream (chat, real-time sync, gaming)
│ └── Bidirectional streaming — full-duplex communication
└── Fire-and-forget (event, notification, pub/sub)
└── Consider message queue instead — gRPC streaming is for persistent connections
When to Use gRPC vs REST vs Message Queue?
gRPC: Internal service-to-service, low latency, high throughput
Streaming, real-time, bidirectional
Polyglot environments (codegen for many languages)
REST: External/public APIs (browsers, mobile, third-party)
Simple CRUD, cacheable resources
When HTTP semantics matter (caching, content negotiation)
Message Queue: Async communication, event-driven, fire-and-forget
When services must be decoupled in time
When you need guaranteed delivery, retries, DLQ
Workflow
Step 1: Choose Streaming Model
Unary: request → response (standard CRUD)
Server-streaming: request → stream<response> (list, watch, subscribe)
Client-streaming: stream<request> → response (batch upload, long-form input)
Bidirectional: stream<request> → stream<response> (chat, real-time sync, gaming)
Step 2: Define Protobuf Package and Version
syntax = "proto3";
package acme.users.v1;
option go_package = "github.com/acme/gen/go/users/v1;usersv1";
option java_package = "com.acme.users.v1";
Step 3: Define Messages
Use proto3. Follow these rules:
messagenames are PascalCase:CreateUserRequest,UserResponse.- Field names are snake_case:
user_id,created_at. - Field numbers are dense starting at 1. Never reuse a field number.
- Use
google.protobuf.Timestampfor time, not int64 or string. - Use
google.protobuf.FieldMaskfor partial updates. - Use
google.protobuf.Emptyfor void responses. oneoffor mutually exclusive fields.mapfor key-value pairs (never for large datasets).
message CreateUserRequest {
string name = 1;
string email = 2;
google.protobuf.Timestamp birth_date = 3;
oneof contact_preference {
string phone = 4;
string telegram = 5;
}
}
Step 4: Standard RPC Patterns
// CRUD service
service UserService {
rpc CreateUser(CreateUserRequest) returns (User);
rpc GetUser(GetUserRequest) returns (User);
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse);
rpc UpdateUser(UpdateUserRequest) returns (User);
rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty);
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/advanced_protobuf_schemas.md
- references/grpc-error-handling.md
- references/grpc-interceptors.md
- references/grpc-performance.md
- references/grpc-security.md
- references/grpc-streaming.md
- references/grpc-testing.md
- references/grpc-vs-rest.md
- references/grpc_interceptors.md
- references/protobuf-basics.md
FAQ
Что делает скилл backend-grpc-patterns?
Use when the user asks about gRPC, protobuf messages and a gRPC service, unary or streaming RPCs, deadlines, interceptors, gRPC status codes or proto evolution with reserved fields. Produces .proto definitions and server/client code. Not for REST design (use backend-api-design).
Как установить скилл backend-grpc-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл backend-grpc-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…