code-guidelines-go

A set of Go coding rules for pi-go, a Go-based AI coding agent. It covers code style, errors, concurrency, project structure, testing, and newer Go versions.

In plain words
What is it for?
Use it when writing, reviewing, or refactoring any Go code in pi-go, including tests, benchmarks, fuzz tests, and concurrency code.
Why use it?
It gives the agent consistent rules for writing and reviewing Go code, reducing style disagreements and common implementation mistakes.

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/dimetron/pi-go/code-guidelines-go
Any agent
npx skills add dimetron/pi-go --skill code-guidelines-go
Clone the repo
git clone --depth 1 https://github.com/dimetron/pi-go

Made for: Claude Code, Codex.

Per session 124 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,233 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00124 $0.06233
Opus 5 $0.00062 $0.03116
Sonnet 5 $0.00025 $0.01247
Haiku 4.5 $0.00012 $0.00623

Measured 2d ago against content hash 2988e1289657, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-guidelines-go 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 2d 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.

.pi-go/skills/code-guidelines-go/SKILL.md · 697 lines

How it starts

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

Go 1.24–1.27 Coding Guidelines — pi-go

Project: github.com/dimetron/pi-go — Go-native AI coding agent runtime
Layout: cmd/pi/ · internal/ · .pi-go/ · .vibe/compiled/ · scripts/
Min version: Go 1.24 (tool directive support) | Target: Go 1.27

For what Go 1.27 changed — generic methods, struct-literal field selectors, encoding/json/v2, the stdlib uuid package, removals that break a build, and the GOEXPERIMENT=none trap on this machine — see the go-127 skill.


1. Style & Naming

Packages

  • Short, lowercase, singular, no underscores: configagentUtils
  • No stutter: package agenttype Runner (not AgentRunner)
  • Never util, common, types, helpers

Identifiers

  • Receivers: 1–2 chars from type name, consistent across all methods, never self/this
  • Acronyms full caps: ID, URL, HTTP, LLM — enforced by staticcheck
  • Short names in small scopes (i, ctx, err), descriptive in large scopes
// ✓ Correct
func (r *Runner) Execute(ctx context.Context) error { ... }
func (r *Runner) Stop()                             { ... }

// ✗ Wrong
func (self *Runner) Execute(ctx context.Context) error { ... }
func (runner *Runner) Stop()                           { ... }

Interfaces

  • Define at the consumer, not producer
  • 1–3 methods; single-method uses -er suffix (Reader, Handler, Closer)
  • Accept interfaces, return concrete structs
// consumer defines what it needs (internal/agent/)
type LLMClient interface {
    Complete(ctx context.Context, prompt string) (string, error)
}

// producer returns concrete struct (internal/llm/)
func NewOpenAIClient(apiKey string) *OpenAIClient { ... }

Godoc

Every exported name starts its comment with the name itself:

// Package agent provides the core AI agent runtime for pi-go.
package agent

// Runner orchestrates tool calls and LLM interactions.
type Runner struct { ... }

// Execute runs the agent loop until completion or context cancellation.
func (r *Runner) Execute(ctx context.Context, task string) error { ... }

Read the full file on GitHub · 697 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. 2d ago First seen · 697 lines · 124 tokens per session scan A 2988e1289657

Subscribe to this mod's changes

code-guidelines-go is a skill published in the GitHub repository dimetron/pi-go (148 stars, last pushed 3d ago), licensed MIT. It adds 124 tokens to every session and 6,233 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. 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

use-modern-go

Use the Modern Go Guidelines CLI whenever writing, modifying, fixing, or refactoring Go code. Apply its version-specific guidance to generated changes.

JetBrains/go-modern-guidelines · 32 tokens

go-specialist

Go code review specialist for VM Agent and CLI. Reviews PTY/WebSocket/JWT code, CLI command contracts, static-analysis findings, and Go idioms. Use when working in packages/vm-agent/, packages/cli/, or reviewing Go code changes.

raphaeltm/simple-agent-manager · 55 tokens

qa-testing

Verify your work by actually operating the app or website you changed, instead of assuming it works. Strongly recommended whenever you build, modify, or debug a web app, website, or desktop GUI app. Drive real browsers with the agent-browser CLI and native desktop apps with the cua-driver CLI. These are installed on…

openinterpreter/openinterpreter · 77 tokens

migrate-goldmark-extension-v1-to-v2

Migrate goldmark extension from goldmark v1 to v2.

yuin/goldmark · 26 tokens

golang-gomlx

Machine learning models training and inference using GoMLX for Go. It provides an abstraction to create vectorized computation graphs, that can then be JIT-compiled (Just-In-Time) and executed very fast, with backends using XLA (for CPU/CUDA/TPU), Go and others. Includes a reach set of vector (tensors) operations on…

gomlx/gomlx · 143 tokens

modern-go

Modernize Go code by applying version-appropriate idioms and APIs (gofix-style transformations). Scans go.mod for the Go version, then transforms Go source files to use modern patterns—from Go 1.0 through 1.26+. Use when the user says "现代化","现代Go语言", "地道的", "idiomatic", "modernize", "modern-go", "update Go code"…

smallnest/pigo · 102 tokens