Skip to content
Back to skills

Pr To Go Linter

ASecurity

Generate a new pkg/linters analyzer from a merged or open PR pattern.

  • 5,344 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 26, 2026
code-qualitygo

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add github/gh-aw --skill pr-to-go-linter --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pr To Go Linter?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pr To Go Linter
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/github-pr-to-go-linter/badge)](https://www.skillsdirectory.com/skills/github-pr-to-go-linter)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.