golang-patterns

golang-patterns is a skill for Kiro from Fmarzochi/EGC. It costs 45 tokens per session (1,112 once invoked), scanned A, a copy of golang-patterns, Apache-2.0.

A collection of Go programming patterns for designing flexible constructors, small interfaces, dependency injection, concurrency, error handling, and package layout.

In plain words
What is it for?
Use it when designing Go APIs, connecting dependencies, organizing packages, handling concurrent work, or improving error handling.
Why use it?
It provides common ways to structure Go code so components are easier to test, replace, and extend.

Skill for Kiro

Written for Kiro: installed under .kiro/.

Good fit Use it when designing Go APIs, connecting dependencies, organizing packages, handling concurrent work, or improving error handling.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fmarzochi/egc/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 Fmarzochi/EGC --skill golang-patterns
Clone the repo
git clone --depth 1 https://github.com/Fmarzochi/EGC

Made for: Kiro.

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/fmarzochi/egc/golang-patterns/github.svg)](https://agentmods.dev/skills/fmarzochi/egc/golang-patterns)
Your own site
<a href="https://agentmods.dev/skills/fmarzochi/egc/golang-patterns"><img src="https://agentmods.dev/badge/skills/fmarzochi/egc/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/fmarzochi/egc/golang-patterns"><img src="https://agentmods.dev/badge/skills/fmarzochi/egc/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,112 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 89% 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.01112
Opus 5 $0.00023 $0.00556
Sonnet 5 $0.00009 $0.00222
Haiku 4.5 $0.00005 $0.00111

Measured 9d ago against content hash 9167b6e6e027, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, 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 9d 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

89% identical to golang-patterns — 2 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.

.kiro/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. 9d ago First seen · 228 lines · 45 tokens per session scan A 9167b6e6e027

Subscribe to this mod's changes

golang-patterns is a skill published in the GitHub repository Fmarzochi/EGC (49 stars, last pushed yesterday), licensed Apache-2.0. It adds 45 tokens to every session and 1,112 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 89% identical to golang-patterns, differing in 2 lines, and is treated as a copy.

Related

Other skills, from other repositories