← ClaudeAtlas

golisted

Go project layout, HTTP handlers, interfaces, goroutines, error wrapping, table-driven tests, slog logging
Claudient/Claudient · ★ 4 · AI & Automation · score 65
Install: claude install-skill Claudient/Claudient
# Go Skill ## When to activate - Building a Go HTTP service or CLI tool - Structuring a Go project with `cmd/`, `internal/`, `pkg/` - Writing HTTP handlers with `net/http`, chi, or gin - Implementing interfaces, embedding, and composition patterns - Writing concurrent code with goroutines, channels, and `sync` primitives - Error handling, wrapping, and sentinel errors - Writing table-driven tests ## When NOT to use - Node.js, Python, or other language services — different ecosystems - Protobuf/gRPC services without prior gRPC setup context - Pure scripting tasks — shell or Python are better fits ## Instructions ### Project layout ``` myapp/ ├── cmd/ │ └── server/ │ └── main.go # Entry point — thin, just wires and starts ├── internal/ # Private packages — not importable externally │ ├── config/ │ ├── handler/ │ ├── service/ │ └── store/ ├── pkg/ # Public packages — importable by other modules │ └── apierr/ ├── go.mod └── go.sum ``` ### main.go — wiring only ```go // cmd/server/main.go package main import ( "context" "log/slog" "net/http" "os" "os/signal" "syscall" "time" "myapp/internal/config" "myapp/internal/handler" "myapp/internal/store" ) func main() { cfg := config.MustLoad() db := store.MustConnect(cfg.DatabaseURL) defer db.Close() mux := handler.NewMux(db, cfg) srv := &http.Server{ Addr: ":" + cfg.Port, Handler: m