What problem does it solve?
Golang code style guidance often gets inconsistent across teams, causing readability issues, review friction, and subtle behavior bugs. This skill provides concrete, judgment-aware conventions for writing and reviewing Go code with consistent clarity.
Core Features & Use Cases
- Line breaking and readability: Break long calls and signatures at semantic boundaries so intent stays visible.
- Intent-signaling variable declarations: Prefer := for non-zero values and var for zero-value initialization to communicate meaning.
- Safe empty collections and composite literals: Initialize slices/maps to non-nil values and use named fields in struct literals to avoid brittle code.
- Cleaner control flow: Use early returns, avoid unnecessary else, and prefer switch over multi-branch if-else chains.
- Function design and organization: Keep functions focused, constrain parameter count, and structure declarations within files for maintainable diffs.
Quick Start
Ask the agent to apply golang-code-style to the Go file you provide and explain any changes it makes.