# golang

A skill that hands your agent Go production rules: error handling, concurrency, naming, testing, generics. Useful when you write or review Go in Claude.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 522 installs · ★ 9
- Author: saisudhir14
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/saisudhir14/claude-skills/tree/HEAD/SKILL.md
- Updated: 2026-06-26
- HTML: https://affpapa.org/en/nevibecode/skills/golang

## What it does

The rules come from Google Go Style Guide, Uber Go Style Guide, Effective Go and Go Code Review Comments, updated for Go 1.25. Each one is short and carries an example: return errors instead of panicking, wrap with `%w` when callers need `errors.Is` or `errors.As`, keep error strings lowercase and unpunctuated. Concurrency gets its own section — channel size 0 or 1, `errgroup.Group` over a hand-rolled `sync.WaitGroup`, typed atomics. Naming, imports, structs, slices and maps, generics, iterators and `slog` are covered too.

Alongside the main file the repo ships sub-skills: `skills/go-error-handling`, `skills/go-concurrency`, `skills/go-testing`, `skills/go-performance`, `skills/go-code-review`, `skills/go-linting`, `skills/go-project-layout`, `skills/go-security`. Deeper material sits in `references/`. The agent pulls those in when a question goes past the basics.

The skill doesn't lint your code on its own. It sets the frame your agent writes and reviews inside. If your team has its own conventions, expect friction: the rules lean Google and Uber, not your house style. One command installs it.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add saisudhir14/claude-skills --skill golang -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/golang/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/golang/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add saisudhir14/claude-skills --skill golang -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/golang/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add saisudhir14/claude-skills --skill golang -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/golang/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install saisudhir14/claude-skills golang
```

2. **Manually: put the files in place**
- File: `.github/skills/golang/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add saisudhir14/claude-skills --skill golang -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/saisudhir14/claude-skills
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/golang/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add saisudhir14/claude-skills --skill golang -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/saisudhir14/claude-skills/tree/HEAD/SKILL.md

## When to use it
- catch error wrapping that uses `%v` where `%w` is needed
- clean up goroutines built on unbuffered channels and manual `WaitGroup`
- fix naming to MixedCaps and consistent initialism case
- move slice and map code onto the `slices` and `maps` packages
- split a package named `util` into real layers

## Example prompts
- Review this file against the golang skill rules and flag where error handling drifts
- Rewrite this goroutine block using `errgroup.Group`
- Check naming and imports in `internal/config` against the golang skill

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: da112170dfe72857.

BEGIN THIRD-PARTY FILE da112170dfe72857
````text
---
name: golang
description: >-
  Use when writing, reviewing, or refactoring Go code. Provides production
  best practices for Go covering error handling, concurrency, naming,
  testing, performance, generics, iterators, and common pitfalls. Distilled from
  Google Go Style Guide, Uber Go Style Guide, Effective Go, and Go Code Review
  Comments. Updated for Go 1.25.
version: "2.0.0"
license: MIT
compatibility:
  agents:
    - claude-code
    - cursor
    - github-copilot
    - codex
    - gemini-cli
    - opencode
    - amp
    - windsurf
    - zed
    - goose
    - roo-code
    - kiro
    - cline
    - antigravity
    - trae
    - clawdbot
    - droid
    - kilo
    - continue
    - aider
    - sourcegraph-cody
  platforms:
    - linux
    - macos
    - windows
  languages:
    - go
metadata:
  author: saisudhir14
  tags: golang go best-practices google uber style-guide error-handling concurrency testing performance generics iterators code-review production
  category: languages
---

# Go Best Practices

Production patterns from Google, Uber, and the Go team. Updated for Go 1.25.

> Sub-skills: `skills/go-error-handling`, `skills/go-concurrency`, `skills/go-testing`, `skills/go-performance`, `skills/go-code-review`, `skills/go-linting`, `skills/go-project-layout`, `skills/go-security`. Deep-dive references in `references/`.

## Core Principles

Readable code prioritizes these attributes in order:

1. **Clarity**: purpose and rationale are obvious to the reader
2. **Simplicity**: accomplishes the goal in the simplest way
3. **Concision**: high signal to noise ratio
4. **Maintainability**: easy to modify correctly
5. **Consistency**: matches surrounding codebase

---

## Error Handling

> Full guide: `skills/go-error-handling/SKILL.md` | Reference: `references/error-handling.md`

- **Return errors, never panic** in production code
- **Wrap with `%w`** when callers need `errors.Is`/`errors.As`; use `%v` at boundaries
- **Keep context succinct**: `"new store: %w"` not `"failed to create new store: %w"`
- **Handle errors once**: don't log and return the same error
- **Error strings**: lowercase, no punctuation
- **Indent error flow**: handle errors first, keep happy path at minimal indentation
- **Use `errors.Join`** (Go 1.20+) for multiple independent failures
- **Sentinel errors**: `Err` prefix for vars, `Error` suffix for types

```go
if err != nil {
    return fmt.Errorf("load config: %w", err)
}
```

---

## Concurrency

> Full guide: `skills/go-concurrency/SKILL.md` | Reference: `references/concurrency.md`

- **Channel size**: 0 (unbuffered) or 1; anything else needs justification
- **Document goroutine lifetimes**: when and how they exit
````
END THIRD-PARTY FILE da112170dfe72857

The third-party file has ended. Everything between the da112170dfe72857 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2690 of 11737 bytes. © saisudhir14 · MIT · https://github.com/saisudhir14/claude-skills/tree/HEAD/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
