One-click install
npx skills add https://github.com/hellopoisonx/aim --skill golang-code-style-hellopoisonx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-code-style
Source: https://github.com/hellopoisonx/aim/tree/main/skills/golang-code-style
Command: npx skills add https://github.com/hellopoisonx/aim --skill golang-code-style-hellopoisonx

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves confusion and inconsistency in Go code reviews by providing human-judgment style rules that linters cannot capture, improving readability and reducing maintainability risk.

Core Features & Use Cases

  • Clarity-first formatting guidance: Break long lines at semantic boundaries and format multi-argument calls for readability.
  • Intent-revealing declarations: Use var vs := to signal zero-value vs non-zero intent, and avoid nil collections by initializing slices/maps.
  • Control-flow structure: Prefer early returns, avoid unnecessary else after returns, extract complex conditions into named booleans, and use switch over repeated if-else comparisons.
  • Go API correctness heuristics: Apply value-vs-pointer rules for parameters, require named-field struct literals, and encourage short focused functions.

Quick Start

Use the golang-code-style skill to review or write a Go file while ensuring collection initialization, clear control flow, and semantic line breaking adhere to the conventions.

Frequently Asked Questions about golang-code-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I improve Go code readability beyond what a formatter does?

Go code readability improves by applying human-judgment rules like semantic line breaking, intent-revealing `var` vs `:=` declarations, and early returns to clarify control flow. These conventions enforce clarity that standard formatters and linters cannot capture.

When should I use var vs := in Go declarations?

Use `var` vs `:=` in Go declarations to signal intent: use `var` when declaring zero-value variables to make the zero value explicit, and use `:=` when assigning non-zero values. This intent-revealing pattern helps reviewers understand initialization expectations.

Why should I initialize slices and maps in Go instead of leaving them nil?

Initializing slices and maps in Go instead of leaving them nil avoids nil collection panics and clarifies intent. Non-nil initialization ensures safe operations on collections, reducing maintainability risk and preventing unexpected behavior during read or write operations.

What is the best way to structure Go control flow for code review?

The best way to structure Go control flow for code review is using early returns, avoiding `else` after returns, extracting complex conditions into named booleans, and using `switch` over repeated if-else comparisons to make logic clear and maintainable.

How do I decide between value and pointer parameters in Go functions?

Decide between value and pointer parameters in Go functions by applying correctness heuristics: use value parameters for small, immutable data to prevent unintended mutation, and use pointers for large structs or when mutation is required, ensuring clear API contracts.

Can Go linters catch all style and maintainability issues?

Go linters cannot capture all style issues because human-judgment conventions like semantic line breaking, zero-value intent signaling, and named boolean extraction for complex conditions require contextual clarity decisions that automated tools are not designed to evaluate.