Agent skill · writing content · aiskillstore
golang-code-style
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).
Why this skill is useful
Codifies Go code style conventions that the AI could infer but now doesn't have to guess.
What it needs
Requires go installed locally. About 5k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Community default. A company skill that explicitly supersedes samber/cc-skills-golang@golang-code-style skill takes precedence. 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. The form signals intent: var means "this starts at zero." Slice & Map Initialization Slices and maps MUST be initialized explicitly, never nil. Nil maps panic on write; nil slices serialize to null in JSON (vs [] for empty slices), surprising API consumers. Do not preallocate speculatively — make([]T, 0, 1000) wastes memory when the common case is 10 items. Composite Literals Composite literals MUST use field names — positional fields break when the type adds or reorders fields: Control Flow Reduce Nesting Errors and edge cases MUST be handled first (early return). Keep the happy path at minimal indentation: Eliminate Unnecessary else When the if body ends with return/break/continue, the else MUST be dropped. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/golang-code-style