What problem does it solve?
Helps you design Go structs and interfaces that stay maintainable and testable by applying proven rules for interface boundaries, embedding, type assertions, and serialization tags.
Core Features & Use Cases
- Interface design for maintainability: keep interfaces small (1–3 methods) and define them where they are consumed to preserve consumer control.
- Constructor return conventions: accept dependencies as interfaces for flexibility, but return concrete types (never interfaces) from constructors for clarity.
- Robust type-handling: use compile-time interface checks, safe comma-ok type assertions, type switches, and optional capabilities via type assertions instead of forcing all callers to implement extra methods.
- Struct design correctness: make zero values useful via lazy initialization, prefer generics over
any for type-safe operations, keep receiver types consistent, and prevent accidental copying with the noCopy sentinel.
- Embedding with intent: embed only when you want to expose the full inner API (“is a”), and use named fields when the dependency is internal (“has a”).
- Use cases: designing/implementing Go packages, refactoring existing type systems, reviewing interface/receiver/tag practices, and answering guidance questions like “accept interfaces, return structs” or “compile-time interface checks”.
Quick Start
Ask an AI to review your Go type and interface design decisions, including embedding vs named fields, interface placement, constructor signatures, type assertion safety, and struct tagging conventions.