golang-structs-interfaces

golang structs interfaces

samber ↓ 33k
Claude Code
View source ↗

What it does

  • → See samber/cc-skills-golang@golang-naming skill for interface naming conventions (Reader, Closer, Stringer)
  • → See samber/cc-skills-golang@golang-design-patterns skill for functional options, constructors, and builder patterns
  • → See samber/cc-skills-golang@golang-dependency-injection skill for DI patterns using interfaces
  • → See samber/cc-skills-golang@golang-code-style skill for value vs pointer function parameters (distinct from receivers)

Requirements & configuration

  • Interfaces SHOULD have 1-3 methods. Small interfaces are easier to implement, mock, and compose. If you need a larger contract, compose it from small interfaces:
  • // package notification — defines only what it needs
  • The email package exports a concrete Client struct — it doesn't need to know about Sender.
  • // Bad — zero value is broken, requires constructor
  • | Named field | You only need the inner type internally — the outer type "has a" dependency |

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

golang structs interfaces

Source

Repository: https://github.com/samber/cc-skills-golang

golang-structs-interfaces FAQ

What does the golang-structs-interfaces skill do?

Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via interfaces, struct field tags, and pointer vs value receivers. Use this skill when designing Go types, defining or implementing interfaces, embedding structs or interfaces, writing type assertions or type switches, adding struct field tags for JSON/YAML/DB serialization, or choosing between pointer and value receivers. Also use when the user asks about "accept interfaces, return structs", compile-time interface checks, or composing small interfaces into larger ones. → See samber/cc-skills-golang@golang-naming skill for interface naming conventions (Reader, Closer, Stringer) → See samber/cc-skills-golang@golang-design-patterns skill for functional options, constructors, and builder patterns

What does golang-structs-interfaces require?

Interfaces SHOULD have 1-3 methods. Small interfaces are easier to implement, mock, and compose. If you need a larger contract, compose it from small interfaces: // package notification — defines only what it needs The email package exports a concrete Client struct — it doesn't need to know about Sender. // Bad — zero value is broken, requires constructor | Named field | You only need the inner type internally — the outer type "has a" dependency |

How do I install golang-structs-interfaces?

Run: npx -y skills add https://github.com/samber/cc-skills-golang --skill golang-structs-interfaces --agent claude-code — the source lives at github.com/samber/cc-skills-golang.

Maintain golang-structs-interfaces?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

golang-structs-interfaces on getagentictools
[![golang-structs-interfaces on getagentictools](https://getagentictools.com/badge/skills/samber-cc-skills-golang-golang-structs-interfaces.svg)](https://getagentictools.com/skills/samber-cc-skills-golang-golang-structs-interfaces?ref=badge)
npx agentictools info skills/samber-cc-skills-golang-golang-structs-interfaces

The second line is the CLI lookup for this page — handy in READMEs and docs.