golang-patterns

golang-patterns is a skill for Claude Code, Codex from 1024XEngineer/bytemind. It costs 14 tokens per session (3,237 once invoked), scanned A, original, MIT.

A set of coding patterns for Go, the programming language. The excerpt shows examples for clear errors, useful zero values, and straightforward interfaces.

In plain words
What is it for?
Use it when designing or reviewing Go functions, types, error handling, initialization, interfaces, and data-processing code.
Why use it?
It gives agents consistent ways to write readable Go code and avoid patterns that can cause confusion or runtime problems.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/1024xengineer/bytemind/golang-patterns
Any agent
npx skills add 1024XEngineer/bytemind --skill golang-patterns
Clone the repo
git clone --depth 1 https://github.com/1024XEngineer/bytemind

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for golang-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/1024xengineer/bytemind/golang-patterns.svg)](https://agentmods.dev/skills/1024xengineer/bytemind/golang-patterns)
Your own site
<a href="https://agentmods.dev/skills/1024xengineer/bytemind/golang-patterns"><img src="https://agentmods.dev/badge/skills/1024xengineer/bytemind/golang-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,237 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00014 $0.03237
Opus 5 $0.00007 $0.01618
Sonnet 5 $0.00003 $0.00647
Haiku 4.5 $0.00001 $0.00324

Measured 5d ago against content hash 3306e76d91eb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

golang-patterns scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

data, _ := fetch(url)
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.agents/skills/golang-patterns/SKILL.md · 675 lines

How it starts

The opening of the file, as written. The whole thing — 675 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go ????

???????????????????? Go ????????

????

  • ???? Go ???
  • ?? Go ???
  • ???? Go ???
  • ?? Go ?/???

????

1. ?????

Go ???????????????????????

// Good: Clear and direct
func GetUser(id string) (*User, error) {
    user, err := db.FindUser(id)
    if err != nil {
        return nil, fmt.Errorf("get user %s: %w", id, err)
    }
    return user, nil
}

// Bad: Overly clever
func GetUser(id string) (*User, error) {
    return func() (*User, error) {
        if u, e := db.FindUser(id); e == nil {
            return u, nil
        } else {
            return nil, e
        }
    }()
}

2. ???????

???????????????????????

// Good: Zero value is useful
type Counter struct {
    mu    sync.Mutex
    count int // zero value is 0, ready to use
}

func (c *Counter) Inc() {
    c.mu.Lock()
    c.count++
    c.mu.Unlock()
}

// Good: bytes.Buffer works with zero value
var buf bytes.Buffer
buf.WriteString("hello")

// Bad: Requires initialization
type BadCounter struct {
    counts map[string]int // nil map will panic
}

3. ??????????

??????????????????

// Good: Accepts interface, returns concrete type
func ProcessData(r io.Reader) (*Result, error) {
    data, err := io.ReadAll(r)
    if err != nil {
        return nil, err
    }
    return &Result{Data: data}, nil
}

// Bad: Returns interface (hides implementation details unnecessarily)
func ProcessData(r io.Reader) (io.Reader, error) {
    // ...
}

??????

?????????

// Good: Wrap errors with context
func LoadConfig(path string) (*Config, error) {
    data, err := os.ReadFile(path)
    if err != nil {
        return nil, fmt.Errorf("load config %s: %w", path, err)
    }

    var cfg Config
    if err := json.Unmarshal(data, &cfg); err != nil {
        return nil, fmt.Errorf("parse config %s: %w", path, err)
    }

    return &cfg, nil
}

???????

Read the full file on GitHub · 675 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 675 lines · 14 tokens per session scan A 3306e76d91eb

Subscribe to this mod's changes

golang-patterns is a skill published in the GitHub repository 1024XEngineer/bytemind (43 stars, last pushed 1mo ago), licensed MIT. It adds 14 tokens to every session and 3,237 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

stack-trace-go-probe

Internal helper for meta-stack-trace-investigator. Use when a Go panic or stack trace needs Go-specific nil/error checks, go test reproducer guidance, and patch targets.

opensquilla/opensquilla · 42 tokens

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

samber/cc-skills-golang · 115 tokens

golang-benchmark

Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof, interpreting CPU/memory/trace profiles, analyzing results with benchstat, setting up CI benchmark regression detection, or investigating production performance with…

samber/cc-skills-golang · 104 tokens

golang-continuous-integration

GitHub Actions CI/CD pipeline configuration for Golang projects — workflow files for test, lint, SAST, coverage and vulnerability-scan jobs, Dependabot and Renovate config files, GoReleaser release pipelines, Docker build/push, repository security settings, and AI-driven PR review. Use when setting up or improving Go…

samber/cc-skills-golang · 181 tokens

golang-dependency-injection

Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google/wire, uber-go/dig, uber-go/fx, samber/do). Use this skill when designing service architecture…

samber/cc-skills-golang · 182 tokens

golang-documentation

Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt. Use when writing or reviewing doc comments, documentation, adding code examples, setting up doc sites, or discussing documentation best practices.…

samber/cc-skills-golang · 77 tokens