golang-patterns

golang-patterns is a skill for Claude Code, Codex from KunanonJ/ai-skills-hub. It costs 45 tokens per session (1,111 once invoked), scanned A, a copy of golang-patterns, MIT.

A guide to design patterns and common practices for Go, a programming language used for services, command-line tools, and systems software.

In plain words
What is it for?
Use it when designing Go packages, adding functional options, injecting dependencies, defining small interfaces, handling errors, or writing concurrent code.
Why use it?
It helps keep Go code easier to test, change, and understand by showing idiomatic ways to structure dependencies, interfaces, errors, and concurrent work.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when designing Go packages, adding functional options, injecting dependencies, defining small interfaces, handling errors, or writing concurrent code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kunanonj/ai-skills-hub/golang-patterns
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.

Any agent
npx skills add KunanonJ/ai-skills-hub --skill golang-patterns
Clone the repo
git clone --depth 1 https://github.com/KunanonJ/ai-skills-hub

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/kunanonj/ai-skills-hub/golang-patterns/github.svg)](https://agentmods.dev/skills/kunanonj/ai-skills-hub/golang-patterns)
Your own site
<a href="https://agentmods.dev/skills/kunanonj/ai-skills-hub/golang-patterns"><img src="https://agentmods.dev/badge/skills/kunanonj/ai-skills-hub/golang-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for golang-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/kunanonj/ai-skills-hub/golang-patterns"><img src="https://agentmods.dev/badge/skills/kunanonj/ai-skills-hub/golang-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,111 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod 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.00045 $0.01111
Opus 5.5 $0.00018 $0.00444
Sonnet 5.5 $0.00009 $0.00222
Haiku 4.5 $0.00005 $0.00111

Measured 3mo ago against content hash 835e7727ad68, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

golang-patterns scanned grade A with 0 findings 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 3mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to golang-patterns — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

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

How it starts

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

Go Patterns

This skill provides comprehensive Go patterns extending common design principles with Go-specific idioms.

Functional Options

Use the functional options pattern for flexible constructor configuration:

type Option func(*Server)

func WithPort(port int) Option {
    return func(s *Server) { s.port = port }
}

func NewServer(opts ...Option) *Server {
    s := &Server{port: 8080}
    for _, opt := range opts {
        opt(s)
    }
    return s
}

Benefits:

  • Backward compatible API evolution
  • Optional parameters with defaults
  • Self-documenting configuration

Small Interfaces

Define interfaces where they are used, not where they are implemented.

Principle: Accept interfaces, return structs

// Good: Small, focused interface defined at point of use
type UserStore interface {
    GetUser(id string) (*User, error)
}

func ProcessUser(store UserStore, id string) error {
    user, err := store.GetUser(id)
    // ...
}

Benefits:

  • Easier testing and mocking
  • Loose coupling
  • Clear dependencies

Dependency Injection

Use constructor functions to inject dependencies:

func NewUserService(repo UserRepository, logger Logger) *UserService {
    return &UserService{
        repo:   repo,
        logger: logger,
    }
}

Pattern:

  • Constructor functions (New* prefix)
  • Explicit dependencies as parameters
  • Return concrete types
  • Validate dependencies in constructor

Concurrency Patterns

Worker Pool

func workerPool(jobs <-chan Job, results chan<- Result, workers int) {
    var wg sync.WaitGroup
    for i := 0; i < workers; i++ {
        wg.Add(1)
        go func() {
            defer wg.Done()
            for job := range jobs {
                results <- processJob(job)
            }
        }()
    }
    wg.Wait()
    close(results)
}

Context Propagation

Always pass context as first parameter:

func FetchUser(ctx context.Context, id string) (*User, error) {
    // Check context cancellation
    select {
    case <-ctx.Done():
        return nil, ctx.Err()
    default:
    }
    // ... fetch logic
}

Read the full file on GitHub · 228 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. 3mo ago First seen · 228 lines · 45 tokens per session scan A 835e7727ad68

Subscribe to this mod's changes

golang-patterns is a skill published in the GitHub repository KunanonJ/ai-skills-hub (5 stars, last pushed 2mo ago), licensed MIT. It adds 45 tokens to every session and 1,111 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to golang-patterns, differing in 0 lines, and is treated as a copy.

Related

golang-patterns compared with skills from other repositories

golang-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
golang-patternsKunanonJ/ai-skills-hubSkill52mo agoMITA45Claude Code, Codex
golang-patternsdeepelementlab/jupyter-studioSkill166mo agoApache-2.0A27Claude Code, Codex
golang-testinghashgraph-online/awesome-codex-pluginsSkill1.6k2d agoApache-2.0A35Claude Code, Codex
golang-patternshashgraph-online/awesome-codex-pluginsSkill1.6k2d agoApache-2.0A27Claude Code, Codex
goframe-v2hashgraph-online/awesome-codex-pluginsSkill1.6k2d agoApache-2.0A40Claude Code, Codex
goericrisco/rsc-harnessSkill7093d agoMITA86Claude Code, Codex
ring:verifying-codeLerianStudio/ringSkill2181mo agoApache-2.0A101Cursor