Cursor Skill

use-buf-plugins

Select, pin, configure, install, build, and troubleshoot Buf code-generation plugins across remote BSR and local execution. Use for buf.gen.yaml plugin entries, protoc-gen-* tools, generated Go/Python/TypeScript/OpenAPI outputs, offline generation, BSR connectivity or rate-limit

LLM Mart · 0 points · 9 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download moeru-ai-auv-.agents_skills_use-buf-plugins-372a07b.zip · 5 KB
moeru-ai/auv 51 6 forks Apache-2.0 Updated 10h ago
Part of moeru-ai/auv — 28 skills

Install

skills CLI npx skills add https://github.com/moeru-ai/auv/tree/main/.agents/skills/use-buf-plugins
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install moeru-ai-auv@llmmart
Git git clone https://github.com/moeru-ai/auv.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole moeru-ai/auv collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Use Buf Plugins

Make code generation reproducible across languages and environments. Prefer an established generator, pin its version, preserve source-relative package structure, and verify generated output.

Inspect the Existing Generation Contract

  1. Read repository instructions, every applicable buf.gen*.yaml, generation script, CI workflow, package manifest, and generated directory convention.
  2. Identify each required artifact: message runtime, gRPC client/server, gateway, OpenAPI, language typing, or framework bindings.
  3. Record plugin source, version/revision, options, invocation strategy, input scope, output path, and runtime requirements.
  4. Do not replace a working generator or rearrange generated paths without an explicit requirement.

Choose Remote or Local Deliberately

Use a BSR remote plugin when network access is reliable and centralized execution is acceptable. Pin the upstream plugin version and revision when available; do not rely on latest for reproducible generation.

Use a local plugin when:

  • generation must work offline or in an isolated network;
  • the BSR is unavailable;
  • authentication or codegen rate limits make remote generation unreliable;
  • a private/custom plugin cannot run remotely;
  • CI requires locally controlled binaries or images.

Remote generation sends the Protobuf input to the configured BSR executor. Confirm that this is acceptable for private schemas. Authenticate with the repository's approved mechanism when increased BSR limits are needed; never embed tokens in config.

Read references/remote-and-local.md before changing plugin execution mode.

Source and Package Local Plugins Reproducibly

  • Prefer the plugin author's official binary/package or the upstream definitions in bufbuild/plugins.
  • Treat each upstream plugin Dockerfile, version, and revision as immutable build input.
  • A maintained mirror may build selected upstream bufbuild/plugins Dockerfiles into OCI images. Verify its source mapping, image entrypoint, version tag, platforms, provenance, and update cadence before depending on it.
  • If using a maintained buf-build mirror, understand the convention: an upstream path like plugins/<family>/<plugin>/<version>/Dockerfile is published as an image whose repository identifies <family>-<plugin> and whose tag identifies <version>. Reinspect the mirror documentation instead of hardcoding one publisher, version, or registry.
  • If the maintained image is acceptable, consume a pinned digest or immutable version. Otherwise build the upstream definition locally.
  • Invoke $use-docker-buildx-for-building before building or smoke-testing any plugin OCI image. Follow its platform, --load, naming, secret, runtime, and cleanup requirements.

OCI images are not automatically Buf local plugins. Buf expects an executable that reads a CodeGeneratorRequest from stdin and writes a CodeGeneratorResponse to stdout. Provide a narrow executable wrapper only after inspecting the image entrypoint; preserve stdin/stdout, forward arguments, use --rm, and never allocate a TTY.

Configure Outputs by Ecosystem

  • Generate both runtime and service bindings required by the application.
  • For Go, follow the official Go generated-code and gRPC plugin guidance and honor go_package/managed-mode decisions.
  • For Python, generate runtime modules, gRPC bindings, and .pyi typing where the toolchain supports them.
  • For TypeScript, generate the ecosystem's customary .ts or declaration artifacts.
  • For OpenAPI, use the repository's established grpc-gateway/OpenAPI generator and annotations. Do not hand-maintain a second schema generator.
  • Keep output paths aligned with Protobuf source/package paths unless an explicit buf.gen.yaml convention says otherwise.
  • Pin generated-code runtime dependencies in each language package manager as well as pinning generators; generator reproducibility does not guarantee runtime compatibility.

Read references/language-generators.md before adding or replacing a language generator.

Validate Plugin Changes

  1. Run the plugin binary or OCI wrapper with a bounded smoke check appropriate to its entrypoint.
  2. Run buf lint.
  3. Run buf generate with every affected template.
  4. Run buf breaking --against '.git#branch=main'.
  5. Inspect the generated diff for missing files, unexpected path changes, nondeterminism, and stale artifacts.
  6. Run target-language formatting, compilation, tests, and type checks.
  7. Repeat generation from a clean state when reproducibility is uncertain; generated output should be stable.
  8. For an air-gapped contract, repeat the complete generation with networking disabled and no hidden image pull or ambient PATH dependency.

Never pass registry credentials, source credentials, or private dependency tokens through Docker build arguments, image layers, generated files, or committed plugin wrappers.

Files (auv)
  • agents
    • openai.yaml 209 B
      interface:
        display_name: "Use Buf Plugins"
        short_description: "Choose and operate reproducible Buf codegen plugins"
        default_prompt: "Use $use-buf-plugins to configure reliable Protobuf code generation."
      
  • references
    • language-generators.md 2.1 KB
      # Language Generator Selection
      
      Select established plugins from the target ecosystem and verify their current official documentation before adding them.
      
      ## Go
      
      Usually generate both Protobuf messages and gRPC bindings when the application uses gRPC. Align `go_package`, managed mode, `paths=source_relative`/module options, and repository import paths.
      
      - https://grpc.io/docs/languages/go/quickstart/
      - https://protobuf.dev/reference/go/go-generated/
      
      ## Python
      
      Generate runtime messages and gRPC bindings. Also generate `.pyi` typing with the established Python typing plugin when supported by the repository. Verify namespace/package behavior instead of changing source schema paths preemptively.
      
      - https://protobuf.dev/reference/python/python-generated/
      - https://grpc.io/docs/languages/python/quickstart/
      
      ## TypeScript and JavaScript
      
      Choose the runtime already used by the project, such as the official/Buf-maintained Protobuf ecosystem or the framework required by the application. Generate `.ts` or appropriate `.d.ts`/`.d.mts` declarations. Do not mix incompatible message runtimes in one SDK without an explicit migration plan.
      
      - https://protobuf.dev/reference/
      - https://buf.build/docs/bsr/remote-plugins/
      
      ## OpenAPI and grpc-gateway
      
      Use the established grpc-gateway and OpenAPI plugin versions together. Generate gateway bindings only for RPCs intentionally exposed through HTTP. Generate OpenAPI documentation from annotations/comments rather than maintaining a parallel hand-written schema.
      
      - https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/customizing_openapi_output/
      
      ## Selection Checklist
      
      - Confirm maintenance status and compatibility with the Protobuf runtime/compiler.
      - Pin plugin version and BSR revision or local package/image digest.
      - Confirm required companion plugins, such as message runtime plus gRPC service bindings.
      - Preserve output/package paths expected by consumers.
      - Generate typing artifacts customary for the language.
      - Compile, format, type-check, and test generated code.
      - Avoid writing a custom generator when a maintained ecosystem plugin already implements the contract.
      
    • remote-and-local.md 3.6 KB
      # Remote and Local Buf Plugins
      
      ## Remote Plugins
      
      Remote BSR plugins reduce local tool installation but require network access and send schema input to the remote executor.
      
      ```yaml
      version: v2
      plugins:
        - remote: buf.build/protocolbuffers/go:<version>
          revision: <revision>
          out: gen/go
          opt:
            - paths=source_relative
      ```
      
      Pin versions and revisions where available. Authenticate with `buf registry login` through approved credential handling when appropriate. BSR code generation is rate-limited; inspect current limits and `Retry-After` instead of embedding numeric limits in automation:
      
      - https://buf.build/docs/bsr/rate-limits/
      - https://buf.build/docs/bsr/remote-plugins/
      
      Do not retry HTTP 429 responses in a tight loop. Honor server guidance, reduce redundant generation, authenticate, or switch to an approved local toolchain.
      
      ## Local Plugins
      
      Buf accepts a PATH executable, relative/absolute path, or command array:
      
      ```yaml
      plugins:
        - local: protoc-gen-go
          out: gen/go
        - local: tools/protoc-gen-custom
          out: gen/custom
        - local: ["go", "run", "example.org/tool/cmd/protoc-gen-example@v1.2.3"]
          out: gen/example
      ```
      
      Pin package versions and avoid mutable ambient installations in CI. Local plugins implement the standard protoc plugin protocol: read `CodeGeneratorRequest` from stdin and write `CodeGeneratorResponse` to stdout.
      
      ## OCI-Packaged Plugins
      
      An OCI image needs an entrypoint that implements the protoc plugin protocol. Buf cannot use an image reference directly as `local`; provide an executable wrapper after inspecting the image:
      
      ```sh
      #!/bin/sh
      set -eu
      
      exec docker run --rm -i <plugin-image>@sha256:<digest> "$@"
      ```
      
      Do not use `-t`; the protobuf request/response use stdin/stdout. Keep logs on stderr. Pin an immutable digest or version and ensure the runtime platform is supported.
      For a preloaded air-gapped image, add `--pull=never`; add `--network=none`, read-only/no-new-privileges, capability drops, or bounded temporary storage when the inspected plugin remains compatible with those restrictions.
      
      Before accepting a wrapper:
      
      1. inspect the image entrypoint and command;
      2. verify its upstream plugin name/version/revision;
      3. smoke-test the exact platform and image;
      4. run generation twice and confirm stable output;
      5. ensure wrapper/image credentials are not committed.
      
      For transfer into an air-gapped environment, export the exact platform image/archive, record its digest and checksum, preload it without a registry pull, and transfer the pinned Buf binary, dependency state, generation template, wrappers, and language runtime locks through the approved channel.
      
      ## Building from `bufbuild/plugins`
      
      The upstream repository stores versioned plugin definitions under `plugins/<family>/<plugin>/<version>/`. Inspect the selected Dockerfile and metadata rather than inventing a build. A mirror may automate building these definitions into multi-platform OCI images; verify that tag-to-upstream-path mapping from its current documentation.
      
      If no acceptable maintained image exists:
      
      1. select the exact upstream plugin definition and version;
      2. inspect its Dockerfile, sources, checksums, base images, entrypoint, and supported platforms;
      3. invoke `$use-docker-buildx-for-building` and follow its repository-derived context, explicit platform, `--load`, runtime smoke test, and secret rules;
      4. publish only when the user authorizes registry mutation;
      5. pin the consumed image by digest/version.
      
      Useful sources:
      
      - https://github.com/bufbuild/plugins/tree/main/plugins
      - https://buf.build/docs/bsr/remote-plugins/custom-plugins/
      - https://github.com/nekomeowww/buf-build
      
  • SKILL.md 5.3 KB
    ---
    name: use-buf-plugins
    description: Select, pin, configure, install, build, and troubleshoot Buf code-generation plugins across remote BSR and local execution. Use for buf.gen.yaml plugin entries, protoc-gen-* tools, generated Go/Python/TypeScript/OpenAPI outputs, offline generation, BSR connectivity or rate-limit failures, OCI-packaged plugin wrappers, or reproducing plugins from bufbuild/plugins.
    ---
    
    # Use Buf Plugins
    
    Make code generation reproducible across languages and environments. Prefer an established generator, pin its version, preserve source-relative package structure, and verify generated output.
    
    ## Inspect the Existing Generation Contract
    
    1. Read repository instructions, every applicable `buf.gen*.yaml`, generation script, CI workflow, package manifest, and generated directory convention.
    2. Identify each required artifact: message runtime, gRPC client/server, gateway, OpenAPI, language typing, or framework bindings.
    3. Record plugin source, version/revision, options, invocation strategy, input scope, output path, and runtime requirements.
    4. Do not replace a working generator or rearrange generated paths without an explicit requirement.
    
    ## Choose Remote or Local Deliberately
    
    Use a BSR remote plugin when network access is reliable and centralized execution is acceptable. Pin the upstream plugin version and revision when available; do not rely on `latest` for reproducible generation.
    
    Use a local plugin when:
    
    - generation must work offline or in an isolated network;
    - the BSR is unavailable;
    - authentication or codegen rate limits make remote generation unreliable;
    - a private/custom plugin cannot run remotely;
    - CI requires locally controlled binaries or images.
    
    Remote generation sends the Protobuf input to the configured BSR executor. Confirm that this is acceptable for private schemas. Authenticate with the repository's approved mechanism when increased BSR limits are needed; never embed tokens in config.
    
    Read [references/remote-and-local.md](references/remote-and-local.md) before changing plugin execution mode.
    
    ## Source and Package Local Plugins Reproducibly
    
    - Prefer the plugin author's official binary/package or the upstream definitions in `bufbuild/plugins`.
    - Treat each upstream plugin Dockerfile, version, and revision as immutable build input.
    - A maintained mirror may build selected upstream `bufbuild/plugins` Dockerfiles into OCI images. Verify its source mapping, image entrypoint, version tag, platforms, provenance, and update cadence before depending on it.
    - If using a maintained `buf-build` mirror, understand the convention: an upstream path like `plugins/<family>/<plugin>/<version>/Dockerfile` is published as an image whose repository identifies `<family>-<plugin>` and whose tag identifies `<version>`. Reinspect the mirror documentation instead of hardcoding one publisher, version, or registry.
    - If the maintained image is acceptable, consume a pinned digest or immutable version. Otherwise build the upstream definition locally.
    - Invoke `$use-docker-buildx-for-building` before building or smoke-testing any plugin OCI image. Follow its platform, `--load`, naming, secret, runtime, and cleanup requirements.
    
    OCI images are not automatically Buf local plugins. Buf expects an executable that reads a `CodeGeneratorRequest` from stdin and writes a `CodeGeneratorResponse` to stdout. Provide a narrow executable wrapper only after inspecting the image entrypoint; preserve stdin/stdout, forward arguments, use `--rm`, and never allocate a TTY.
    
    ## Configure Outputs by Ecosystem
    
    - Generate both runtime and service bindings required by the application.
    - For Go, follow the official Go generated-code and gRPC plugin guidance and honor `go_package`/managed-mode decisions.
    - For Python, generate runtime modules, gRPC bindings, and `.pyi` typing where the toolchain supports them.
    - For TypeScript, generate the ecosystem's customary `.ts` or declaration artifacts.
    - For OpenAPI, use the repository's established grpc-gateway/OpenAPI generator and annotations. Do not hand-maintain a second schema generator.
    - Keep output paths aligned with Protobuf source/package paths unless an explicit `buf.gen.yaml` convention says otherwise.
    - Pin generated-code runtime dependencies in each language package manager as well as pinning generators; generator reproducibility does not guarantee runtime compatibility.
    
    Read [references/language-generators.md](references/language-generators.md) before adding or replacing a language generator.
    
    ## Validate Plugin Changes
    
    1. Run the plugin binary or OCI wrapper with a bounded smoke check appropriate to its entrypoint.
    2. Run `buf lint`.
    3. Run `buf generate` with every affected template.
    4. Run `buf breaking --against '.git#branch=main'`.
    5. Inspect the generated diff for missing files, unexpected path changes, nondeterminism, and stale artifacts.
    6. Run target-language formatting, compilation, tests, and type checks.
    7. Repeat generation from a clean state when reproducibility is uncertain; generated output should be stable.
    8. For an air-gapped contract, repeat the complete generation with networking disabled and no hidden image pull or ambient PATH dependency.
    
    Never pass registry credentials, source credentials, or private dependency tokens through Docker build arguments, image layers, generated files, or committed plugin wrappers.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related