agentleFS
abdullahkhawerabdullahkhawer/devops-skills/skills/go-linting/SKILL.md

go-linting

Skill8 starsChanged 6 months agoApache-2.0View on GitHub

Lint and format Go code using golangci-lint, gofmt, and go vet according to standard conventions. Use when asked to lint, format, or check style issues in Go files.

  • Installs packages

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this skill when asked to lint, format, or check style for Go code.

    line 8
  2. Very specific:

    If golangci-lint is not installed, inform the user and ask before installing:

    line 17
  3. Very specific:

    Only run auto-fix commands after showing the user what will change and getting explicit confirmation.

    line 68
  4. Very specific:

    No unused imports or variables (enforced by the compiler itself, but golangci-lint catches shadowed/ignored errors too).

    line 78
  5. Very specific:

    NEVER install golangci-lint without asking the user first.

    line 82
  6. Very specific:

    Always run in check mode first — only apply --fix/-w after the user confirms.

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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 Linting Skill

Run this skill when asked to lint, format, or check style for Go code.

Step 1 — Detect available tooling

which golangci-lint go 2>/dev/null
ls .golangci.yml .golangci.yaml 2>/dev/null

If golangci-lint is not installed, inform the user and ask before installing:

brew install golangci-lint

gofmt and go vet ship with the Go toolchain, so no separate install is needed for those.


Step 2 — Run formatting check

gofmt -l .

This lists files that are not correctly formatted (empty output means everything is formatted). Show the diff for any listed file:

gofmt -d <file>

Step 3 — Run vet (correctness checks)

go vet ./...

Step 4 — Run the linter

golangci-lint run ./...

Respect the project's .golangci.yml/.golangci.yaml if present — do not pass extra flags that override its enabled/disabled linters.

Report all findings grouped by file, with line numbers and linter names.


Step 5 — Apply fixes (only with user confirmation)

gofmt -w <file>
golangci-lint run --fix ./...

Only run auto-fix commands after showing the user what will change and getting explicit confirmation. go vet findings and most golangci-lint findings require manual code changes — present each with a suggested fix.


Standard conventions enforced

  • Formatting is always gofmt-compliant — this is non-negotiable in Go and never a matter of style preference.
  • Package names: short, lowercase, no underscores.
  • Exported identifiers (PascalCase) must have a doc comment starting with the identifier's name.
  • Errors are returned, not panicked, except at true program-fatal boundaries; always check if err != nil.
  • No unused imports or variables (enforced by the compiler itself, but golangci-lint catches shadowed/ignored errors too).

Rules

  • NEVER install golangci-lint without asking the user first.
  • Always run in check mode first — only apply --fix/-w after the user confirms.
  • Respect the project's existing .golangci.yml — do not suggest a different linter set without asking.
  • Report the exact command run and its full output — do not summarize away findings.
  • Flag any ignored error (_ = someFunc() where the error matters) or unchecked type assertion as a correctness finding, even if the linter configuration does not flag it.

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.