用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/github/gh-aw --skill go-linters命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | go-linters |
| description | Add and validate custom Go analysis linters in gh-aw. |
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-custom
This 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.
GitHub Agentic Workflows (`gh-aw`) is a GitHub CLI extension for writing Agentic Workflows in markdown and compiling them to GitHub Actions.
Operate safely and efficiently inside a gh-aw workflow with a restricted tools/bash allowlist, and correctly triage tool-denial events before they exhaust the session's denial budget.
Optional Sergo examples for cache formats and reporting templates.