Skip to content

Repository files navigation

AI Go Coding Standards

A curated set of 12 flat-file coding-standard skills for Claude Code and compatible AI coding agents.

Covers a language-agnostic single-responsibility baseline, ports-and-adapters architecture, and a full Go stack:

  • revive linter rules
  • modern Go (1.22+ / 1.23+ / 1.26+) idioms
  • naming conventions
  • data-structure choices
  • dependency injection
  • security defaults
  • production-ready testing

Drop the .md files into your project and the agent applies them automatically.

Foundation (language-agnostic)

  • focused-functions — Each function does exactly one nameable thing; duplicated logic is extracted on sight; else gives way to early returns or polymorphism.

Go — linter & rules enforcement

  • golang-linter-rules — Project-specific golangci-lint rules: nlreturn (blank line before return), wrapcheck (always wrap external errors), add-constant (no repeated literals or magic numbers), error-strings formatting.
    • Structural Complexity & Sizing Limits
    • Strict Naming Conventions
    • Styling & Code Format Enforcement
    • Security, Scope & Blocklists

Go — language usage

  • golang-modern-go — Post-1.18 idioms: context-aware variants, errors.AsType (1.26+), errors.Join, slices/maps/cmp, range-over-int (1.22+), range-over-func (1.23+), min/max/clear, any over interface{}.
  • golang-naming — Idiomatic naming: packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters, functional options, acronyms, test functions.
  • golang-data-structures — Slices (header / cap / preallocation / slices pkg), maps (maps pkg, sync.Map), arrays, container/*, strings.Builder vs bytes.Buffer, generics, unsafe/weak.Pointer, copy semantics.

Go — design heuristics

  • golang-calisthenics — Flexible design heuristics: wrap meaningful primitives in value-object types, Law of Demeter (one dot per line, fluent-interface exception), keep entities small, narrow structs over fat aggregates.
  • golang-dependency-injection — Why DI matters; manual constructor injection (the default); functional options; library comparison (google/wire compile-time, uber-go/fx runtime + lifecycle, samber/do, uber-go/dig).

Go — production concerns

  • golang-security — Injection (SQL / command / XSS / path traversal), crypto (crypto/rand, banned MD5/SHA1, password hashing), filesystem, TLS, cookies, secrets, memory & concurrency safety, safe logging, gosec / govulncheck.
  • golang-testing — Table-driven tests, subtests, parallelism, testify, mocks, unit vs integration vs e2e, benchmarks + benchstat, coverage, fuzzing, testdata/, golden files, goleak, race detector, CI.

Index

  • golang-mandatory — Index file. Loading it pulls in all 10 Go skills above; also lists 7 externally-delegated samber skills to consult on demand.

Trigger validation

The evals/trigger-tests.json file contains realistic user prompts for each skill (3 should-trigger + 1 near-miss should-not-trigger) — used to sanity-check the description field in each skill's frontmatter.

About

Plug-and-play coding skills for AI coding agents: Go best practices + hexagonal architecture + focused-functions discipline.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors