go-conventions
Skill1 starsChanged 58 days agoMITView on GitHub
Shared conventions for Go projects. Copyright boilerplate, code quality, GoConvey and fuzz testing, architecture, and commands. Referenced by go-implementor, go-reviewer, and workflow skills.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- hashicorp/terraform-provider-awstheir own version, first seen May 14, 2026
- swell-agents/coding-skillstheir own version, first seen Apr 29, 2026
- Jonathan0823/opencode-configtheir own version, first seen Feb 6, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- hashicorp/terraform-provider-aws★ 11ksame name
- Jonathan0823/opencode-config★ 8same name
- swell-agents/coding-skills★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- agent-conductSkill
- bugfixSkill
- code-smellsSkill
- deliverSkill
- final-responseSkill
- frontend-designSkill
- go-implementorSkill
- go-reviewerSkill
- go-test-strengthSkill
- implementation-principlesSkill
- nextflow-conventionsSkill
- nextflow-implementorSkill
- nextflow-reviewerSkill
- nextjs-fastapi-conventionsSkill
- nextjs-fastapi-implementorSkill
- nextjs-fastapi-reviewerSkill
- orchestratorSkill
- phase-creatorSkill
- phase-reviewerSkill
- prose-principlesSkill
- pr-resolverSkill
- pr-reviewerSkill
- python-conventionsSkill
- python-implementorSkill
- python-reviewerSkill
- spec-authorSkill
- spec-proofreaderSkill
- spec-reviewerSkill
- spec-writerSkill
- subagentsSkill
- testing-principlesSkill
- unslopSkill
- verificationSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
All new source files must start with:
- Distinctive: line 60
Import grouping: stdlib | third-party | project (blank-line separated).
- Very specific: line 68
Never put So() in loops >20 iterations.
- Distinctive: line 69
Follow testing-principles for test intent.
- Distinctive: line 71
Every spec.md acceptance test MUST have a corresponding GoConvey test.
- Very specific: line 109
Commit the crasher. A failure writes its input to <pkg>/testdata/fuzz/FuzzX/<hash>, beside the package and not at the module root.
- Very specific: line 143
Put genuinely shared internal helpers, mocks, and utilities in internal/.
- Distinctive: line 144
Follow implementation-principles for reuse and abstraction decisions.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go Conventions
Single source of truth for Go code standards. Other skills reference this.
Copyright Boilerplate
All new source files must start with:
/*******************************************************************************
* Copyright (c) 2026 Genome Research Ltd.
*
* Author: Sendu Bala <sb10@sanger.ac.uk>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/Code Quality
Modern Go (1.25+)
- Range over integers:
for i := range n(no C-style loops in new code). log/slogoverlogorfmt.Printlnfor operational output.fmt.Errorfwith%w; sentinel errors as package-levelvarwitherrors.New;errors.Is/Asfor checking.slices/mapspackages instead of hand-written loops.- Named return values only when they genuinely aid readability.
- Goroutines must have clear exit paths; use
context.Contextfor cancellation.
Style
- Functions ~30 lines max (excluding error handling), but don't scatter logic across too many tiny helpers.
- Early returns/guard clauses over nested if/else.
- Doc comments on all exports.
- One responsibility per file; filenames describe the responsibility.
- Import grouping: stdlib | third-party | project (blank-line separated).
Testing (GoConvey)
- Framework:
github.com/smartystreets/goconvey/convey. So(actual, ShouldEqual, expected)assertions - never bareifchecks.t.TempDir()for filesystem ops.- Each
Conveyblock independent; no shared mutable state. - Never put
So()in loops >20 iterations; count and assert final count. - Follow testing-principles for test intent; this section covers GoConvey mechanics.
- Every spec.md acceptance test MUST have a corresponding GoConvey test. No stubs, no hardcoded results, no swallowed failures, no build-tag exclusions.
Fuzzing
Reach for a fuzz target when a claim must hold across a whole input domain rather than at the worked examples a spec names: overflow and rounding safety over a numeric range, a round-trip through an encoder, a parser that must never panic. testing-principles decides when one is owed and what property to assert; this section covers the Go mechanics.
func FuzzScale(f *testing.F) {
f.Add(int64(0), int64(1), int64(1))
f.Add(int64(math.MaxInt64), int64(2), int64(2))
f.Fuzz(func(t *testing.T, value, num, den int64) {
if den == 0 {
return // the documented panic has its own Convey test
}
got, want := mathx.Scale(value, num, den), slowExactScale(value, num, den)
if got != want {
t.Fatalf("Scale(%d,%d,%d) = %d, want %d", value, num, den, got, want)
}
})
}- Assert with plain
ifandt.Fatalfinsidef.Fuzz, notSo(). The body runs millions of times, so the loop rule above applies. f.Addevery boundary, zero and sign combination. Without-fuzz,go testruns the seed corpus and nothing else, so the seeds are what CI executes and they must stand on their own as a table test.- Assert a property, never a second copy of the implementation. A target that recomputes the function the same way proves only self-consistency.
- Constrain the domain in the target and leave documented panics and sentinel errors to their Convey tests.
- Commit the crasher. A failure writes its input to
<pkg>/testdata/fuzz/FuzzX/<hash>, beside the package and not at the module root. That file is the regression test: it then runs under plaingo test, sogit addit with the fix.
Memory-Bounded Test Pattern
func TestStreamingMemory(t *testing.T) {
// 1. Create large input (1M entries in t.TempDir())
// 2. Measure baseline:
runtime.GC()
var before runtime.MemStats
runtime.ReadMemStats(&before)
// 3. Run the streaming operation
// 4. Measure after:
runtime.GC()
var after runtime.MemStats
runtime.ReadMemStats(&after)
// 5. Assert (guard unsigned underflow):
var growth uint64
if after.HeapInuse > before.HeapInuse {
growth = after.HeapInuse - before.HeapInuse
}
So(growth, ShouldBeLessThan, 20*1024*1024)
}Architecture
cmd/*.go: CLI-only (flag parsing, wiring). No business logic.- New public packages for new functionality, fully tested via TDD.
internal/for shared helpers, mocks, generic utilities.main_test.gofor integration tests (no mocks, real end-to-end).- Put genuinely shared internal helpers, mocks, and utilities in
internal/. Follow implementation-principles for reuse and abstraction decisions.
Commands
# Tests
CGO_ENABLED=1 go test -tags netgo --count 1 ./<path> -v -run <TestFunc>
# Fuzz exploration (bounded; without -fuzz only the seed corpus runs)
go test ./<path> -fuzz <FuzzFunc> -fuzztime 60s
# Linter (check + autofix)
golangci-lint run --fix
# Clean ordering
cleanorder -min-diff <file>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

