z-go-interfaces
Installation
SKILL.md
Go Interfaces & Type Design
Interface design
Keep interfaces focused. Prefer small consumer contracts; split unrelated capabilities rather than enforcing a universal method count:
type Reader interface{ Read(p []byte) (n int, err error) }
type Writer interface{ Write(p []byte) (n int, err error) }
type ReadWriter interface{ Reader; Writer }
Prefer consumer-owned interfaces. Define a narrow contract where its caller needs it:
// package notification — only what it needs
type Sender interface{ Send(to, body string) error }