agentleFS
belos-streetbelos-street/grimoire/skills/golang-best-practices/skill.md

golang-best-practices

Skill8 starsChanged 3 months agoMITView on GitHub

MUST be used for Go tasks. Covers Go 1.21+, standard library, Go modules, concurrency, performance optimization, testing, and WebAssembly (GOOS=js, GOARCH=wasm). Load for any .go files work.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Files
skill.md

Go best practices, common gotchas, and performance optimization. Includes WebAssembly development.

Project & Package

  • Standard Go project layout → See standard-go-project-layout
  • Go modules and dependency management → See go-mod-dependency-management
  • Go naming conventions → See go-naming-conventions

Error Handling

  • Go-style error handling patterns → See error-handling-patterns
  • Sentinel errors and error wrapping → See error-sentinel-wrapping
  • Recover and panic best practices → See error-recover-panic

Types & Memory

  • Value types vs pointers → See value-type-vs-pointer
  • Understanding nil in Go → See go-nil-handling
  • Memory management and GC → See memory-management-gc
  • Escape analysis → See escape-analysis

Concurrency

  • Goroutine lifecycle management → See goroutine-lifecycle
  • Channel patterns → See channel-patterns
  • Sync primitives (Mutex, RWMutex, Atomic) → See sync-primitives
  • Common concurrency pitfalls → See concurrency-pitfalls

Interfaces

  • Interface design principles → See interface-design
  • Dependency injection → See dependency-injection
  • Interface and nil → See interface-nil

Performance

  • String and []byte optimization → See string-byte-optimization
  • Slice tips and tricks → See slice-optimization
  • Map optimization → See map-optimization
  • Profiling with pprof → See pprof-usage

Testing

  • Table-driven tests → See table-driven-tests
  • Mocking techniques → See go-mocking
  • Benchmarking → See benchmarking

Tooling

  • Linting and formatting → See linting-formatting
  • Documentation with godoc → See godoc-best-practices
  • Build tags and conditional compilation → See build-tags

WebAssembly

  • WASM basics and compilation → See wasm-basics
  • JS interop with wasm_exec → See wasm-js-interop
  • DOM manipulation → See wasm-dom-manipulation
  • Memory management in WASM → See wasm-memory-management
  • Callbacks and async → See wasm-callbacks-async
  • WASM performance considerations → See wasm-performance
  • Debugging WASM → See wasm-debugging
  • Practical WASM use cases → See wasm-use-cases

Common Gotchas

  • Loop variable closure → See loop-variable-closure
  • Slice append behavior → See slice-append-behavior
  • time.After memory leak → See time-after-leak
  • HTTP client timeouts → See http-client-timeouts

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.