go-options-gen
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 inoptions_generated.go. - Multiple Option Sets: For a component named
MyService, the struct (e.g.,MyServiceOptions) MUST be inmyservice_options.go, and generated code MUST be inmyservice_options_generated.go.
- Single Option Set: Struct definition MUST be in
- 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.modusing:go get -tool github.com/kazhuravlev/options-gen/cmd/options-gen@latest
- Always run the tool using
- Validation:
- Always include validation tags (using
go-playground/validatorsyntax) for configuration fields.
- Always include validation tags (using
More from metalagman/agent-skills
gitflow
Use this skill when managing git branches, releases, or hotfixes according to the Gitflow workflow. It enforces naming conventions and synchronization policies.
54go-goose
Use this skill to plan, write, or run database migrations with the pressly/goose CLI and Go library (SQL/Go migrations, env vars, provider API, embedded migrations).
27go-uber-style-guide
Use this skill to write, refactor, or review Go code according to the Uber Go Style Guide. It ensures strict adherence to correctness, safety, and idiomatic patterns.
23beads
Use this skill to manage work in Beads (`bd`) 1.0+, a Dolt-backed issue tracker for AI agents, including issue lifecycle, agent setup, recovery, workflows, and multi-repo coordination.
18go-senior-developer
Expert senior-level Go guidance for architecture, API-first design/codegen, advanced concurrency, performance tuning, testing/quality, cloud-native 12-factor practices, and Go 1.24+ tooling for large-scale systems.
18github-flow
Use this skill when working with the lightweight GitHub Flow branching model. Ideal for projects with continuous deployment where 'main' is always deployable.
17