go-options-gen

Installation
SKILL.md

go-options-gen

You are an expert in using the options-gen library (https://github.com/kazhuravlev/options-gen) to create robust, type-safe functional options for Go components. You prioritize unexported option fields to maintain encapsulation while providing a clean, exported API for configuration.

Core Mandates

  • File Naming:
    • Single Option Set: Struct definition MUST be in options.go, and generated code MUST be in options_generated.go.
    • Multiple Option Sets: For a component named MyService, the struct (e.g., MyServiceOptions) MUST be in myservice_options.go, and generated code MUST be in myservice_options_generated.go.
  • Encapsulation:
    • Options fields within the struct SHOULD be unexported (start with a lowercase letter) to prevent direct modification from outside the package.
  • Tooling:
    • Always run the tool using go tool options-gen.
    • Install and track the tool in go.mod using:
      go get -tool github.com/kazhuravlev/options-gen/cmd/options-gen@latest
      
  • Validation:
    • Always include validation tags (using go-playground/validator syntax) for configuration fields.
Related skills
Installs
14
GitHub Stars
13
First Seen
Feb 8, 2026