go-lint-setup
Skill0 starsChanged 5 months agoMITView on GitHub
Scaffold, adopt, or debug the golangci-lint v2 config in a Go repo. This skill should be used when the user runs `/go-lint-setup`, asks to "set up", "scaffold", "add" or "bootstrap" golangci-lint or a `.golangci.yml`, or asks why golangci-lint v2 rejects a config, how to migrate a v1 config, which linters the default set enables, how to adopt modernize/errorlint in an existing repo, what `golangci-lint fmt` does, how to write a `linters.exclusions` rule, or how to suppress a finding with `//nolint`. Go only.
- Installs packages
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- go-codingSkill
- go-concurrencySkill
- go-errorsSkill
- go-idiomsSkill
- go-layoutSkill
- go-testingSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 81
Common breakage when bumping the pin: run --fix first, then either land the leftover findings or add an explicit linters.exclusions.rules …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
go-lint-setup — scaffold, adopt, or debug golangci-lint v2
Bundled
references/is at the plugin root (besideskills/, two levels above this file) — not under this skill. Readreferences/golangci.v2.ymlas${CLAUDE_PLUGIN_ROOT}/references/golangci.v2.ymlon Claude Code, or../../references/golangci.v2.ymlfrom this skill's directory, or Glob for the installedreferences/golangci.v2.yml(host-agnostic).
Scaffold the plugin's reference golangci-lint v2 config into a repo that has none, or adopt or
debug an existing config already in the repo — schema questions, migration, which linters,
//nolint, exclusions. Scaffolding is a single interaction.
Asked to set up or scaffold a config → Steps 1–3 below. Asked about an existing config (rejected
keys, migration, which linters, //nolint, exclusions) → skip to Adopting or debugging an
existing config; do not write a file.
Steps:
- Check for an existing config —
.golangci.yml,.golangci.yaml,.golangci.toml,.golangci.json. If one exists, do not overwrite it: show how it differs from the reference and ask before changing anything. If it's a v1 config (noversionkey and/or anenable-all/top-levellinters:list), warn that v1 will not parse under golangci-lint v2 and offergolangci-lint migrate(see Adopting or debugging an existing config), not a hand-port. - Write the config below to
.golangci.yml(or the path given in$ARGUMENTS). - Report how to run it:
golangci-lint run, andgolangci-lint run --fixfor the auto-fixable findings (modernize+ the formatters). Suggest pinning an exact version in CI, as Discipline once adopted below describes; name no version number.
Config to write (mirrors references/golangci.v2.yml — keep the two in sync):
version: "2"
linters:
default: standard
enable:
- modernize
- errorlint
- exhaustive
- bodyclose
- rowserrcheck
- sqlclosecheck
- noctx
- contextcheck
- containedctx
- perfsprint
- usetesting
- nolintlint
- revive
formatters:
enable:
- gofumpt
- goimportsFor what each linter does, see the inline comments in references/golangci.v2.yml.
Adopting or debugging an existing config
golangci-lint v2 (Mar 2025) changed the config schema from v1 — a v1 config will not parse:
- Top-level
version: "2"is required. linters.default: standard | all | none | fastselects the base set (no moreenable-all).standard= errcheck, govet, ineffassign, staticcheck, unused.- Formatters moved to their own
formatters:section (gofmt/gofumpt/goimports are no longer "linters"), with their settings underformatters.settings.golangci-lint fmtruns that section. - Exclusions moved under
linters: v1'sissues.exclude-rules→linters.exclusions.rules, andissues.exclude-dirs/exclude-files→linters.exclusions.paths.linters-settingssplit intolinters.settings+formatters.settings. A config that still uses the old key names —issues:,linters-settings:,enable-all— is v1 and needsgolangci-lint migrate, not a hand-port;migraterewrites in place, keeps a.golangci.bck.ymlbackup, and takes--format {yml,yaml,toml,json}— it drops comments and unknown/deprecated keys, so re-add comments and diff the result.
Common breakage when bumping the pin: run --fix first, then either land the leftover findings
or add an explicit linters.exclusions.rules entry with a reason. If the pinned build rejects a
linter name from the reference config, the pin is too old — bump it rather than deleting the linter.
A linters.settings.modernize.disable entry naming fmtappendf (removed) or waitgroup (renamed
waitgroupgo) now only logs a warning and disables nothing; rename or drop it.
Adopting modernize: it is the single highest-leverage linter in the reference set — it
operationalizes most go-idioms rules on the same engine as gopls/go fix, so the plugin's advice
stays consistent with the toolchain. As of Go 1.26 the rewritten go fix ./... runs that same
modernizer suite from the toolchain itself; keep modernize in golangci-lint so CI enforces it
reproducibly against the pinned version rather than whatever toolchain a developer happens to have.
errorlint pairs with it in the reference config (%w + errors.Is/AsType discipline — see
go-errors).
The Go 1.27 baseline needs golangci-lint ≥ v2.13.0 (released 2026-08-19 — the same day as Go 1.27 itself), the first release with Go 1.27 support; anything v2.12.x or earlier predates it — a compatibility floor, not a pin (see Discipline once adopted). Source: https://golangci-lint.run/docs/product/changelog/#2130.
Discipline once adopted
- Pin an exact version in CI, in exactly one place — and keep the pin moving. Upstream's own
recommendation is a specific release, not
latest: a new release can add or retune linters and turn every build red at once, with no code change to blame. Put the version in a single source of truth — thegolangci/golangci-lint-actionversion:input (it also caches, and beats a plain binary install) or the install script's tag — never copied across several workflows and Makefiles. Then let Renovate/Dependabot raise the bump as its own PR, so the version stays current and every rule-set change arrives reviewable. This skill deliberately names no blessed version; read the changelog for the current line. - Install the release binary, not from source. Upstream states that
go install/go get, the tools pattern, andtooldirectives "aren't guaranteed to work" — they compile golangci-lint with whatever local Go version is around. Use the binary, the action, or the Docker image, from a release built with Go ≥ the module's toolchain (1.27+) so it can parse the language version. - Format with one Go minor. Go 1.27 changed the column-alignment logic in
gofmtandgo/format, so it can re-space a few files a 1.26gofmtleft alone. golangci-lint's formatters use thego/formatof the Go release its binary was built with, so keep CI, the pinned build and developers' toolchains on one Go minor, or the format check flips between them. - Suppress narrowly, and say why.
//nolint:errcheck // best-effort close on a read-only handle— never a bare//nolint(it disables every linter on that line) and never a blanket file-level disable where alinters.exclusions.rulesentry with a path pattern is the honest answer.nolintlintenforces the specific-and-explained form.
Sources
- golangci-lint docs — https://golangci-lint.run/docs/; v1→v2 migration guide (
migrate, key moves) — https://golangci-lint.run/docs/product/migration-guide/ - v2 announcement (
fmt,formatters) — https://ldez.github.io/blog/2025/03/23/golangci-lint-v2/ modernize— https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize; golangci-lint's handling of the removed and renamed analyzers — https://github.com/golangci/golangci-lint/blob/3ad7cb06d673241671520c4b194a989c3d725b3d/pkg/golinters/modernize/modernize.go- Go 1.27 release notes (
gofmtalignment,go fixchanges) — https://go.dev/doc/go1.27
Decomposition inspired by samber/cc-skills-golang (MIT © 2026 Samuel Berthe); rules grounded in the sources above.
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.

