Agent skill

golang-idioms

Idiomatic Go patterns for error handling, interfaces, concurrency, testing, and module management

Rohit Ghumare82,766★ · +2,021/wk · 9 repos on radarProfile →
claude-codeApache-2.0
Install
npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 8 KB
Bundled scripts: none
Path: skills/golang-idioms/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 2,438
Language: JavaScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Go Idioms ## Error Handling ```go // Return errors, never panic in library code func LoadConfig(path string) (Config, error) { data, err := os.ReadFile(path) if err != nil { return Config{}, fmt.Errorf("reading config %s: %w", path, err) } var cfg Config if err := json.Unmarshal(data, &cfg); err != nil { return Config{}, fmt.Errorf("parsing config: %w", err) } return cfg, nil } ``` Rules: - Always wrap errors with context using `fmt.Errorf("context: %w", err)` - Use `%w` to allow callers to use `errors.Is` and `errors.As` - Handle errors at the appropriate level; do not log and return the same error - Define sentinel errors for expected conditions ```go var ( ErrNotFound = errors.New("not found") ErrUnauthorized = errors.New("unauthorized") ) func GetUser(id string) (User, error) { user, ok := store[id] if !ok { return User{}, fmt.Errorf("user %s: %w", id, ErrNotFound) } return user, nil } // Caller user, err := GetUser(id) if errors.Is(err, ErrNotFound) { http.Error(w, "user not found", http.StatusNotFound) return } ``` ## Interface Design ```go // Keep interfaces small (1-3 methods) type Reader interface { Read(p []byte) (n int, err error) } type UserStore interface { GetUser(c

What's inside
Steps it walks through
  1. Error Handling
  2. Interface Design
  3. Goroutine and Channel Patterns
  4. Worker Pool
  5. Fan-out/Fan-in
  6. Context Propagation
  7. Table-Driven Tests
  8. Test Helpers
  9. Module Management
  10. Zero-Value Design
  11. Structured Logging
  12. Common Anti-Patterns
Commands it runs
go mod tidy          # remove unused, add missing
go mod verify        # verify checksums
go list -m -u all    # check for updates
go get -u ./...      # update all dependencies
go mod vendor        # vendor dependencies (optional)
More from awesome-claude-code-toolkit
All skills →
About this skill
What does the golang-idioms skill do?

Idiomatic Go patterns for error handling, interfaces, concurrency, testing, and module management

How do I install it?

Run `npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From rohitg00/awesome-claude-code-toolkit, a repository with 2,438 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going