Skip to content
Agentmart
Submit a tool

go-conventions

Shared conventions for Go projects.

Skill by wtsi-hgi

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/wtsi-hgi-go-conventions

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

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.

Use cases: testing, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/go-conventions

What's inside

Skill name
go-conventions
Description
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.
License
MIT
Instructions
167 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • openai.yaml · agents/

SKILL.md (first lines)

# 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/slog` over `log` or `fmt.Println` for operational output.
- `fmt.Errorf` with `%w`; sentinel errors as package-level `var` with
  `errors.New`; `errors.Is`, or `errors.AsType[T]` rather than `errors.As`
  with a target variable.
- `time` unit constants, not raw nanosecond counts; `for b.Loop()` in
  benchmarks; `defer` for a function's final cleanup step.
- `slices`/`maps` packages instead of hand-written loops.
- Named return values only when they genuinely aid readability.
- Goroutines must have clear exit paths; use `context.Context` for 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 bare `if` checks.
- `t.TempDir()` for filesystem ops.
- Each `Convey` block independent; no shared mutable state.
- Never put `So()` in loops >20 iterations; count and assert final count.
- Use the matching assertion (`ShouldWrap`, `ShouldHaveLength`, ...), not
  `So(cond, ShouldBeTrue)`.
- Undo state changes (permissions, env, globals) with `Reset`, registered
  before the change; a failing `So` skips any later `defer`. Pass cleanup
  functions directly: `Reset(h.Cleanup)`.
- Never block on a bare channel receive; `select` with a timeout so a missed
  signal fails the test instead of hanging it.
- 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.

```go
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 `if` and `t.Fatalf` inside `f.Fuzz`, not `So()`. The body
  runs millions of times, so the loop rule above applies.
- `f.Add` every boundary, zero and sign combination. Without `-fuzz`, `go
  test` runs 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 plain `go test`,
  so `git add` it with the fix.

### Memory-Bounded Test Pattern

From wtsi-hgi/agentskills, MIT.

More from wtsi-hgi/agentskills

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Oct 22, 2026 (7 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from wtsi-hgi

Cite this page

go-conventions skill. Agent Mart. https://agentmart.dev/skills/wtsi-hgi-go-conventions (last updated 2026-10-24)