go-architect
Go application architecture with net/http 1.22+ routing, project structure patterns, graceful shutdown, and dependency injection. Use when building Go web servers, designing project layout, or structuring application dependencies.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anderskev/go-architectLead Go Architect
Quick Reference
| Topic | Reference |
|---|---|
| Flat vs modular project layout, migration signals | references/project-structure.md |
| Graceful shutdown with signal handling | references/graceful-shutdown.md |
| Dependency injection patterns, testing seams | references/dependency-injection.md |
Core Principles
- Standard library first -- Use
net/httpand the Go 1.22+ enhancedServeMuxfor routing. Only reach for a framework (chi, echo, gin) when you have a concrete need the stdlib cannot satisfy (e.g., complex middleware chains, regex routes). - Dependency injection over globals -- Pass databases, loggers, and services through struct fields and constructors, never package-level
var. - Explicit over magic -- No
init()side effects, no framework auto-wiring.main.gois the composition root where everything is assembled visibly. - Small interfaces, big structs -- Define interfaces at the consumer, keep them narrow (1-3 methods). Concrete types carry the implementation.
Hard gates
Use this sequence when implementing or reviewing work that claims to follow this skill. Do not skip ahead; each step has a pass condition you can answer with tooling or a concrete file path.
- Toolchain vs APIs — If the code uses Go 1.22+
ServeMuxfeatures (method+path patterns like"GET /x/{id}",r.PathValue, or{path...}): rungo versionand pass only if the reported toolchain is go1.22+. If the project must stay on an older Go, pass only by not using those APIs (use a compatible router or older patterns) and say so in the review or PR. - Composition root — Pass when
main.goorcmd/.../main.govisibly constructs the server and injects shared dependencies (DB, logger, config). Fail if shared dependencies are wired ininit()or package-levelvarinstead of explicit construction inmain(or arun()called frommain). - Production HTTP shutdown — For a long-lived HTTP service, pass only if shutdown uses
http.Server.Shutdownwith a bounded context (e.g.context.WithTimeout) after waiting onsignal.NotifyContext(or equivalent). Cite the file path when reporting; see references/graceful-shutdown.md for the full pattern. - No env/globals in handlers — Pass when handlers and domain code take dependencies via structs/arguments. Fail if handlers read
os.Getenvfor secrets or use package-levelvarfor DB/clients (loading env inmainor a dedicated config package is fine).
Go 1.22+ Enhanced Routing
Go 1.22 upgraded http.ServeMux with method-based routing and path parameters, eliminating the most common reason for third-party routers.
Method-Based Routing and Path Parameters
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anderskev-go-architect": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
tutorial-docs
Tutorial patterns for documentation - learning-oriented guides that teach through guided doing
fetch-pr-feedback
Fetch review comments from a PR and evaluate with receive-feedback skill
swift-testing-code-review
Reviews Swift Testing code for proper use of
rust-testing-code-review
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Covers Rust 2024 edition changes including async fn in traits for mocks,
explanation-docs
Explanation documentation patterns for understanding-oriented content - conceptual guides that explain why things work the way they do