This skill enforces production-grade Go engineering. Output must reflect senior-level judgment: explicit, testable, and free of AI boilerplate or premature abstraction.
Input: Requirement + constraints (latency, concurrency, deployment, scale).
Engineering Thinking
Before coding, define:
- Purpose: Service, CLI, worker, or library? Dictates lifecycle & shutdown.
- Scope: Script vs. long-term system. Simplicity compounds; complexity decays.
- Constraints: Memory, latency, deployment target, concurrency model.
- Trade-offs: Explicit > clever. Measurable perf > speculative optimization.
CRITICAL: Every abstraction must prove its value in readability, testability, or maintainability.
Architecture & Design Principles
- Explicit Data Flow: Pass values, avoid hidden state. If it's needed, pass it. If it mutates, name it clearly.
- Interface Direction: Define interfaces where callers need them, not where implementers expose them.
- Stdlib First: Prefer
log/slog, context, errors, io/fs, net/http (1.22+). Justify any third-party dependency with a measurable stdlib gap.
- Boring & Predictable: Code should read like a technical spec: debuggable under load, maintainable by a team, and resilient to failure.
Core Engineering Rules
Naming & Structure
- Names: Short, contextual, idiomatic (
userID, fetchUser, ConfigLoader). Avoid data, manager, handler (except transport/). Good names remove comment debt.
- Layout:
/cmd → /internal/domain → /internal/service → /internal/repository → /internal/transport → /pkg (shared only). main.go stays minimal. Dependency flow is strictly inward. No business logic in transport/CLI layers.
- Generics: Use for type-safe containers/algorithms, never for DI, business logic, or premature abstraction.
Error & Context Handling
- Check every error. Never use
_. Wrap with %w (fmt.Errorf("fetch: %w", err)). Use errors.Join for concurrent/aggregated failures.
context.Context is always first. Never store it in structs. Propagate cancellation/deadlines to goroutines, DB, and HTTP calls.
Concurrency & Lifecycle
- Goroutines need explicit cleanup (
context or done channels). Prefer channels for coordination/backpressure. Use sync primitives only when profiling proves necessity.
- No shared mutable state without strict synchronization. Panic only at startup for fatal misconfiguration.
Observability, Testing & Quality
- Logging:
log/slog only. Attach request_id, duration, error. Levels: INFO (flow), WARN (degraded), ERROR (failure).
- Testing: Table-driven for logic. Use
t.Cleanup() for resource teardown. Mock via interfaces/httptest. Deterministic, isolated, no flaky network calls.
- Tooling:
gofmt, go vet, golangci-lint, govulncheck, go test ./.... All green before output.
Anti-Patterns to Reject
❌ Deep nesting (use early returns)
❌ Global state, singletons, package-level vars
❌ Magic strings/secrets in logic or configs
❌ Ignoring context cancellation or goroutine leaks
❌ any/interface{} where concrete types or generics suffice
❌ Premature optimization without pprof evidence
Output Requirements
- ✅ Complete, compilable, with
go.mod & run instructions
- ✅ Production-ready: context propagation, error wrapping, graceful shutdown, structured logging
- ✅ Tested: table-driven core logic, mocked boundaries,
t.Cleanup() teardown
- ✅ Documented: package-level godocs. Inline comments only for non-obvious invariants or perf-critical paths.
Final Principle
Good Go code is simple, explicit, and maintainable. It should feel inevitable, not clever. Every path must answer: What happens if this fails? How is it debugged in production?
Source: FranckRnt/gssh — distributed by TomeVault.
1---2name: golang-development3description: Create production-grade Go (Golang) systems with strong engineering standards, idiomatic design, and real-world architecture. Use this skill when the user asks to build APIs, CLI tools, services, concurrent systems, or backend components. Generates maintainable, well-structured, and non-generic Go code that reflects experienced engineering practices. Use when this capability is needed.4---56This skill enforces production-grade Go engineering. Output must reflect senior-level judgment: explicit, testable, and free of AI boilerplate or premature abstraction.78Input: Requirement + constraints (latency, concurrency, deployment, scale).910## Engineering Thinking1112Before coding, define:13- **Purpose**: Service, CLI, worker, or library? Dictates lifecycle & shutdown.14- **Scope**: Script vs. long-term system. Simplicity compounds; complexity decays.15- **Constraints**: Memory, latency, deployment target, concurrency model.16- **Trade-offs**: Explicit > clever. Measurable perf > speculative optimization.1718**CRITICAL**: Every abstraction must prove its value in readability, testability, or maintainability.1920---2122## Architecture & Design Principles2324- **Explicit Data Flow**: Pass values, avoid hidden state. If it's needed, pass it. If it mutates, name it clearly.25- **Interface Direction**: Define interfaces where callers need them, not where implementers expose them.26- **Stdlib First**: Prefer `log/slog`, `context`, `errors`, `io/fs`, `net/http` (1.22+). Justify any third-party dependency with a measurable stdlib gap.27- **Boring & Predictable**: Code should read like a technical spec: debuggable under load, maintainable by a team, and resilient to failure.2829---3031## Core Engineering Rules3233### Naming & Structure34- **Names**: Short, contextual, idiomatic (`userID`, `fetchUser`, `ConfigLoader`). Avoid `data`, `manager`, `handler` (except `transport/`). Good names remove comment debt.35- **Layout**: `/cmd` → `/internal/domain` → `/internal/service` → `/internal/repository` → `/internal/transport` → `/pkg` (shared only). `main.go` stays minimal. Dependency flow is strictly inward. No business logic in transport/CLI layers.36- **Generics**: Use for type-safe containers/algorithms, never for DI, business logic, or premature abstraction.3738### Error & Context Handling39- Check every error. Never use `_`. Wrap with `%w` (`fmt.Errorf("fetch: %w", err)`). Use `errors.Join` for concurrent/aggregated failures.40- `context.Context` is always first. Never store it in structs. Propagate cancellation/deadlines to goroutines, DB, and HTTP calls.4142### Concurrency & Lifecycle43- Goroutines need explicit cleanup (`context` or `done` channels). Prefer channels for coordination/backpressure. Use `sync` primitives only when profiling proves necessity.44- No shared mutable state without strict synchronization. Panic only at startup for fatal misconfiguration.4546### Observability, Testing & Quality47- **Logging**: `log/slog` only. Attach `request_id`, `duration`, `error`. Levels: `INFO` (flow), `WARN` (degraded), `ERROR` (failure).48- **Testing**: Table-driven for logic. Use `t.Cleanup()` for resource teardown. Mock via interfaces/`httptest`. Deterministic, isolated, no flaky network calls.49- **Tooling**: `gofmt`, `go vet`, `golangci-lint`, `govulncheck`, `go test ./...`. All green before output.5051---5253## Anti-Patterns to Reject5455❌ Deep nesting (use early returns)56❌ Global state, singletons, package-level vars57❌ Magic strings/secrets in logic or configs58❌ Ignoring `context` cancellation or goroutine leaks59❌ `any`/`interface{}` where concrete types or generics suffice60❌ Premature optimization without `pprof` evidence6162---6364## Output Requirements6566- ✅ Complete, compilable, with `go.mod` & run instructions67- ✅ Production-ready: context propagation, error wrapping, graceful shutdown, structured logging68- ✅ Tested: table-driven core logic, mocked boundaries, `t.Cleanup()` teardown69- ✅ Documented: package-level godocs. Inline comments only for non-obvious invariants or perf-critical paths.7071---7273## Final Principle7475Good Go code is simple, explicit, and maintainable. It should feel inevitable, not clever. Every path must answer: *What happens if this fails? How is it debugged in production?*7677---78> Source: [FranckRnt/gssh](https://github.com/FranckRnt/gssh) — distributed by [TomeVault](https://tomevault.io).79<!-- tomevault:4.0:skill_md:2026-06-16 -->