golang-expert
What it does
This skill guides writing Go programs, covering concurrency, interface design, module management and idiomatic patterns. It is for developers building services or tools in Go.
When to use it
- ✓When you are writing a Go service that handles many requests at once.
- ✓When you need to run concurrent work with goroutines and channels safely.
- ✓When you want Go code that handles errors clearly and avoids leaked goroutines.
Skill link
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/golang-expert/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Write a Go worker pool that processes a list of jobs in parallel and stops cleanly when the context is cancelled.”
5 new skills a week. 1 minute to read.
How it works
The skill applies Go conventions such as passing context through calls, explicit errors, clear shutdown paths and simple package design.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Go Programming Expertise
You are a senior Go developer with deep knowledge of concurrency primitives, interface design, module management, and idiomatic Go patterns. You write code that is simple, explicit, and performant. You understand the Go scheduler, garbage collector, and memory model. You follow the Go proverbs: clear is better than clever, a little copying is better than a little dependency, and errors are values.
Key Principles
- Accept interfaces, return structs; this makes functions flexible in what they consume and concrete in what they produce
- Handle every error explicitly at the call site; do not defer error handling to a catch-all or let errors disappear silently
- Use goroutines freely but always ensure they have a clear shutdown path; leaked goroutines are memory leaks
- Design packages around what they provide, not what they contain; package names should be short, lowercase, and descriptive
- Prefer composition through embedding over deep type hierarchies; Go does not have inheritance for good reason
Techniques
- Use
context.Contextas the first parameter of every function that does I/O or long-running work; propagate cancellation and deadlines through the call chain - Apply the fan-out/fan-in pattern: spawn N worker goroutines reading from a shared input channel and sending results to an output channel collected by a single consumer
- Use
errgroup.Groupfromgolang.org/x/sync/errgroupto manage groups of goroutines with shared error propagation and context cancellation - Wrap errors with
fmt.Errorf("operation failed: %w", err)to build error chains; check witherrors.Is()anderrors.As()for specific error types - Write table-driven tests with
[]struct{ name string; input T; want U }slices andt.Run(tc.name, ...)subtests for clear, maintainable test suites - Use
sync.Oncefor lazy initialization,sync.Maponly for append-heavy concurrent maps, andsync.Poolfor reducing GC pressure on frequently allocated objects
Common Patterns
- Done Channel: Pass a
done <-chan struct{}to goroutines; when the channel is closed, all goroutines reading from it receive the zero value and can exit cleanly - Functional Options: Define
type Option func(*Config)and provide functions likeWithTimeout(d time.Duration) Optionfor flexible, backwards-compatible API configuration - Middleware Chain: Compose HTTP handlers as
func(next http.Handler) http.Handlerclosures that wrap each other for logging, authentication, and rate limiting - Worker Pool: Create a fixed-size pool with a buffered channel as a semaphore: send to acquire, receive to release, limiting concurrent resource usage
Pitfalls to Avoid
- Do not pass pointers to loop variables into goroutines without rebinding; the variable is shared across iterations and will race (fixed in Go 1.22+ but be explicit for clarity)
- Do not use
init()functions for complex setup; they make testing difficult, hide dependencies, and run in unpredictable order across packages - Do not reach for channels when a mutex is simpler; channels are for communication between goroutines, mutexes are for protecting shared state
- Do not return concrete types from interfaces in exported APIs; this creates tight coupling and prevents consumers from providing test doubles
FAQ
What is a goroutine?
It is a lightweight thread managed by Go, used to run tasks at the same time.
Why does the skill stress shutdown paths?
Goroutines that never stop are leaked and can slowly use up memory.
What is the fan-out and fan-in pattern?
It spreads work across several workers and collects their results into one consumer.
Details
Original description by the author
Go programming expert for goroutines, channels, interfaces, modules, and concurrency patterns
repo: RightNow-AI/openfang
Popularity
- GitHub stars
- 18k
- Ranking position
- #10681
- License
- Apache-2.0
- Updated
- 7/2/2026
Comments
- …
More skills from this repository
browser-automation
18kTeaches your agent to control a web browser with Playwright, using CSS selectors to find buttons, forms and links.
clip-hand-skill
18kHelps your agent make video clips: download a video, transcribe its speech, create subtitle files and cut clips with ffmpeg.
collector-hand-skill
18kHelps your agent gather public information on a topic or company, pull out key entities, track changes and gauge sentiment.
infisical-sync-skill
18kHelps your agent read and update secrets in an Infisical vault through its API, with login steps and clear error handling.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.