Agent skill
linting-go-code
Lint and format Go code. Use when you need to run linters, fix lint errors, format code, or understand why a linter is complaining.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/linting-go-code
SKILL.md
Linting Go Code
All commands run from the Go module root (installer/).
Lint
task lint
Runs golangci-lint (the master linter — all individual linters run through it) plus typos for spell checking. Auto-fixes what it can.
Format
task fmt
Formats code through golangci-lint (gofumpt + goimports + golines). Never run these formatters standalone — always use task fmt.
Nolint Directives
When suppressing a lint in code, the configuration requires both a specific linter name and an explanation:
//nolint:gochecknoinits // Cobra requires an init function to set up the command structure.
Blanket //nolint without a linter name is not allowed.
When Lints Fail
- Read the linter's message — golangci-lint identifies which linter flagged the issue
- Fix the code to satisfy the linter when possible
- If the lint is a false positive, suppress with a
//nolint:lintername // reasondirective - For linter configuration details (which linters are enabled, thresholds, exclusions), read
.golangci.yml
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?