Idiomatic go

From saifoelloh/golang-best-practices-skill · View interactive version

Idiomatic go is an AI agent skill from the GitHub repository saifoelloh/golang-best-practices-skill. Idiomatic Go style and best practices review. Use when checking interface design, pointer usage, or Go-specific idioms. Ensures code follows standard Go conventions and readability principles.

How to use this skill

Skill file

Golang Idiomatic Patterns

Expert-level review for idiomatic Go patterns. Ensures code follows Go conventions, proper interface design, and appropriate pointer usage.

When to Apply

Use this skill when:

Rule Categories by Priority

| Priority | Count | Focus |

|----------|-------|-------|

| High | 1 | Method receivers |

| Medium | 5 | Go idioms and patterns |

Rules Covered (6 total)

High-Impact Patterns (1)

Medium Improvements (5)

Common Idiomatic Patterns

Accept Interfaces, Return Structs

// ✅ GOOD: Accept interface, return struct
func Process(r io.Reader) (*Result, error) {
    // ...
    return &Result{}, nil
}

Small Interfaces

// ✅ GOOD: Small, focused interface
type Reader interface {
    Read(p []byte) (n int, err error)
}

Pointer Receivers for Mutations

// ✅ GOOD: Pointer receiver modifies state
func (u *User) UpdateEmail(email string) {
    u.Email = email
}

Trigger Phrases

This skill activates when you say:

How to Use

For Idiomatic Review

  1. Check method receivers (pointer vs value)
  2. Verify interface sizes and locations
  3. Review pointer usage appropriateness
  4. Check "accept interfaces, return structs" pattern

Output Format

## Idiomatic Go Improvements: X

### [Rule Name] (Line Y)
**Pattern**: Interface Design / Pointer Usage / Method Receiver
**Issue**: Violates Go idiom
**Fix**: Suggested correction
**Example**:

// Idiomatic Go code

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.