/developer-platform-skills:public-grpc-api-designfrom developer-platform-skills
Designs a public gRPC API surface for external developers, covering when to use gRPC vs REST, proto versioning, breaking-change gates, streaming decisions, error models, transcoding architecture, and external auth/TLS. Use when discussing gRPC, protobuf, buf, Connect-RPC, grpc-gateway, or gRPC-JSON transcoding at a public edge.
Ships in developer-platform-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are a public gRPC surface designer. Decide whether gRPC belongs at a platform's public edge at all, and - when it does - design the proto governance, streaming posture, error model, transcoding architecture, and external auth that let developers you have never met consume it safely.
The framing question is never "how do we design the best public gRPC API" but "does this workload belong on public gRPC, and through what edge". Sibling samber/developer-platform-skills@api-integration-surface-strategy partially owns that umbrella decision; re-ask it here anyway, because teams arrive having assumed "public gRPC" without validating it.
Memory (advised): When memory lives in a file, consider using developer-platform-context.md; if a different memory system is in use, rely on that instead. The file is an advisory reference, not a mandatory requirement. Separate task info in different sections. Remove finished tasks. Add a date to a task; no date for general project context. Some interview responses may differ between 2 tasks.
Ask these before designing anything; each answer changes a later step. Batch them - this is a tactical design task, not a strategy interview.
If your harness has persistent memory, store the design's settled decisions (the gate's verdict and its trigger, proto package and version scheme, streaming posture, chosen transcoding rung with its promotion condition, auth flow per caller type) so later runs - a new RPC, a proto review, the docs pass - start from the design instead of re-deriving it.
The split that changes the design is how the consumer meets the contract:
protoc/buf fluency you cannot assume, and debug binary payloads with tooling most do not have installed. Proto governance (steps 2-3) is designed for them.Design for the least-equipped consumer type actually present. A surface only the SDK-mediated audience can use silently excludes the other two - that is a business-reach decision, not a technical default; make it consciously in step 1.
google.rpc.Status.Each step has a section below, in order.
Practitioner consensus favors dual-stack, not either/or: gRPC for internal service-to-service traffic where you control both ends, REST or transcoded JSON at the edge where you do not. REST still carries the large majority of public APIs per tracked estimates (roughly 83% in the most recent count). See references/public-grpc-case-studies.md for the sourced detail and the precision caveats on each:
Why REST wins the public edge by default - concrete mechanisms, not preference:
grpcurl-class tooling third parties rarely have.protoc/stub-regeneration cost that an internal fleet amortizes.The genuine triggers that justify public gRPC anyway - all three worth checking, any one may suffice:
When the gate says "gRPC inside, JSON outside", Google's Apigee team supplies the reach argument to put in the design doc: "not all developers are equipped or experienced enough to consume gRPC services. API providers would therefore risk missing out on a potential audience by limiting themselves to exposing gRPC services only." The gate's output feeds step 6: it decides which rungs of the transcoding menu are even in play.
A public proto package becomes part of every generated client's import path - convention mistakes here are breaking changes once external consumers depend on them. Google's AIP corpus is the closest thing gRPC has to a canonical public style guide; adopt it rather than inventing house rules:
example.library.v1) - AIP-215.example/library/v1/); never put the version in a filename (v1.proto produces bizarre generated imports) - AIP-191.v1, never v1.0 or SemVer minors - encoded in the package and mirrored as the first URI segment of the transcoded surface. v1 means stable; v1beta/v1alpha are the pre-stable channels, and claiming beta functionality under v1 is the review finding to flag - AIP-185.:verb suffix.<Method>Request/<Method>Response wrapper message per RPC, never a bare scalar or a shared message - a shared message ripples every field change across every RPC referencing it, and a wrapper can always gain optional fields without breaking wire compatibility.reserved every removed field._UNSPECIFIED.google.protobuf.Timestamp, FieldMask, google.rpc.*) over hand-rolled equivalents.java_package and friends) so generated code stays idiomatic instead of leaking the raw proto path.Boundary: sibling samber/developer-platform-skills@api-versioning-policy owns notice windows, sunset communication, and governance generics across paradigms. This skill owns how a version is encoded and enforced gRPC-natively - the package-suffix rule above and step 3's gates. A new major version must not depend on the previous one, and stable resources keep identical resource names across majors so a v2 client can address what a v1 client created.
See references/proto-governance-reference.md for file-content ordering, the buf lint rule names that operationalize each convention, channel-based vs release-based version evolution, and deprecation mechanics.
Protobuf's encoding only guarantees wire compatibility, not client-code compatibility (AIP-180's distinction) - so the gate must be tooling, not reviewer vigilance:
buf breaking --against <main> on every PR as a hard CI gate, plus buf lint with the STANDARD set. Default to the strictest rule category (FILE) for a public surface; it catches generated-import breakage that package-level checks forgive. Turning the gate's findings into a partner-facing changelog, with release baselines and approval records, is samber/developer-platform-skills@api-changelog-automation.oneof breaks generated Go stubs.buf breaking does not inspect custom options like google.api.http, so a team can break its REST-facing URL/verb mapping while every proto gate stays green. Add a dedicated check: snapshot the annotation-derived HTTP surface (paths, verbs, body mappings) and diff it in CI, or contract-test the transcoded routes - a named failure mode, not a theoretical one.proto-backwards-compat-maven-plugin against a checked-in proto.lock.Deprecation is proto-native too: deprecated = true (available on messages, enums, enum values, and services) plus an AIP-192 comment saying why and what replaces it. Channel expectations differ sharply:
The notice windows themselves are samber/developer-platform-skills@api-versioning-policy's territory.
gRPC's four call types are not equally priced on a public surface. Expose unary RPCs by default; every streaming method is a deliberate, recorded decision with its costs accepted - never a free feature.
Enforce the decision, don't just document it: when the surface commits to unary-only, enable buf's UNARY_RPC lint category so a future PR cannot silently introduce a streaming method the gateway, SDKs, or transport cannot carry. Sibling samber/developer-platform-skills@api-idempotency-retry owns retry mechanics, deadline propagation, and backoff generics; this step only decides which call shapes the public contract offers.
Sibling samber/developer-platform-skills@api-error-design owns taxonomy philosophy - code catalogs, message writing, retryability signaling. This step owns the gRPC-native mechanics and the two traps that bite public surfaces:
google.rpc.Status:
code: one of the 17 canonical codes.message: developer-facing English, never localized user text.details: typed extras from google/rpc/error_details.proto (ErrorInfo first, BadRequest for field violations, RetryInfo paired with RESOURCE_EXHAUSTED).OUT_OF_RANGE over FAILED_PRECONDITION when both apply). Defaulting everything to UNKNOWN/INTERNAL as a defensive habit is the named anti-pattern: it flattens every status dashboard into one bucket.DebugInfo is documented as internal-only - filter it from details before the response leaves; sanitizing message alone is insufficient.grpc-status; a gateway translating errors outward needs its own deliberate mapping, confirmed against the transcoding implementation actually in use.INVALID_ARGUMENT, FAILED_PRECONDITION, OUT_OF_RANGE) all land on 400, and CANCELLED maps to the non-standard 499. Document for consumers that the HTTP status line is lossy and the structured envelope in the body is the source of truth.convert_grpc_status: true and every detail type present in the proto descriptor (missing types drop silently).details entirely - a custom error handler is mandatory there if structured detail matters.Only UNAVAILABLE is generally safe to auto-retry without extra signal (AIP-194); everything else needs an explicit RetryInfo or caller judgment. The full 17-code table, gateway mapping, details catalog, and per-gateway survival mechanics are in references/grpc-error-http-mapping.md.
The design decision this step owns is what edge serves non-gRPC consumers and how the mapping is expressed - AIP-127's google.api.http annotation is the convention every implementation converged on ("APIs must provide HTTP definitions for each RPC except bi-directional streaming RPCs"). The menu, ranked:
raw public gRPC edge > grpc-gateway == Envoy transcoder > Connect-RPCConnect-RPC > Envoy transcoder > grpc-gateway > raw public gRPC edgeConnect-RPC > Envoy transcoder > grpc-gateway > raw public gRPC edgeEffort here is what the team operates and regenerates; value is audience reached per proto contract, with error and streaming fidelity preserved. The grpc-gateway == Envoy effort tie is genuine: regenerating a Go proxy on every proto change and keeping a descriptor set plus filter config in sync are different work at the same order of magnitude - and "you already run Envoy" is exactly the condition that breaks it.
Default rung: Connect-RPC. One server speaks Connect, gRPC, and gRPC-Web:
Entered CNCF Sandbox in April 2024, already in production at CrowdStrike, PlanetScale, RedPanda, Chick-fil-A, Bluesky, and Dropbox. Buf's framing when launching it: "conceptually, the gRPC protocol is HTTP with Protobuf-encoded bodies" - Connect collapses the pick-a-gateway decision for most new surfaces.
Promote Envoy's gRPC-JSON transcoder when Envoy is already your mesh data plane and a second runtime is the real cost - descriptor-driven, no generated glue code, the common approach in Kubernetes environments. Not because Envoy is inferior; "you already operate this" is a legitimate reason.
Keep grpc-gateway where an existing Go investment already carries it with a custom error handler; it pays a codegen step plus a double JSON↔protobuf parse on every request, and its default error handling is the weakest of the three (step 5.6).
Raw public gRPC edge is the starved option: highest fidelity (binary end-to-end, full streaming, zero transcoding loss) and highest effort (a gRPC-aware edge with L7 balancing, WAF, and TLS termination - Cloudflare ships this as a product - plus a full internal-RPC exposure audit and every consumer bearing Protobuf tooling). It loses every efficiency round; the one condition that promotes it anyway is step 1's Temporal trigger, a confirmed SDK-mediated, control-plane audience. Even then, dual-publish an HTTP surface alongside, as Temporal does.
Ruled out, not demoted: raw public gRPC as the only surface when question 3 said browser clients call directly. Browsers structurally cannot speak gRPC framing; keeping the option parked at the bottom of the menu silently reappears as scope. Delete it and choose among the three above.
This ranking is a default, not a law. Re-rank against question 6 and what you know about the team:
Performance-critical consumers should be steered to native gRPC or Connect's binary mode regardless of rung - every JSON-transcoding path pays a real parse cost.
Mechanics table (streaming support, browser path, proxy requirements per option) and sourced quotes: references/public-grpc-case-studies.md.
The internal-auth instinct is the wrong one: mTLS authenticates workloads and scales fine inside a mesh, but issuing and revoking client certificates for developers you have never met is operationally impractical. The public edge authenticates apps and users instead - the mesh does not disappear; it starts one hop further in. Order of operations:
authorization: Bearer <token> metadata, validated in a server interceptor.RESOURCE_EXHAUSTED (429 once transcoded) paired with a RetryInfo detail so callers back off instead of hammering the same limit.The reference architecture to diagram: TLS termination + token validation + per-method authZ + rate limiting at the public gateway (Apigee, Cloudflare, Envoy are named vendor instances), fronting the internal mesh where mTLS resumes.
Anti-pattern checklist - each is a direct audit finding:
buf breaking green while a google.api.http annotation change broke the public REST mapping - the blind spot with no dedicated check.details payload.UNKNOWN or INTERNAL; DebugInfo reaching external callers.v1 package.Pass gates, self-set from the sourced rules above (no industry-standard thresholds exist for this surface; each gate is binary and auditable):
buf breaking (FILE category) green in CI on 100% of merges.google.api.http annotations covered by a dedicated mapping diff or contract test, because buf does not check them.UNARY_RPC lint enabled on a unary-only surface, or every streaming method paired with a recorded accepted-tradeoff decision and (for bidi) a non-streaming alternative.Iterate the design until all four pass. Afterwards, watch as trends (not thresholds): the share of support tickets caused by transcoded-error confusion, and cross-version compatibility test results per release.
See also, same collection:
samber/developer-platform-skills@api-integration-surface-strategy - the umbrella decision of which surfaces to offer at all; this skill re-validates its gRPC branch and executes it.samber/developer-platform-skills@public-api-design-review - whole-surface consistency review for the REST/JSON side; it hands gRPC-specific design here.samber/developer-platform-skills@public-graphql-api-design - the structural analogue for a public GraphQL surface; same gate-first shape, different paradigm.samber/developer-platform-skills@api-versioning-policy - notice windows, sunset communication, and governance generics; this skill owns only the gRPC-native version encoding and gates.samber/developer-platform-skills@api-error-design - error taxonomy philosophy, message writing, retryability signaling; this skill owns only google.rpc.Status mechanics and the HTTP-mapping traps.samber/developer-platform-skills@api-idempotency-retry - client retry mechanics, deadline propagation, and backoff generics consumed by step 4's streaming decision.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
grpc-api-design, protobuf, api-gateway, transcoding, api-versioning
Other plugins' skills for the same job
61 skills in this plugin
/agent-integration-surfacesPlans how a SaaS or developer platform opens itself to AI agents, provider side - which agent classes may reach which surface, how an agent proves its identity and acts for a user (Web Bot Auth, delegated tokens, provision-then-claim signup), which execution path each gets, where agents find it (Context7, api-catalog) and how agent usage is counted. Use whenever someone asks if their product is agent-ready, why agents get blocked or cannot sign up, or how agents should authenticate to it. Do NOT use for MCP tool design (samber/developer-platform-skills@mcp-server-offering), surface build order (samber/developer-platform-skills@api-integration-surface-strategy) or agent-readable docs (samber/developer-relations-skills@coding-agent-docs-optimization)./agent-skill-offeringShips an Agent Skill (SKILL.md) inside the GitHub repo of the library, CLI or SDK it documents, versioned with the code - repo placement, metadata.version bumped every release, CI that fails a release on a stale skill, tag-pinned installs (skills.sh, gh skill, ClawHub, plugin marketplaces), plugin manifests, OpenClaw gating, skill vs MCP vs CLI. Use whenever a tool maintainer mentions shipping a skill with their tool, a SKILL.md for their library, keeping a skill in sync with releases, or plugin.json versions for a skill beside code - even if they never say "agent skill". Not for standalone skill collections. Do NOT use for CLI command or --json design - use samber/developer-platform-skills@cli-interface-design; nor for MCP servers - use samber/developer-platform-skills@mcp-server-offering./api-auth-key-managementDesign the API-key authentication surface a platform issues to its own API consumers - key format with prefix+checksum conventions, hashed (irretrievable) vs encrypted (retrievable) storage, zero-downtime rotation with dual-key overlap, least-privilege scoping, individual vs org vs service-account ownership, self-service key dashboard behavior, and SOC 2 / PCI-DSS 4.0 lifecycle governance. Use whenever the user mentions API keys, secret keys, key prefixes, key rotation, key scoping, or revoking keys after an employee departure - even if they never say "API key management". Provider side only, not consuming another vendor's API. Do NOT use for OAuth authorization-server design - use samber/developer-platform-skills@oauth2-provider-design instead./api-beta-programRuns an early-access, preview, beta or design-partner program for a new API feature: program shape, what each pre-GA label guarantees (SLA, support, breaking-change notice, pricing, data terms), stage on the wire, partner selection, per-account access, feedback cadence, exit to GA or kill, and rescuing betas that never ended. Use whenever the user mentions an API beta or preview program, design partners, beta labels or allowlists, production traffic on their own beta endpoint, or when to go GA - even if they only say "let a few customers try the new endpoint before it's final". Not for whole-app beta testing, a vendor's beta you consume, or canary rollouts of a GA change. Do NOT use for the stable version lifecycle - use samber/developer-platform-skills@api-versioning-policy./api-changelog-automationDesigns the provider-side pipeline that turns contract diffs of an API you publish (OpenAPI, GraphQL SDL, protobuf, AsyncAPI) into a breaking-change CI gate and a traced, per-version API changelog feed, classified by your own policy. Use whenever the user mentions oasdiff, openapi-diff, graphql-inspector diff, buf breaking, API schema checks, failing a PR on breaking changes to a published API contract, or an auto-generated API changelog. Do NOT use for release-note prose (samber/developer-relations-skills@changelog-writing), consumer-side upgrades (samber/developer-relations-skills@version-migration-guide), deprecation policy (samber/developer-platform-skills@api-versioning-policy) or callers of deprecated endpoints (samber/developer-platform-skills@integration-health-monitoring)./api-error-designDesign the error surface of a public API so integrators self-serve fixes - a machine-readable error-code taxonomy (flat catalog, code/subcode, Google-style domain/reason), the RFC 9457 problem-details envelope with extension members, actionable error messages, retryability signaling (retryable flag, Retry-After), and per-endpoint error documentation with request-ID tracking. Use whenever the user mentions API error codes, an error taxonomy, RFC 9457, application/problem+json, 4xx/5xx response bodies, or confusing API error messages - even if they never say "error design". Do NOT use for client-side retry mechanics - use samber/developer-platform-skills@api-idempotency-retry - nor for incident and status-page communication - use samber/developer-platform-skills@api-status-communication instead.npx claudepluginhub samber/developer-platform-skills --plugin developer-platform-skills