code-generation

Automates Go boilerplate code generation via `go:generate` with `genny`.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/baphled/dotopencode --skill code-generation-baphled
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-generation
Source: https://github.com/baphled/dotopencode/tree/main/skills/code-generation
Command: npx skills add https://github.com/baphled/dotopencode --skill code-generation-baphled

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines Go development by automating the generation of repetitive boilerplate code, reducing manual effort and potential errors.

Core Features & Use Cases

  • Mock Generation: Automatically create mock implementations for interfaces using mockgen.
  • Enum Stringer: Generate string representations for Go enums using stringer.
  • Template-Based Generation: Utilize custom Go templates for generating repetitive code patterns.
  • Use Case: When you define a new interface for a repository, use this skill to automatically generate its mock version, ensuring your tests are up-to-date without manual coding.

Quick Start

Use the code-generation skill to generate mocks for the UserRepository interface.

Frequently Asked Questions about code-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Go boilerplate code generation for mocks and enums?

Automate Go boilerplate code generation by using the go:generate tool alongside mockgen for interface mocks and stringer for enum string representations, reducing manual effort and enforcing consistency.

What is the best way to generate mocks for Go interfaces?

Generating mocks for Go interfaces is best handled by the mockgen utility orchestrated through go:generate, which automatically creates mock implementations to keep your tests up-to-date without manual coding.

How does go:generate work with stringer for Go enum string representations?

Go:generate works with stringer by automatically executing the stringer tool to generate string representations for Go enums, eliminating repetitive manual coding and enforcing consistent formatting across your project.

Can I use custom Go templates for generating repetitive code patterns?

Yes, you can use custom Go templates for generating repetitive code patterns, enabling template-based generation that addresses specific repetitive coding tasks in Go development while maintaining maintainability.

Do I need any external dependencies to use go:generate for code generation?

No external dependencies are required to use this code generation approach, as the Skill relies on the standard go:generate tool and associated utilities like mockgen and stringer without additional package dependencies.

When should I automate Go boilerplate generation instead of writing code manually?

You should automate Go boilerplate generation when you define new interfaces for repositories or need consistent enum string representations, ensuring tests stay up-to-date and avoiding potential manual coding errors.