Cursor Skill

use-buf

Configure, inspect, update, validate, and troubleshoot Buf workspaces and modules. Use when working with buf.yaml, buf.lock, buf.gen.yaml or domain-specific Buf generation templates; managing BSR dependencies; formatting, linting, generating, detecting breaking Protobuf changes;

LLM Mart · 0 points · 11 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-372a07b.zip · 4 KB
moeru-ai/auv 51 6 forks Apache-2.0 Updated 14h 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
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

Use the Buf CLI as the source of truth for Protobuf compilation, dependency resolution, linting, breaking-change detection, and code generation.

Inspect Before Changing

  1. Read repository instructions.
  2. Search the repository root and likely API directories for buf.yaml, buf.lock, buf.gen.yaml, and buf.gen.<domain>.yaml files.
  3. Inspect the configuration version, module paths, dependency declarations, lint policy, breaking policy, inputs, plugin pins, output paths, and existing generation scripts.
  4. Run buf --version and check repository/CI tool pins before using features from a newer configuration schema.
  5. Diagnose configuration or dependency problems before changing .proto files to work around them.

Use one default buf.gen.yaml. Introduce buf.gen.<domain>.yaml only when generation products genuinely require isolated plugin sets, inputs, or outputs. Pass non-default templates explicitly with buf generate --template <file>.

Keep Configuration Responsibilities Clear

  • Use buf.yaml for workspaces/modules, BSR dependencies, lint rules, breaking rules, policies, and Buf check plugins.
  • Use buf.gen.yaml or buf.gen.<domain>.yaml for protoc-gen-* code-generation plugins, inputs, output directories, options, and managed mode.
  • Use buf.lock as generated dependency resolution state. Do not edit it manually.
  • Keep configuration in the repository root or the established API workspace directory unless repository structure requires otherwise.

Read references/configuration.md before adding modules, dependencies, check plugins, generation templates, or output paths.

Manage Dependencies Deliberately

  • Prefer BSR modules for maintained dependencies, including Google APIs, well-known types, Protovalidate, and grpc-gateway annotations.
  • Add or remove dependencies in buf.yaml, then run buf dep update and inspect the buf.lock diff.
  • Use buf dep graph --format json to identify the resolved dependency chain.
  • Use buf dep prune only after confirming an import is genuinely unused.
  • When a type appears missing, inspect configuration and the lockfile, run buf dep update, then run buf build or buf generate to obtain the compiler's concrete import/type error.
  • Never hardcode an operating system's Buf cache location. Export the pinned module with buf export when source inspection is required.

Required Validation

After changing first-party Protobuf or Buf configuration, MUST run:

buf lint
buf generate
buf breaking --against '.git#branch=main'

Also run buf format --diff or the repository's format check and all language-specific tests/type checks for generated outputs.

Do not skip the breaking check merely because a break is intentional. Run it, capture the violations, and report that the change is an approved experimental/unreleased break. If the repository does not have a main branch, report that exact baseline failure and resolve the intended integration baseline rather than silently omitting compatibility validation.

Diagnose in Dependency Order

  1. Confirm the current directory and discovered buf.yaml.
  2. Confirm module paths and import paths.
  3. Confirm dependencies and buf.lock with buf dep graph.
  4. Compile with buf build.
  5. Lint with buf lint.
  6. Generate with the selected template.
  7. Inspect plugin stderr, output collisions, and generated diffs.
  8. Run the breaking check against main.

Use $use-buf-plugins for remote/local plugin selection, offline generation, rate limits, or plugin wrappers. Read references/commands-and-troubleshooting.md for precise inspection commands and failure handling.

Files (auv)
  • agents
    • openai.yaml 188 B
      interface:
        display_name: "Use Buf"
        short_description: "Manage, validate, and generate Protobuf with Buf"
        default_prompt: "Use $use-buf to configure and validate this Buf workspace."
      
  • references
    • commands-and-troubleshooting.md 2.3 KB
      # Buf Commands and Troubleshooting
      
      ## Required Checks
      
      Run from the configured workspace root:
      
      ```sh
      buf lint
      buf generate
      buf breaking --against '.git#branch=main'
      ```
      
      Also use:
      
      ```sh
      buf format --diff
      buf build
      buf dep graph --format json
      git diff --exit-code
      git status --short
      ```
      
      If generation uses domain templates, run every affected template with `buf generate --template <template>`.
      Use both Git commands because `git diff` alone does not report newly generated untracked files.
      
      ## Missing Import or Type
      
      1. Confirm the import path spelling and module source roots.
      2. Confirm the dependency exists in `buf.yaml`.
      3. Inspect `buf.lock` and `buf dep graph --format json`.
      4. Run `buf dep update` when dependency state is stale or intentionally changed.
      5. Run `buf build` for compiler diagnostics.
      6. Export the pinned dependency with `buf export` and inspect its files rather than searching an OS cache path.
      
      ## Generation Failure
      
      1. Inspect `buf.gen*.yaml` execution type, version, revision, output, options, and strategy.
      2. Confirm local executables exist and are executable, or confirm BSR connectivity/authentication for remote plugins.
      3. Run `buf generate --debug` when normal stderr lacks enough detail.
      4. Check for two plugins writing the same file inconsistently.
      5. Check generated imports/package paths against `go_package`, managed mode, Python module paths, and TypeScript options.
      6. Invoke `$use-buf-plugins` for plugin acquisition, OCI wrappers, offline operation, or rate limits.
      
      ## Breaking Changes
      
      Run the check even for intentional pre-release breaks. Distinguish:
      
      - accidental incompatible changes that must be fixed;
      - approved experimental/unreleased breaks that require coordinated regeneration and data rebuilding;
      - released incompatibilities that require a new API version.
      
      Do not weaken global breaking rules merely to pass one change. Scope an exception only when repository policy explicitly permits it and document why.
      
      ## Dependency Hygiene
      
      Use `buf dep prune` only after reviewing imports and generated needs. After any dependency mutation, rerun lint, build, generate, breaking checks, and target-language validation.
      
      Official references:
      
      - https://buf.build/docs/cli/
      - https://buf.build/docs/configuration/v2/buf-yaml/
      - https://buf.build/docs/configuration/v2/buf-gen-yaml/
      - https://buf.build/docs/bsr/
      
    • configuration.md 2.6 KB
      # Buf Configuration
      
      ## Discover the Workspace
      
      Search before editing:
      
      ```sh
      rg --files -g 'buf.yaml' -g 'buf.lock' -g 'buf.gen*.yaml'
      buf --version
      ```
      
      Inspect root-level and API-directory configurations, generation scripts, CI, and tool pins. Determine whether the repository uses one workspace or several independent modules.
      
      ## `buf.yaml`
      
      Use `buf.yaml` to declare:
      
      - configuration version;
      - module source paths and optional BSR module names;
      - BSR schema dependencies;
      - lint rules/exceptions;
      - breaking-change rules/exceptions;
      - policies and Buf check plugins where supported.
      
      `buf.yaml` check plugins extend lint/breaking behavior. They are not `protoc-gen-*` code generators.
      
      Prefer maintained BSR dependencies. Common examples include:
      
      ```yaml
      deps:
        - buf.build/googleapis/googleapis
        - buf.build/protocolbuffers/wellknowntypes
        - buf.build/bufbuild/protovalidate
        - buf.build/grpc-ecosystem/grpc-gateway
      ```
      
      Use only dependencies actually imported by the workspace.
      
      ## `buf.gen.yaml`
      
      Use `buf.gen.yaml` for code generation:
      
      ```yaml
      version: v2
      inputs:
        - directory: proto
      plugins:
        - remote: buf.build/protocolbuffers/go:<version>
          revision: <revision>
          out: gen/go
          opt:
            - paths=source_relative
      ```
      
      Each plugin selects exactly one execution type: `remote`, `local`, or `protoc_builtin`. Configure `out`, `opt`, `strategy`, input/type filters, and import inclusion according to the plugin contract.
      
      Use the default filename for the ordinary complete generation pipeline. Create `buf.gen.<domain>.yaml` only when one repository intentionally separates outputs such as server SDKs, web SDKs, documentation, or offline generation. Invoke it explicitly:
      
      ```sh
      buf generate --template buf.gen.web.yaml
      ```
      
      Do not create many templates merely to avoid understanding one configuration.
      
      ## Dependencies and Lock State
      
      After changing `deps`:
      
      ```sh
      buf dep update
      buf dep graph --format json
      git diff -- buf.yaml buf.lock
      ```
      
      Never hand-edit `buf.lock`. Treat unexpected commit/digest movement as a dependency change that requires review.
      
      To inspect a dependency schema without relying on cache internals:
      
      ```sh
      export_dir="$(mktemp -d)"
      buf export buf.build/<owner>/<module>:<pinned-ref> \
        --path path/inside/module.proto \
        --output "$export_dir"
      ```
      
      Clean up `export_dir` after inspection.
      
      ## Generated Output Paths
      
      Keep generated paths aligned with Protobuf import/package paths and language conventions. Use `paths=source_relative`, managed mode, or language-specific module options only after inspecting existing consumers. Do not flatten or relocate output without updating imports, packaging, CI, and downstream clients intentionally.
      
  • SKILL.md 4 KB
    ---
    name: use-buf
    description: Configure, inspect, update, validate, and troubleshoot Buf workspaces and modules. Use when working with buf.yaml, buf.lock, buf.gen.yaml or domain-specific Buf generation templates; managing BSR dependencies; formatting, linting, generating, detecting breaking Protobuf changes; locating dependency schemas; or diagnosing missing types and generation failures.
    ---
    
    # Use Buf
    
    Use the Buf CLI as the source of truth for Protobuf compilation, dependency resolution, linting, breaking-change detection, and code generation.
    
    ## Inspect Before Changing
    
    1. Read repository instructions.
    2. Search the repository root and likely API directories for `buf.yaml`, `buf.lock`, `buf.gen.yaml`, and `buf.gen.<domain>.yaml` files.
    3. Inspect the configuration version, module paths, dependency declarations, lint policy, breaking policy, inputs, plugin pins, output paths, and existing generation scripts.
    4. Run `buf --version` and check repository/CI tool pins before using features from a newer configuration schema.
    5. Diagnose configuration or dependency problems before changing `.proto` files to work around them.
    
    Use one default `buf.gen.yaml`. Introduce `buf.gen.<domain>.yaml` only when generation products genuinely require isolated plugin sets, inputs, or outputs. Pass non-default templates explicitly with `buf generate --template <file>`.
    
    ## Keep Configuration Responsibilities Clear
    
    - Use `buf.yaml` for workspaces/modules, BSR dependencies, lint rules, breaking rules, policies, and Buf check plugins.
    - Use `buf.gen.yaml` or `buf.gen.<domain>.yaml` for `protoc-gen-*` code-generation plugins, inputs, output directories, options, and managed mode.
    - Use `buf.lock` as generated dependency resolution state. Do not edit it manually.
    - Keep configuration in the repository root or the established API workspace directory unless repository structure requires otherwise.
    
    Read [references/configuration.md](references/configuration.md) before adding modules, dependencies, check plugins, generation templates, or output paths.
    
    ## Manage Dependencies Deliberately
    
    - Prefer BSR modules for maintained dependencies, including Google APIs, well-known types, Protovalidate, and grpc-gateway annotations.
    - Add or remove dependencies in `buf.yaml`, then run `buf dep update` and inspect the `buf.lock` diff.
    - Use `buf dep graph --format json` to identify the resolved dependency chain.
    - Use `buf dep prune` only after confirming an import is genuinely unused.
    - When a type appears missing, inspect configuration and the lockfile, run `buf dep update`, then run `buf build` or `buf generate` to obtain the compiler's concrete import/type error.
    - Never hardcode an operating system's Buf cache location. Export the pinned module with `buf export` when source inspection is required.
    
    ## Required Validation
    
    After changing first-party Protobuf or Buf configuration, MUST run:
    
    ```sh
    buf lint
    buf generate
    buf breaking --against '.git#branch=main'
    ```
    
    Also run `buf format --diff` or the repository's format check and all language-specific tests/type checks for generated outputs.
    
    Do not skip the breaking check merely because a break is intentional. Run it, capture the violations, and report that the change is an approved experimental/unreleased break. If the repository does not have a `main` branch, report that exact baseline failure and resolve the intended integration baseline rather than silently omitting compatibility validation.
    
    ## Diagnose in Dependency Order
    
    1. Confirm the current directory and discovered `buf.yaml`.
    2. Confirm module paths and import paths.
    3. Confirm dependencies and `buf.lock` with `buf dep graph`.
    4. Compile with `buf build`.
    5. Lint with `buf lint`.
    6. Generate with the selected template.
    7. Inspect plugin stderr, output collisions, and generated diffs.
    8. Run the breaking check against main.
    
    Use `$use-buf-plugins` for remote/local plugin selection, offline generation, rate limits, or plugin wrappers. Read [references/commands-and-troubleshooting.md](references/commands-and-troubleshooting.md) for precise inspection commands and failure handling.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related