golang-pro

Implements Go 1.21+ microservices, concurrency patterns, and performance profiling workflows.

Updated Aug 19, 2026
One-click install
npx skills add https://github.com/nperepichka/Antigravity --skill golang-pro-nperepichka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: golang-pro
Source: https://github.com/nperepichka/Antigravity/tree/main/config/skills/golang-pro
Command: npx skills add https://github.com/nperepichka/Antigravity --skill golang-pro-nperepichka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing production-grade Go services requires deep knowledge of generics, goroutine lifecycle management, clean architecture, and runtime profiling. This Skill provides structured reference material and canonical code patterns so you avoid data races, goroutine leaks, memory bloat, and architectural coupling when building Go systems. ## Core Features & Use Cases - Modern Language Features: Covers Go 1.21+ built-ins, generics with type constraints, the slices/maps/cmp packages, and structured logging with log/slog including context-aware trace handlers. - Concurrency Patterns: Provides production-ready worker pools, fan-out/fan-in pipelines, errgroup with concurrency limits, and sharded concurrent maps, plus race detection and deadlock diagnostics. - Microservices Architecture: Defines standard project layout, graceful shutdown for dual HTTP/gRPC servers, middleware composition, domain error mapping to HTTP/gRPC status codes, and constructor-based dependency injection. - Performance Optimization: Includes pprof profiling endpoints, micro-benchmarking with b.ResetTimer, sync.Pool patterns, zero-allocation string/byte conversions, and GC tuning via GOGC and GOMEMLIMIT. - Use Case: When building a Go microservice that must handle thousands of concurrent requests, use this Skill to wire graceful shutdown, implement a bounded worker pool, and profile heap allocations before deployment. ## Quick Start Ask the agent to design a Go worker pool with context cancellation and graceful shutdown for your service, or to review your Go code for race conditions and allocation hotspots.

Frequently Asked Questions about golang-pro

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a worker pool in Go with context cancellation?▼

Create a jobs channel, spawn a fixed number of goroutines that range over it, and select on ctx.Done() inside each worker loop. Close the results channel after a sync.WaitGroup completes so consumers terminate cleanly.

How to detect and fix data races in Go programs?▼

Run go test -race ./... in CI to detect concurrent read/write access to shared variables. Fix races by guarding state with sync.Mutex or sync.RWMutex, using sync/atomic operations, or passing ownership through channels.

What is the standard Go project layout for microservices?▼

Use /cmd for entrypoints, /internal/domain for dependency-free business logic, /internal/ports for interfaces, /internal/adapters for database and transport implementations, and /pkg for reusable public libraries. Domain code must never import transport or database frameworks.

Does Go support generic methods on structs?▼

No, Go does not support generic methods on structs. Methods can only use type parameters declared on the receiver struct itself; if a method needs a new type parameter, write it as a standalone package-level generic function.

How do I reduce memory allocations in hot Go code paths?▼

Profile first with pprof heap and allocs endpoints, then apply sync.Pool for reusable buffers, preallocate slices with known capacity, and use unsafe zero-copy string-to-byte conversions where mutation is not required. Always reset pooled objects before returning them.

When should I use GOMEMLIMIT instead of GOGC in Go?▼

Use GOMEMLIMIT to set a hard memory ceiling in containerized deployments so the runtime triggers GC proactively before an OOM kill. Leave a 10-15% buffer below the container limit, and keep GOGC for throughput-versus-memory tradeoffs.