New advertisers: 50% off your first month with code FIRSTMONTHSee slots
cxuu avatar

Go Style Core

Core Go style guidance covering clarity-first priorities, gofmt, early returns, and semicolon rules.

skills.sh installs
1.3K
GitHub stars
196
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers the five style principles in priority order: clarity, simplicity, concision, maintainability, and consistency
  • Includes guidance on formatting with gofmt, reducing nesting through early returns, and when naked returns are appropriate
  • Enforces opening braces on the same line as control structures to avoid lexer-inserted semicolons
  • Acts as the fallback for Go style questions not covered by more specific skills such as go-naming or go-error-handling

Install

$ npx -y skills add cxuu/golang-skills --skill go-style-core -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Go Style Core Principles

Resource Routing

  • references/PRINCIPLES.md - Read when resolving conflicts between clarity, simplicity, concision, maintainability, and consistency.
  • references/FORMATTING.md - Read when handling gofmt, line breaks, whitespace, comments, or semicolons.

Style Principles (Priority Order)

When writing readable Go code, apply these principles in order of importance:

Priority Order

  1. Clarity — Can a reader understand the code without extra context?
  2. Simplicity — Is this the simplest way to accomplish the goal?
  3. Concision — Does every line earn its place?
  4. Maintainability — Will this be easy to modify later?
  5. Consistency — Does it match surrounding code and project conventions?

Formatting

Run gofmt — no exceptions. There is no rigid line length limit, but Uber suggests a soft limit of 99 characters. Break by semantics, not length — refactor rather than just wrap.


Reduce Nesting

Handle error cases and special conditions first. Return early or continue the loop to keep the "happy path" unindented.

Details

Repository
github.com/cxuu/golang-skills
Categories
Go, Code Review & Quality
First seen
May 16, 2026

More from cxuu/golang-skills

All 20

Similar to Go Style Core

More Go