agentleFS
jmlrtjmlrt/skills/golang-development/SKILL.md

golang-development

Skill0 starsChanged 4 months agoMITView on GitHub

Guide Go development and code review. Apply when writing, maintaining, or reviewing Go code to ensure consistency with project tooling, module conventions, and common patterns.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use templates from tooling.md as starting point

    line 37
  2. Very specific:

    Read existing Makefile, golangci-lint config, and go.mod before writing anything

    line 42
  3. Distinctive:

    Check CLAUDE.md / AGENTS.md for repo-specific guidance first

    line 44
  4. Distinctive:

    Never swallow errors — always check and propagate or wrap

    line 54
  5. Distinctive:

    For version bump PRs: always check GOTOOLCHAIN behavior — see tooling.md.

    line 97
  6. Distinctive:

    When a blocker is found, grep for the same pattern across the codebase and include all instances in the review comment.

    line 99
  7. Distinctive:

    Check against CI toolchain before bumping — see tooling.md

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Go Development

Apply this skill when writing, maintaining, or reviewing Go code.


Supporting Files

  • tooling.md — Makefile targets, golangci-lint v2 config, CI toolchain conventions, GOTOOLCHAIN behavior
  • patterns.md — Error handling, struct layout, and common patterns

Mode Detection

SignalMode
"write", "create", "add", "scaffold", "implement", "new"WRITE
"fix", "refactor", "update", "change", "migrate", "improve"MAINTAIN
"review", "check", "audit", "look at", "what do you think"REVIEW

WRITE Mode

Step 1: Greenfield or brownfield?

Greenfield (new repo or new package):

  • Use templates from tooling.md as starting point
  • Standard layout: cmd/ for entry points, internal/ for private packages, pkg/ for public packages
  • Apply all rules below from the start

Brownfield (existing repository):

  • Read existing Makefile, golangci-lint config, and go.mod before writing anything
  • Match existing patterns — don't retrofit conventions the repo hasn't adopted
  • Check CLAUDE.md / AGENTS.md for repo-specific guidance first

Step 2: Apply when writing any code

Linter compliance — read the repository's golangci-lint configuration before changing code. Common rules that surprise people:

  • noinlineerr: split if err := x(); err != nil into two lines — see patterns.md
  • wsl_v5: add a blank line before if when multiple statements precede it
  • revive: mark unused parameters with _

Error handling:

  • Never swallow errors — always check and propagate or wrap
  • Wrap with context: fmt.Errorf("doing X: %w", err)
  • See patterns.md for the noinlineerr split pattern

Module hygiene:

  • go.mod go directive = minimum Go version required to build — see tooling.md before bumping it

MAINTAIN Mode

  1. Read before writing — check existing patterns with Read/Grep
  2. Run checks after editing — make lint and make test; see tooling.md for standard targets
  3. Match existing patterns — preserve style even if it differs from greenfield defaults
  4. Don't change tooling unless the user explicitly asks

REVIEW Mode

Go through the diff and report findings. See patterns.md for detailed pattern checks.

Blockers (Critical — must fix before merge)

  • Swallowed errors: err returned but not checked, or _ = someFunc() on error-returning function
  • || return 0 / || true in shell scripts in the repo — silently converts failures to success; see review-pull-request skill
  • go.mod go directive bumped above the CI toolchain version when GOTOOLCHAIN=local — will fail all pipelines; see tooling.md
  • Secrets or credentials hardcoded
  • Race conditions: shared state accessed without synchronization

Suggestions

  • Missing error wrapping context (fmt.Errorf("...: %w", err) preferred over bare err)
  • Inline error assignment not split for noinlineerr lint rule (will fail CI)
  • Missing blank line before if block when multiple statements precede it (wsl_v5)
  • Unused parameter not named _ (revive)

NITs

  • Abbreviated variable name where the full word is short and unambiguous (bid → buildID, pkgs → packages, p for a package struct → pkg) — see patterns.md
  • Exported identifier missing godoc comment
  • Magic constant that should be a named const
  • Test helper not calling t.Helper()
  • Error string contains \n — Go style requires single-line errors; see patterns.md
  • Package named validate, util, helper, common — too generic; prefer a name that describes what the package actually does (e.g. layout, checksum, dralayout)

For version bump PRs: always check GOTOOLCHAIN behavior — see tooling.md.

When a blocker is found, grep for the same pattern across the codebase and include all instances in the review comment.


Brownfield Decision Tree

golangci-lint config present?

  • Yes → run make lint with existing config; don't add or remove linters
  • No → add .golangci.yml only if the user asks

Go version in go.mod?

  • Check against CI toolchain before bumping — see tooling.md

Makefile present?

  • Yes → check for test, lint, fmt, build targets; use them
  • No → run go test ./... and golangci-lint run directly

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.