tannhatcms/jarvis/ams-go-pro
Claude Code and agent skill by tannhatcms/jarvis
- community
Checking that the SKILL.md file is still in the repository.
Idiomatic Go: project layout, error handling, concurrency with goroutines/channels, interfaces, and tooling. Use when writing, reviewing, or structuring Go programs and services.
Install
npx vskill@latest install tannhatcms/jarvis/ams-go-proSKILL.md
The same SKILL.md was published earlier as tannhatcms/jarvis/ams-go-pro.
Go Pro
Overview
Go rewards simplicity and explicitness: small interfaces, explicit error handling, and concurrency as a first-class but carefully-managed tool. The best Go code is boring in the best way — obvious control flow, minimal abstraction, and the standard library doing heavy lifting.
This skill covers professional Go: module layout, error handling philosophy, goroutine/channel patterns, interface design, and the tooling (go vet, gofmt, linters) that keeps Go codebases uniform and reliable.
When to use
- Starting or structuring a Go module/service.
- Writing or reviewing Go for idiom and correctness.
- Designing concurrency (goroutines, channels, worker pools).
- Handling errors, context propagation, and graceful shutdown.
- Setting up linting, testing, and CI for Go.
Core concepts
- Errors are values. Return them, check them, wrap them with context (
fmt.Errorf("…: %w", err)).
Sentinel errors for expected cases, custom types when callers must distinguish. Never ignore an error without a comment saying why (_ = f.Close() on read-only files is the rare exception).
- Interfaces: small and consumer-defined. Accept interfaces, return structs. The
io.Reader/
io.Writer philosophy: one- or two-method interfaces defined where used, not where implemented. Empty interfaces (any) in APIs push type problems to runtime — constrain with generics or concrete types.
- Concurrency: share memory by communicating. Goroutines + channels for orchestration;
sync
primitives for shared state. context.Context carries cancellation/deadlines through call chains — always the first parameter, never stored in structs. Worker pools bound concurrency; errgroup manages fan-out/fan-in with error propagation.
- Project layout (standard-ish).
cmd/<app>/main.go(thin),internal/for private packages,
pkg/ only for genuinely reusable libraries. Flat is fine for small services — don't create twelve packages for 2,000 lines. Package names: short, lowercase, no underscores (httpx not http_utils).
- Defer for cleanup, and mind loop gotchas.
deferruns LIFO at function return — perfect for
Close/Unlock. In Go 1.22+ loop variables are per-iteration (the old capture bug is gone), but know your toolchain version when reading older code.
- Testing is built in. Table-driven tests,
t.Runsubtests,testifyoptional but common,
httptest for handlers, -race in CI always. Benchmarks (BenchmarkXxx) for hot paths.
Practical workflow
- Scaffold:
go mod init <module>,cmd/+internal/layout,.golangci.ymlwith a
curated linter set, go vet + gofmt -l in CI (gofmt diff = fail).
- Write the happy path first, then handle every error return explicitly. Wrap with context
at boundaries (where you have the most information), check/log at the top.
- Thread `context.Context` through I/O paths; respect cancellation in loops and workers;
set timeouts on outbound calls (http.Client{Timeout: …}).
- Concurrency pattern selection:
- Fan-out/fan-in with results →
errgroup.Group+ channels. - Bounded parallelism → worker pool with buffered channel.
- Periodic work →
time.Ticker+ context cancellation, nottime.Sleeploops. - Never leak goroutines: every spawned goroutine must have an exit path.
- Graceful shutdown. Catch SIGTERM/SIGINT → cancel root context → stop accepting → drain
in-flight with a timeout → exit. http.Server.Shutdown(ctx) exists; use it.
- Review checklist: errors wrapped with context, no ignored errors, contexts plumbed,
goroutine exit paths, no data races (go test -race), exported symbols documented.
Idiomatic snippets:
Common pitfalls
- Ignoring errors.
val, _ := strconv.Atoi(s)sprinkled everywhere. Handle or document why not. - Goroutine leaks. Spawning goroutines blocked forever on channel sends with no receiver.
Every goroutine needs a ctx.Done() / close-channel exit.
- Copying locks. Passing
sync.Mutexby value (go vet flags it). Use pointers for structs
containing locks; go vet in CI catches this.
- Interface pollution.
type Service interface { 25 methods }— huge interfaces are hard to
mock and hard to implement. Small interfaces, composed as needed.
- Premature optimization with sync. Reaching for atomics and lock-free tricks before profiling.
A plain mutex is fast; correctness first, pprof second.
- Global state. Package-level
var db *sql.DBmutated in tests causes order-dependent flakes.
Inject dependencies; keep globals read-only after init.
- Not running `-race`. Data races are silent until production.
go test -race ./...in CI,
always — it's the cheapest concurrency bug-finder in the industry.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ams-go-pro/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tannhatcms/jarvis/ams-go-pro)