golang
Skill17 starsChanged 51 days agoMITView on GitHub
Go development: conventions, architecture, concurrency, performance, and code review. Use when working with .go files, go.mod, or user asks about goroutines, channels, error handling, interfaces.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- speakeasy-api/gramtheir own version, first seen Nov 6, 2026
- its-ash/skillstheir own version, first seen Nov 1, 2026
- rogue-dev-studio/ai-agents-roguetheir own version, first seen Nov 1, 2026
- lrstanley/skillstheir own version, first seen Nov 1, 2026
- turkeryildirim/ai-skillstheir own version, first seen Nov 1, 2026
- bsene/skillstheir own version, first seen Oct 25, 2026
Used with
Projects with it also use clean-code and review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xenitV1Skillclean-code
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
Also in 3 projects that use this
SentrySkillreview
Fixture review skill.
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- JanDeDobbeleer/oh-my-posh★ 24ksame name
- speakeasy-api/gram★ 277same name
- saisudhir14/claude-skills★ 8same name
- bsene/skills★ 7same name
- malinskibeniamin/skills★ 4same name
- turkeryildirim/ai-skills★ 4same name
- KailasMahavarkar/agentic-skills★ 2same name
- rogue-dev-studio/ai-agents-rogue★ 2same name
- squall-chua/skills★ 2same name
- amirex128/backend_golang_skills★ 1same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository37 other files it gives its agents.
- adrSkill
- android-kotlinSkill
- apple-swiftSkill
- autoresearch-promptSkill
- blog-writerSkill
- cloud-infrastructureSkill
- commitSkill
- cover-imageSkill
- freezeSkill
- gemini-reviewSkill
- harness-mechanicSkill
- harness-traceSkill
- humanizerSkill
- ios-debuggerSkill
- knowledge-syncSkill
- learning-docsSkill
- learning-loopSkill
- obsidianSkill
- orchestratorSkill
- plan-forgeSkill
- process-clippingsSkill
- project-analyzerSkill
- project-checksSkill
- pr-reviewSkill
- pythonSkill
- railsSkill
- react-nextjsSkill
- refine-requirementsSkill
- releasing-softwareSkill
- rubySkill
- scoreSkill
- second-opinionSkill
- skill-forgeSkill
- source-controlSkill
- terraformSkill
- test-design-reviewerSkill
- verify-frontendSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
Errors: Always handle (never _). Wrap: fmt.Errorf("decompress %v: %w", name, err).
- Distinctive: line 108
Always know WHEN and HOW a goroutine terminates
- Distinctive: line 109
Libraries are synchronous: never launch goroutines from lib code unless concurrency IS the feature
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ABOUTME: Complete Go development guide - code, design, concurrency, performance, review
ABOUTME: Conventions, error layering, concurrency rules, modern stdlib preferences
Go Development
Quick Reference
gofmt -w . && goimports -w . && go fix ./... && go vet ./...
go test ./... && go test -race ./... && go test -cover ./...
govulncheck ./...
go build -pgo=cpu.pprof -o bin/app ./cmd/app
golangci-lint runSee also: _AST_GREP.md, _PATTERNS.md, source-control
Version (determine, don't assume)
See ../_LANG_COMMON.md. Fetch the truth:
go version # project toolchain (for existing repos: also check go.mod)
curl -s https://go.dev/VERSION?m=text | head -1 # latest upstream stable (for new projects)Pre-Commit Verification (MANDATORY)
make check && make test-e2e must pass (enforced by the pre-commit-gate hook; see ../_LANG_COMMON.md). What make check expands to for Go:
gofmt -w . # Fix formatting FIRST (sqlc/codegen can misalign)
go fix ./... && go fix ./... # Run twice for synergistic fixes
go vet ./... # Static analysis
go build ./... # Compilation check
go test -race -count=1 ./... # Tests with race detector
govulncheck ./... # Reachable vulnerability scan
golangci-lint run # LintWhy gofmt before build: Code generators (sqlc, protoc) may produce code gofmt disagrees with. Always run gofmt -w after regeneration and before commit.
go fix modernizers are version-gated by go.mod. Preview with go fix -diff ./.... List with go tool fix help.
Code Conventions
Formatting: gofmt/goimports on every change (make check fails on unformatted files).
Errors: Always handle (never _). Wrap: fmt.Errorf("decompress %v: %w", name, err). Lowercase, no punctuation, guard clauses. Never wrap io.EOF (callers use ==).
Error layering: Repo wraps infra errors with context. Service translates to domain sentinels (ErrUserNotFound, ErrInsufficientFunds). Handler maps sentinels to HTTP/gRPC codes. Log errors only at system boundaries (handlers, consumers, workers), not at every layer.
// Domain sentinels
var ErrUserNotFound = errors.New("user not found")
// Service: translate infra → domain
if errors.Is(err, sql.ErrNoRows) { return nil, ErrUserNotFound }
// Handler: map domain → HTTP
if errors.Is(err, ErrUserNotFound) { http.Error(w, "not found", 404); return }Structured errors (APIs only): For HTTP/gRPC APIs needing machine-readable error codes in responses, define an AppError type with Code/Message/wrapped cause. Not needed for CLIs, workers, or internal packages: use sentinels + %w wrapping.
Testing: Table-driven with t.Run(), t.Helper() in helpers, t.Context() for cancellation.
Function literals: Extract complex callbacks into named vars. Nested literals around slices/maps/iterators hurt readability fast.
Build tags for simulation: //go:build simulation in driver_sim.go, //go:build !simulation in driver_real.go. Same type, different impl. Use for hardware, external APIs, infra deps.
Architecture & Design
Project structure:
cmd/api-server/main.go # Entry points
internal/domain/ # Business entities
internal/service/ # Use cases
internal/repository/ # Data accessOrganize by feature/domain, not technical layer. Avoid /src, /utils, /common, /helpers.
Functional Options: preferred for optional configuration (WithX(...) Option + NewServer(opts ...Option)).
Constructor Injection: Accept interfaces, return structs. No global mutable state: pass deps explicitly.
Interfaces: Small (1-3 methods).
Concurrency
Golden Rules:
- Always know WHEN and HOW a goroutine terminates
- Libraries are synchronous: never launch goroutines from lib code unless concurrency IS the feature
errgroup (preferred over WaitGroup), context always first param, bounded pools for load, sender closes channels.
Cancellation traps (review these explicitly, they pass tests and hang/panic in prod):
for x := range chover an externally-produced channel (network stream, LLM provider) has noctx.Done()injection point. If the producer hangs, the consumer hangs forever. Useselect { case x, ok := <-ch: ...; case <-ctx.Done(): return }. Barerangeis fine only when you own the channel's lifecycle and it is guaranteed to close.nilpassed as acontext.Contextargument:<-nilin a select never fires, so cancellation silently does nothing (andParseSSE(nil, ...)-style calls panic on first cancel in prod). Grep fornilcontext args.- Unbuffered hub/notify channels that block forever if the receiving goroutine has already exited (shutdown deadlock). Pair every blocking send with a
selectonctx.Done(). - A goroutine writing a shared buffer (
bytes.Buffer) that another path reads: data race in tests, corruption in prod.
For detailed concurrency patterns, performance optimization, profiling, and code review checklists, see references/golang-patterns.md.
Resources
Effective Go | Code Review Comments | Release Notes | goperf.dev | fgprof
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

