← ClaudeAtlas

go-architectlisted

Go 1.27.3 architectural standards — memory-aligned structs, typed enums, interface design, goroutine safety, iterators, idiomatic errors, package and adapter naming (client/<protocol>, postgres/, inbound <protocol> packages) with the shared cross-context vocabulary package, sqlx + //go:embed SQL pattern, go.work multi-module layout, and the two app-repo shapes for a Go module with a SPA (module at the root + web/, or backend/ + frontend/, module path, cmd/internal pairing). Use when writing, reviewing, or scaffolding Go code, naming or placing a shared package, or deciding where a Go module and its frontend live in a repo.
ralvarez-ai/ralvaskills · ★ 4 · Web & Frontend · score 77
Install: claude install-skill ralvarez-ai/ralvaskills
# Go Architecture & Domain Modeling Targets **Go 1.27.3**. See [STACK.md](STACK.md) for pinned dependency versions. ## 1. Constants & Enums - **Enums:** Custom types with `iota` and an implemented `String()` method. Avoid bare primitives. Use `1 << iota` for bitmasks. - **Errors:** Export package-level sentinel errors (`var ErrNotFound = ...`) for `errors.Is()`. Use `errors.Join` to aggregate multiple errors. - **Grouping:** When a file declares multiple `type`, `const`, or `var` at package level, consolidate each kind into a single parenthesized block (`type (...)`, `const (...)`, `var (...)`) rather than repeating the keyword. Keep unrelated groups separated by a blank line inside the block. - **File-level ordering:** type → const → var → func (decorder's default order). Enforced by the `decorder` linter (see §14). - **Magic values:** a bare numeric or string literal used more than once becomes a named constant. Enforced by `mnd` (numbers) and `goconst` (strings) (see §14). ## 2. Structures & Memory - **Design:** Explicit struct tags, standard audit fields, composition via embedding. Keep tag casing (`json`, `yaml`) consistent across the codebase — `tagliatelle` catches drift, opt-in and scoped since legacy tags often can't be renamed without a breaking change (see §14). - **Optimization:** Order fields largest → smallest to minimize padding. - **Semantics:** Pointers for mutation or mutex-protected state; values for small, immutable payloads. - **Validation:** `Valida