agentleFS
Baba01hacker666Baba01hacker666/dummyskills/skills/golang/go-lint-and-vet/SKILL.md

go-lint-and-vet

Skill0 starsChanged 2 months agoMITView on GitHub

Guides agents through running and resolving go vet and golangci-lint diagnostics without ignoring errors.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 14
  2. Very specific:

    Do not use for testing; use go-testing.

    line 20
  3. Very specific:

    If package_path is missing: default to ./....

    line 26
  4. Very specific:

    Absolute Ban: Never resolve errcheck by writing _ = fn().

    line 27
  5. Distinctive:

    Follow these numbered actions:

    line 30
  6. Very specific:

    If errcheck flags an unhandled close call: check if err := f.Close().

    line 43
  7. Distinctive:

    Stop and ask the user when:

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Go Lint and Vet (golangci-lint & go vet)

Runs standard Go static analysis tools (go vet, golangci-lint). Enforces error checking (errcheck), struct alignment (govet), and clean conventions.

1. Purpose

Catch unhandled errors, unreachable code, and concurrency bugs in Go code before runtime.

2. When to Use

Use this skill when:

  • Verifying Go code before PR submission.
  • Fixing errcheck violations where returned errors were ignored.
  • Running golangci-lint run ./....

3. When Not to Use

  • Do not use for testing; use go-testing.

4. Required Inputs

  • package_path: Go package path to check (default: ./...).

5. Missing-Input Behavior

  1. If package_path is missing: default to ./....
  2. Absolute Ban: Never resolve errcheck by writing _ = fn(). Always handle the error.

6. Procedure

Follow these numbered actions:

  1. Action 1: Run go vet
    • Execute: go vet <package_path>
  2. Action 2: Run golangci-lint
    • Execute: golangci-lint run <package_path>
  3. Action 3: Fix Error Checks
    • Add explicit if err != nil { return err }.
  4. Action 4: Format Code
    • Execute: gofmt -w <target_file>
  5. Action 5: Re-verify
    • Confirm exit code 0.

7. Decision Rules

  • If errcheck flags an unhandled close call: check if err := f.Close(); err != nil.

8. Output Format

Emit the report using this template:

### Go Lint & Vet Report: [Package]

- **go vet**: PASS
- **golangci-lint**: PASS
- **Issues Resolved**: [Count]

#### Resolved Issues
- `[file:line]`: [Description of fix]

9. Verification Checklist

  • go vet exits code 0.
  • golangci-lint exits code 0.
  • No _ = err blank assignments introduced.

10. Common Failures and Recovery

Failure SymptomCauseRecovery Action
errcheck: error return value not checkedCalling method returning errorCheck if err != nil.

11. Stop or Escalation Conditions

Stop and ask the user when:

  • Lint rule conflicts with third-party generated protobuf code.

12. Examples

Example 1: Successful Execution

Input:

Package: ./internal/server
Error: errcheck: Error return value of `res.Body.Close` is not checked

Output:

### Go Lint & Vet Report: ./internal/server

- **go vet**: PASS
- **golangci-lint**: PASS
- **Issues Resolved**: 1

#### Resolved Issues
- `server.go:42`: Added `defer func() { _ = res.Body.Close() }()` or error logging check.

Example 2: Ambiguous or Missing Input

Input:

Lint go.

Output:

### Go Lint & Vet Report: Defaulting to ./...

- **go vet**: PASS
- **golangci-lint**: PASS
- **Issues Resolved**: 0

Example 3: Expected Final Output

Output:

### Go Lint & Vet Report: ./cmd/cli

- **go vet**: PASS
- **golangci-lint**: PASS
- **Issues Resolved**: 2

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.