Skills
Skill 18 of 54
Add and validate custom Go analysis linters in gh-aw.
1 minute · 254 words · 4 sections
Install
npx skills add github/gh-aw --skill go-lintersnpx skills add github/gh-awThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
Use this guide when adding a new custom Go analysis linter in this repository.
For PR-driven linter generation (derive a rule from a specific pull request pattern), use .github/skills/pr-to-go-linter/SKILL.md.
pkg/linters/<linter-name>/.Analyzer).analysistest with fixtures under .testdata/src/...cmd/linters/main.go so it runs via the multichecker binary.go test ./pkg/linters/<linter-name>/...go build ./cmd/lintersmake golint-custommake golint-custom builds cmd/linters and runs it against ./cmd/... and ./pkg/....
For linters that flag micro-optimizations (allocation/perf rules), only apply them on lines that
tests actually exercise — “hot paths” — rather than on dead or rarely-executed code where the
optimization brings no measurable benefit. Use the shared pkg/linters/internal/coverage package:
In your analyzer file, register a -hot-threshold flag in init() (not as a var initializer,
to avoid an Analyzer/run/flag initialization cycle):
var hotThreshold *int
func init() {
hotThreshold = coverage.RegisterHotThresholdFlag(Analyzer)
}Immediately before reporting a diagnostic, gate it with coverage.ShouldApply:
if !coverage.ShouldApply(pass, node.Pos(), *hotThreshold) {
return
}coverage.ShouldApply is permissive by default: when no coverage profile is loaded via the
GH_AW_LINT_COVERAGE_PROFILE environment variable, or when hot-threshold is 0, it always
returns true, preserving pre-coverage-aware behavior. Only wire this into linters whose fix has
a genuine performance rationale (extra allocations, O(n²) behavior, etc.) — purely
readability/style linters should not be coverage-gated.
go test -covermode=count -coverprofile=/tmp/coverage.out ./...
export GH_AW_LINT_COVERAGE_PROFILE=/tmp/coverage.out
make golint-customThis profile is read once per linter-runner process. To lint only a specific subtree, scope
the go test and golint-custom commands to the same package path.
main, last pushed 24 September 2026.SKILL.md, not by matching a directory convention. 4 distinct layouts observed: .claude/skills/*/SKILL.md, .github/skills/*/SKILL.md, .squad/*/skill.md, SKILL.md (repo root).h1 and no skipped levels:/github/gh-aw.md, and each skill at its own .md URL.