pr-to-go-linter
$
npx mdskill add github/gh-aw/pr-to-go-linterGenerate a Go linter from a PR pattern
- Solves the problem of creating custom linters from fixed code patterns in PRs
- Uses GitHub API and Go analysis tools to extract and implement rules
- Analyzes PR diffs to identify and isolate the specific code pattern
- Delivers a fully implemented linter with tests and registration for immediate use
SKILL.md
.github/skills/pr-to-go-linterView on GitHub ↗
--- name: pr-to-go-linter description: Generate a new pkg/linters analyzer from a merged or open PR pattern. --- # PR to Go Linter Use this skill when a user asks to create a new custom Go linter based on a code pattern fixed in a pull request. ## Goal Convert one concrete PR pattern into a new `go/analysis` linter under `pkg/linters/<name>/` with tests and runner registration. ## Inputs - Repository owner/name - Pull request number - Target linter name (kebab-case) ## Workflow 1. Read PR metadata and changed files. 2. Read the PR diff and extract the repeated pattern that was fixed. 3. Define one precise diagnostic rule from that pattern. 4. Confirm no existing linter in `pkg/linters/` already covers it. 5. Implement: - `pkg/linters/<name>/<name>.go` with exported `Analyzer` - `pkg/linters/<name>/<name>_test.go` using `analysistest` - `pkg/linters/<name>/testdata/src/<name>/<name>.go` fixtures with `// want` - `cmd/linters/main.go` registration in `multichecker.Main(...)` 6. Validate: - `go test ./pkg/linters/<name>/...` - `go build ./cmd/linters` - `make golint-custom` ## Rule quality checks - High signal, low false positives on this repository. - Diagnostic is specific and fixable. - Rule scope matches code in the PR (do not generalize beyond evidence). - Do not change unrelated linter packages. ## Example pattern source For PR `#33038` (`Refactor pkg mutex sites to use deferred unlocks consistently`), derive a linter idea that reports lock/unlock sections that manually unlock instead of deferring unlock immediately after lock when the function body matches the same cache/logger-style critical section pattern. ## Output expectations - Minimal implementation-only diff in `pkg/linters/<name>/` and `cmd/linters/main.go`. - Tests prove both flagged and non-flagged cases. - PR summary explains: source PR, extracted pattern, and why the rule is safe.
More from github/gh-aw
- agentic-workflow-designerConversational skill that interviews users to design new agentic workflows
- agentic-workflowsRoute gh-aw workflow design/create/debug/upgrade requests to the right prompts.
- awf-release-integratorUpgrade gh-aw to latest gh-aw-firewall release and identify follow-up spec tasks.
- checkout-credential-reviewReview code that performs git or gh operations against repository checkouts in gh-aw, checking that the right credentials are available at the right time and that sparseness, shallowness and credential-free factors are properly considered.
- console-renderingUse Go struct tags to render styled terminal output in gh-aw.
- copilot-reviewTeach Copilot how to plan, address, and respond to pull request review feedback.
- custom-agentsDefine and validate GitHub custom agent files, prompts, and examples.
- debugging-workflowsDebug gh-aw workflows using run logs, audits, and failure triage.
- developerCore developer rules and coding conventions for gh-aw changes.
- Dictation InstructionsInstructions for fixing speech-to-text errors and improving text quality in gh-aw documentation and workflows