cxuu avatar

Go Style Core

This is your baseline for Go formatting and readability. It covers gofmt defaults, reducing nesting through early returns, when naked returns are acceptable (short functions only), and why opening braces stay on the same line due to semicolon insertion. The priority order matters here: clarity beats simplicity beats concision, which is a useful tiebreaker when you're staring at two valid approaches. It explicitly punts on naming, error handling, and testing to other skills, so think of this as the fallback when you have a style question that doesn't fit elsewhere. The examples are practical, especially the nested loop refactoring that shows how continue keeps code flat.

skills.sh installs
1.3K
GitHub stars
193
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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.

Sponsors

Details

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

More from cxuu/golang-skills

All 20
1nvidia avatarjetson-diagnosticnvidia/skillsRead-only Jetson health snapshot for identity, memory, GPU, thermal, power, storage, services, and top processes.1.3Kskills.sh installs
2astronomer avatarauthoring-dagsastronomer/agentsWorkflow and best practices for writing Apache Airflow DAGs. Use when creating a new DAG, write pipeline code, handling questions about DAG patterns and convent1.3Kskills.sh installs
3kostja94 avatarindexingkostja94/marketing-skillsWhen the user wants to fix indexing issues from Search Console, use noindex, or implement Google Indexing API. Also use when the user mentions "fix indexing," "1.3Kskills.sh installs
4agentmc15 avatartrading-strategiesagentmc15/polymarket-traderFramework for developing, testing, and deploying trading strategies for prediction markets. Use when creating new strategies, implementing signals, or building 1.3Kskills.sh installs
5nexscope-ai avatarecommerce-email-marketing-buildernexscope-ai/ecommerce-skillsE-commerce email marketing system builder. Creates complete email automation flows with full copywriting, subject lines, ESP setup instructions, segmentation ru1.2Kskills.sh installs
6secondsky avatarsap-fiori-toolssecondsky/sap-skillsDevelops SAP Fiori applications using SAP Fiori tools extensions for VS Code and SAP Business Application Studio. Use when: generating Fiori Elements or Freesty1.2Kskills.sh installs