Borrowing it
Nothing to install: this file belongs to 2SSK/dot-files. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/2SSK/dot-files/main/.claude/skills/go-best-practices/SKILL.mdgit clone --depth 1 https://github.com/2SSK/dot-filesWrote 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.
[](https://agentmods.dev/skills/2ssk/dot-files/go-best-practices)<a href="https://agentmods.dev/skills/2ssk/dot-files/go-best-practices"><img src="https://agentmods.dev/badge/skills/2ssk/dot-files/go-best-practices/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.
<a href="https://agentmods.dev/skills/2ssk/dot-files/go-best-practices"><img src="https://agentmods.dev/badge/skills/2ssk/dot-files/go-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00029 | $0.00483 |
| Opus 5.5 | $0.00012 | $0.00193 |
| Sonnet 5.5 | $0.00006 | $0.00097 |
| Haiku 4.5 | $0.00003 | $0.00048 |
Grade A, and why
go-best-practices 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 14d 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.
What it actually says
Go Best Practices
Follow Go proverbs and community standards for all Go code.
Core Principles
- Simplicity: Go is simple. Avoid over-engineering.
- Idiomatic: Follow effective Go guidelines
- Performance: Profile before optimizing
- Testing: Test-driven development
Error Handling
// Always wrap errors with context
if err != nil {
return fmt.Errorf("failed to do operation: %w", err)
}
// Custom error types for known conditions
var NotFoundError struct{ Name string }
func (e NotFoundError) Error() string {
return fmt.Sprintf("not found: %s", e.Name)
}
Concurrency
// Use channels for coordination, mutexes for state
// Worker pool pattern
jobs := make(chan Job, workerCount)
results := make(chan Result, workerCount)
// Start workers
for i := 0; i < workerCount; i++ {
go worker(jobs, results)
}
Context
// All API calls must accept context
func DoSomething(ctx context.Context, arg Arg) (Result, error) {
req, err := http.NewRequestWithContext(ctx, ...)
// ...
}
Testing
// Table-driven tests
tests := []struct {
name string
input Arg
expected Result
}{
{"case 1", Arg{...}, Expected{...}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := DoSomething(tt.input)
assert.Equal(t, tt.expected, result)
})
}
Build Commands
go fmt ./...
go vet ./...
golangci-lint run
go test -race -coverprofile=coverage.out ./...
go build -o binary ./cmd/...
Quality Gates
- gofmt passes
- golangci-lint passes
- go test -race passes
- Coverage ≥ 80%
- No goroutine leaks
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.
- 14d ago First seen · 93 lines · 29 tokens per session scan A 361cbd4ef985
go-best-practices is a skill published in the GitHub repository 2SSK/dot-files (250 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 483 once invoked, about $0.0001 per session on Opus 5.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-10-02.
Other skills, from other repositories
golang-testing
Go testing best practices including table-driven tests, test helpers, benchmarking, race detection, coverage analysis, and integration testing patterns. Use when writing or improving Go tests.
golang-patterns
Go-specific design patterns and best practices including functional options, small interfaces, dependency injection, concurrency patterns, error handling, and package organization. Use when working with Go code to apply idiomatic Go patterns.
ax-go-agent-optimize
Use when writing Go code with github.com/ax-llm/ax/packages/go for agent optimization, verified agent-playbook evolution, evaluators, judges, optimizer artifacts, BootstrapFewShot, and GEPA.
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…
golang-uber-fx
Golang application framework using uber-go/fx — fx.New, fx.Provide, fx.Invoke, fx.Module, fx.Lifecycle hooks, fx.Annotate (name/group/As), fx.Decorate, fx.Supply, fx.Replace, fx.WithLogger, and signal-aware Run(). Apply when using or adopting uber-go/fx, when the codebase imports go.uber.org/fx, or when wiring…
golang-samber-oops
Structured error handling in Golang with samber/oops — error builders, stack traces, error codes, error context, error wrapping, error attributes, user-facing vs developer messages, panic recovery, and logger integration. Apply when using or adopting samber/oops, or when the codebase already imports…