Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/paulohgodinho-golang-code-style
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/golang-code-style
Tools it pre-approves 9
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
ReadEditWriteGlobGrepBash(go:*)Bash(golangci-lint:*)Bash(git:*)Agent
What's inside
- Skill name
golang-code-style- Description
- Golang code style, formatting and conventions. Use when writing code, reviewing style, configuring linters, writing comments, or establishing project standards.
- License
- MIT
- Compatibility
- Designed for Claude Code or similar AI coding agents, and for projects using Golang.
- Allowed tools
- Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent
- Metadata
- author: samber · version: 1.0
- Instructions
- 303 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (3)
- SKILL.md
- evals.json · evals/
- details.md · references/
SKILL.md (first lines)
> **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 [golang-naming](../golang-naming/SKILL.md); for design patterns see [golang-design-patterns](../golang-design-patterns/SKILL.md); for struct/interface design see [golang-structs-interfaces](../golang-structs-interfaces/SKILL.md).
> "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:
```go
// Good — each argument on its own line, closing paren separate
mux.HandleFunc("/api/users", func(w http.ResponseWriter, r *http.Request) {
handleUsers(
w,
r,
serviceName,
cfg,
logger,
authMiddleware,
)
})
```
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."
```go
var count int // zero value, set later
name := "default" // non-zero, := is appropriate
var buf bytes.Buffer // zero value is ready to use
```
### 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.
```go
users := []User{} // always initialized
m := map[string]int{} // always initialized
users := make([]User, 0, len(ids)) // preallocate when capacity is known
m := make(map[string]int, len(items)) // preallocate when size is known
```
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:
```go
srv := &http.Server{
Addr: ":8080",
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
}
```
## Control Flow
### Reduce Nesting
Errors and edge cases MUST be handled first (early return). Keep the happy path at minimal indentation:
```go
func process(data []byte) (*Result, error) {
if len(data) == 0 {
return nil, errors.New("empty data")
}
parsed, err := parse(data)
if err != nil {
return nil, fmt.Errorf("parsing: %w", err)
}
return transform(parsed), nil
}
```
### Eliminate Unnecessary `else`
When the `if` body ends with `return`/`break`/`continue`, the `else` MUST be dropped. Use default-then-override for simple assignments — assign a default, then override with independent conditions or a `switch`:
```go
// Good — default-then-override with switch (cleanest for mutually exclusive overrides)
level := slog.LevelInfo
switch {
case debug:
level = slog.LevelDebug
case verbose:
level = slog.LevelWarn
}
// Bad — else-if chain hides that there's a default
if debug {
level = slog.LevelDebug
} else if verbose {
level = slog.LevelWarn
} else {
level = slog.LevelInfo
}
```
### Complex Conditions & Init Scope
When an `if` condition has 3+ operands, MUST extract into named booleans — a wall of `||` is unreadable and hides business logic. Keep expensive checks inline for short-circuit benefit. [Details](./references/details.md)
```go
// Good — named booleans make intent clear
isAdmin := user.Role == RoleAdmin
isOwner := resource.OwnerID == user.ID
isPublicVerified := resource.IsPublic && user.IsVerifiedFrom paulohgodinho/skills, MIT.
More from paulohgodinho/skills
- 0.414score
golang-naming
samber
Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters…
SkillDFreshness: DClaude Code +9 - 0.414score
golang-project-layout
samber
Provides a guide for setting up Golang project layouts and workspaces.
SkillDFreshness: DClaude Code +9 - 0.414score
golang-dependency-injection
samber
Comprehensive guide for dependency injection (DI) in Golang.
SkillDFreshness: DClaude Code - 0.414score
golang-design-patterns
samber
Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown…
SkillDFreshness: DClaude Code +9 - 0.410score
golang-lint
samber
Provides linting best practices and golangci-lint configuration for Go projects.
SkillDFreshness: DClaude Code +9 - 0.409score
golang-structs-interfaces
samber
Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via…
SkillDFreshness: DClaude Code +9 - 0.409score
golang-cli
samber
Golang CLI application development.
SkillDFreshness: DClaude Code +9 - 0.409score
golang-build
samber
Cross-platform build script for Go projects using a build.go file at the repository root.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Apr 4, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0
- License
- MIT
- Repository
- github.com/paulohgodinho/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from samber
- 0.563score
golang-design-patterns
samber
Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown…
SkillBFreshness: B★ 2Claude Code +9 - 0.563score
golang-performance
samber
Golang performance optimization patterns and methodology - if X bottleneck, then apply Y.
SkillBFreshness: B★ 2Claude Code - 0.563score
golang-security
samber
Security best practices and vulnerability prevention for Golang.
SkillBFreshness: B★ 2Claude Code - 0.563score
golang-testing
samber
Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak…
SkillBFreshness: B★ 2Claude Code +9 - 0.563score
golang-documentation
samber
Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and…
SkillBFreshness: B★ 2Claude Code - 0.534score
golang-benchmark
samber
Golang benchmarking, profiling, and performance measurement.
SkillCFreshness: C★ 5Claude Code
Cite this page
golang-code-style skill. Agent Mart. https://agentmart.dev/skills/paulohgodinho-golang-code-style (last updated 2026-10-24)