use-protobuf
Skill207 starsChanged 37 days agoApache-2.0View on GitHub
Design, change, and review Protobuf schemas used as gRPC contracts, streaming protocols, typed data models, grpc-gateway REST APIs, OpenAPI specifications, or generated SDK inputs. Use for .proto files, RPC request/response design, oneof stream events, validation annotations, API versioning, schema evolution, generated package layout, and avoiding weak Struct or Any payloads.
In this repository37 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/unsafe-checker/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/rust-rustrover-cargo.mdcCursor rule
- ast-grepSkill
- auv-wayland-renderingSkill
- create-prSkill
- domain-cliSkill
- domain-cloud-nativeSkill
- domain-mlSkill
- domain-webSkill
- m01-ownershipSkill
- m02-resourceSkill
- m03-mutabilitySkill
- m04-zero-costSkill
- m05-type-drivenSkill
- m06-error-handlingSkill
- m07-concurrencySkill
- m09-domainSkill
- m10-performanceSkill
- m11-ecosystemSkill
- m12-lifecycleSkill
- m13-domain-errorSkill
- m14-mental-modelSkill
- m15-anti-patternSkill
- rust-call-graphSkill
- rust-code-navigatorSkill
- rust-deps-visualizerSkill
- rust-refactor-helperSkill
- rust-symbol-analyzerSkill
- rust-trait-explorerSkill
- simple-englishSkill
- unsafe-checkerSkill
- use-buf-pluginsSkill
- use-bufSkill
- use-pixiSkill
- auvSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 14 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 8
Treat Protobuf as the canonical typed contract for gRPC, REST gateway bindings, OpenAPI, generated SDKs, and shared data structures.
- Very specific: line 12
Read repository instructions and inspect existing .proto files, packages, versions, imports, generation configuration, and generated output …
- Distinctive: line 18
Run repository tests and inspect generated diffs.
- Distinctive: line 24
Keep request and response messages distinct even when their current fields happen to match.
- Very specific: line 25
Use TitleCase service, method, message, and enum names.
- Distinctive: line 26
Prefer comments that explain semantics, units, identity, presence, ordering, and lifecycle rather than restating the field name.
- Distinctive: line 34
Use the appropriate gRPC streaming form:
- Distinctive: line 44
Read references/schema-design.md before designing or changing any streaming RPC.
- Very specific: line 53
document every request field with appropriate openapiv2 information such as example, description, format, range, length, pattern, or …
- Distinctive: line 54
keep runtime validation authoritative and make OpenAPI constraints agree with it.
- Distinctive: line 57
Do not hardcode a Buf cache path when researching extension fields.
- Distinctive: line 61
Use an enum whenever the value belongs to a finite controlled vocabulary.
- Very specific: line 63
Prefer dedicated messages, well-known types, repeated fields, maps, and oneof over google.protobuf.Struct or google.protobuf.Any.
- Very specific: line 64
Use Struct or Any only for a real open-world boundary.
- Very specific: line 71
Put API versions in both package and directory identity, using forms such as v1, v2, v1alpha1, or v1beta1.
- Distinctive: line 72
Before release, while a feature is explicitly experimental or feature-flagged, allow deliberate breaking redesigns and field renumbering …
- Distinctive: line 73
After release, never renumber or reuse field numbers.
- Distinctive: line 74
Keep generated Go packages, Python modules, TypeScript modules, and other SDK paths aligned with the source schema path.
- Distinctive: line 82
Prefer the established generator for each language and OpenAPI ecosystem.
- Distinctive: line 84
Read references/schema-design.md for complete modeling and evolution rules, references/http-and-openapi.md for gateway schemas, and
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Use Protobuf
Treat Protobuf as the canonical typed contract for gRPC, REST gateway bindings, OpenAPI, generated SDKs, and shared data structures. Model the domain before optimizing generated code.
Workflow
- Read repository instructions and inspect existing
.protofiles, packages, versions, imports, generation configuration, and generated output conventions. - Classify each service as gRPC-only or HTTP-exposed before adding annotations.
- Model every RPC, stream packet, enum, error, and reusable message with concrete types.
- Apply transport-specific validation and documentation rules.
- Evaluate compatibility according to the package's release state and version.
- Generate every configured SDK and OpenAPI artifact. Use
$use-bufand$use-buf-pluginswhen available. - Run repository tests and inspect generated diffs; never hand-edit generated code.
Define RPC Contracts Explicitly
- Define a dedicated RPC method for every gRPC operation.
- Name unary messages
MethodRequestandMethodResponse. - Keep request and response messages distinct even when their current fields happen to match.
- Use TitleCase service, method, message, and enum names; use
lower_snake_casefields andUPPER_SNAKE_CASEenum values. - Prefer comments that explain semantics, units, identity, presence, ordering, and lifecycle rather than restating the field name.
rpc GetDocument(GetDocumentRequest) returns (GetDocumentResponse);Model Streaming Without Base Payloads
Use the appropriate gRPC streaming form:
rpc ImportRecords(stream ImportRecordsStreamRequest) returns (ImportRecordsResponse);
rpc WatchJob(WatchJobRequest) returns (stream WatchJobStreamResponse);
rpc Transfer(stream TransferStreamRequest) returns (stream TransferStreamResponse);MUST NOT create an abstract, generic, inherited, or catch-all base event/base payload for stream requests or responses. Define concrete stream event, step, or packet messages. When several variants may occur, use oneof whose alternatives are separate messages. Use one homogeneous stream message only when every packet genuinely has the same body and semantics, such as fixed-shape file chunks.
Read references/schema-design.md before designing or changing any streaming RPC.
Separate gRPC-Only and HTTP-Exposed Schemas
For gRPC-only services, do not add google.api.http, grpc-gateway, or grpc.gateway.protoc_gen_openapiv2 imports, method options, message options, enum options, or field options.
For every *Request exposed through grpc-gateway, regardless of GET, POST, body, path, or query placement:
- validate accepted input with
buf.validateannotations; - document every request field with appropriate
openapiv2information such as example, description, format, range, length, pattern, or collection bounds; - keep runtime validation authoritative and make OpenAPI constraints agree with it;
- define the
google.api.httpbinding and operation documentation intentionally.
Do not hardcode a Buf cache path when researching extension fields. Follow the export/query workflow in references/http-and-openapi.md.
Prefer Strong Domain Types
- Use an enum whenever the value belongs to a finite controlled vocabulary; do not disguise it as an unconstrained string.
- Give enums an explicit zero value and document what the enum classifies.
- Prefer dedicated messages, well-known types, repeated fields, maps, and
oneofovergoogle.protobuf.Structorgoogle.protobuf.Any. - Use
StructorAnyonly for a real open-world boundary. Document why typed modeling is impossible and how consumers validate the payload. - In Go, use
protojsonfor Protobuf JSON and a registered type resolver forAny; do not route Protobuf through genericencoding/json. Research the canonical library for every other target language before implementing serialization.
Organize and Version Schemas
- Set
go_packageon first-party schemas that generate Go. - Keep language-neutral source paths and verify Python output with
protoc-gen-pythonplusprotoc-gen-pyi. Do not assume a kebab-case Protobuf source/import path automatically makes Python output invalid, and do not rename the source tree merely out of fear that it might violate Python module conventions; generate and verify the selected plugins' actual module/import behavior. - Put API versions in both package and directory identity, using forms such as
v1,v2,v1alpha1, orv1beta1. - Before release, while a feature is explicitly experimental or feature-flagged, allow deliberate breaking redesigns and field renumbering only when every producer, consumer, stored payload, and generated artifact can be rebuilt together.
- After release, never renumber or reuse field numbers. Reserve removed field numbers and names, and introduce a new version for incompatible redesigns.
- Keep generated Go packages, Python modules, TypeScript modules, and other SDK paths aligned with the source schema path. Preserve each language plugin's conventional leaf layout.
- Change output directories or flattening only when the user explicitly requests it or the repository already declares that convention in generation configuration.
Generate Complete SDK Surfaces
- Generate runtime code and the language's customary typing artifacts.
- For Python, generate
.pyplus.pyiwhen supported. - For TypeScript, generate
.tsor the ecosystem-appropriate.d.ts/.d.mtsartifacts. - Prefer the established generator for each language and OpenAPI ecosystem. Do not write a parallel custom generator or manually maintain generated output.
Read references/schema-design.md for complete modeling and evolution rules, references/http-and-openapi.md for gateway schemas, and references/api-design-sources.md when designing public resources, errors, pagination, or long-running operations.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

