go-style-corelisted
Install: claude install-skill dwana1/golang-skills
# Go Style Core Principles
> **Normative**: This guidance is required per Google's canonical Go style
> guide.
## Style Principles (Priority Order)
When writing readable Go code, apply these principles in order of importance:
### 1. Clarity
The code's purpose and rationale must be clear to the reader.
- **What**: Use descriptive names, helpful comments, and efficient organization
- **Why**: Add commentary explaining rationale, especially for nuances
- View clarity through the reader's lens, not the author's
- Code should be easy to read, not easy to write
```go
// Good: Clear purpose
func (c *Config) WriteTo(w io.Writer) (int64, error)
// Bad: Unclear, repeats receiver
func (c *Config) WriteConfigTo(w io.Writer) (int64, error)
```
### 2. Simplicity
Code should accomplish goals in the simplest way possible.
Simple code:
- Is easy to read top to bottom
- Does not assume prior knowledge
- Has no unnecessary abstraction levels
- Has comments explaining "why", not "what"
- May be mutually exclusive with "clever" code
**Least Mechanism Principle**: Prefer standard tools:
1. Core language constructs (channel, slice, map, loop, struct)
2. Standard library tools (http client, template engine)
3. Core libraries before new dependencies
### 3. Concision
Code should have high signal-to-noise ratio.
- Avoid repetitive code
- Avoid extraneous syntax
- Avoid unnecessary abstraction
- Use table-driven tests to factor out common code
```go
// Good: Common idiom, high signal
if