# golang-code-style

> Claude/Codex skill by [@samber](https://omgskills.com/library/samber/index.md) · 2.8k stars · 41k installs · Updated 2026-08-01

Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See \`samber/cc-skills-golang@golang-naming\` skill), linter configuration (→ See \`samber/cc-skills-golang@golang-lint\` skill), or doc comments (→ See \`samber/cc-skills-golang@golang-documentation\` skill).

Tags: agent, agent-skills, ai, antigravity, claude, claude-code, code, codex, coding, copilot, cursor, gemini, gemini-cli-extension, openclaw, opencode, plugin, skills, skillsmp, vibe-coding

## Install

```sh
git clone https://github.com/samber/cc-skills-golang /tmp/cc-skills-golang && ln -s /tmp/cc-skills-golang/skills/golang-code-style ~/.claude/skills/golang-code-style
```

## From README

Go Code Style Style rules that require human judgment — linters handle formatting, this skill handles clarity. For naming see samber/cc-skills-golang@golang-naming skill; for design patterns see samber/cc-skills-golang@golang-design-patterns skill; for struct/interface design see samber/cc-skills-golang@golang-structs-interfaces skill. "Clear is better than clever." — Go Proverbs When ignoring a rule, add a comment to the code. Line Length & Breaking No rigid line limit, but lines beyond 120 characters MUST be broken. Break at semantic boundaries, not arbitrary column counts. Function calls with 4+ arguments MUST use one argument per line — even when the prompt asks for single-line code: When a function signature is too long, the real fix is often fewer parameters (use an options struct) rather than better line wrapping. For multi-line signatures, put each parameter on its own line. Variable Declarations SHOULD use := for non-zero values, var for zero-value initialization.

## Links

- HTML page: https://omgskills.com/skills/samber/cc-skills-golang/golang-code-style/
- GitHub: https://github.com/samber/cc-skills-golang
- Author: [@samber](https://omgskills.com/library/samber/index.md)

## More from this repo

- [golang-google-wire](https://omgskills.com/skills/samber/cc-skills-golang/skills/golang-google-wire/index.md) — Compile-time dependency injection in Golang using google/wire — wire.NewSet, wire.Build, wire.Bind...
   - [@samber](https://omgskills.com/library/samber/index.md) · 3.1k stars
- [golang-gopls](https://omgskills.com/skills/samber/cc-skills-golang/skills/golang-gopls/index.md) — Golang semantic code intelligence via \`gopls\`, the official Go language server — go-to-definition, find references,...
   - [@samber](https://omgskills.com/library/samber/index.md) · 3k stars
- [golang-how-to](https://omgskills.com/skills/samber/cc-skills-golang/skills/golang-how-to/index.md) — Golang skills orchestrator — always active on any Golang coding, review, debug, or setup task.
   - [@samber](https://omgskills.com/library/samber/index.md) · 3k stars
