{"id":"4ea28911-b105-4a86-9a3b-653d9824ec71","shortId":"NaYksv","kind":"skill","title":"golang-lint","tagline":"Provides linting best practices and golangci-lint configuration for Go projects. Covers running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and managing linter settings. Use this skill whenever the user runs linters, ","description":"**Persona:** You are a Go code quality engineer. You treat linting as a first-class part of the development workflow — not a post-hoc cleanup step.\n\n**Modes:**\n\n- **Setup mode** — configuring `.golangci.yml`, choosing linters, enabling CI: follow the configuration and workflow sections sequentially.\n- **Coding mode** — writing new Go code: launch a background agent running `golangci-lint run --fix` on the modified files only while the main agent continues implementing the feature; surface results when it completes.\n- **Interpret/fix mode** — reading lint output, suppressing warnings, fixing issues on existing code: start from \"Interpreting Output\" and \"Suppressing Lint Warnings\"; use parallel sub-agents for large-scale legacy cleanup.\n\n# Go Linting\n\n## Overview\n\n`golangci-lint` is the standard Go linting tool. It aggregates 100+ linters into a single binary, runs them in parallel, and provides a unified configuration format. Run it frequently during development and always in CI.\n\nEvery Go project MUST have a `.golangci.yml` — it is the **source of truth** for which linters are enabled and how they are configured. See the [recommended configuration](./assets/.golangci.yml) for a production-ready setup with 33 linters enabled.\n\n## Quick Reference\n\n```bash\n# Run all configured linters\ngolangci-lint run ./...\n\n# Auto-fix issues where possible\ngolangci-lint run --fix ./...\n\n# Format code (golangci-lint v2+)\ngolangci-lint fmt ./...\n\n# Run a single linter only\ngolangci-lint run --enable-only govet ./...\n\n# List all available linters\ngolangci-lint linters\n\n# Verbose output with timing info\ngolangci-lint run --verbose ./...\n```\n\n## Configuration\n\nThe [recommended .golangci.yml](./assets/.golangci.yml) provides a production-ready setup with 33 linters. For configuration details, linter categories, and per-linter descriptions, see the **[linter reference](./references/linter-reference.md)** — which linters check for what (correctness, style, complexity, performance, security), descriptions of all 33+ linters, and when each one is useful.\n\n## Suppressing Lint Warnings\n\nUse `//nolint` directives sparingly — fix the root cause first.\n\n```go\n// Good: specific linter + justification\n//nolint:errcheck // fire-and-forget logging, error is not actionable\n_ = logger.Sync()\n\n// Bad: blanket suppression without reason\n//nolint\n_ = logger.Sync()\n```\n\nRules:\n\n1. **//nolint directives MUST specify the linter name**: `//nolint:errcheck` not `//nolint`\n2. **//nolint directives MUST include a justification comment**: `//nolint:errcheck // reason`\n3. **The `nolintlint` linter enforces both rules above** — it flags bare `//nolint` and missing reasons\n4. **NEVER suppress security linters** (bodyclose, sqlclosecheck) without a very strong reason\n\nFor comprehensive patterns and examples, see **[nolint directives](./references/nolint-directives.md)** — when to suppress, how to write justifications, patterns for per-line vs per-function suppression, and anti-patterns.\n\n## Development Workflow\n\n1. **Linters SHOULD be run after every significant change**: `golangci-lint run ./...`\n2. **Auto-fix what you can**: `golangci-lint run --fix ./...`\n3. **Format before committing**: `golangci-lint fmt ./...`\n4. **Incremental adoption on legacy code**: set `issues.new-from-rev` in `.golangci.yml` to only lint new/changed code, then gradually clean up old code\n\nMakefile targets (recommended):\n\n```makefile\nlint:\n\tgolangci-lint run ./...\n\nlint-fix:\n\tgolangci-lint run --fix ./...\n\nfmt:\n\tgolangci-lint fmt ./...\n```\n\nFor CI pipeline setup (GitHub Actions with `golangci-lint-action`), see the `samber/cc-skills-golang@golang-continuous-integration` skill.\n\n## Interpreting Output\n\nEach issue follows this format:\n\n```\npath/to/file.go:42:10: message describing the issue (linter-name)\n```\n\nThe linter name in parentheses tells you which linter flagged it. Use this to:\n\n- Look up the linter in the [reference](./references/linter-reference.md) to understand what it checks\n- Suppress with `//nolint:linter-name // reason` if it's a false positive\n- Use `golangci-lint run --verbose` for additional context and timing\n\n## Common Issues\n\n| Problem | Solution |\n| --- | --- |\n| \"deadline exceeded\" | Increase `run.timeout` in `.golangci.yml` (default: 5m) |\n| Too many issues on legacy code | Set `issues.new-from-rev: HEAD~1` to lint only new code |\n| Linter not found | Check `golangci-lint linters` — linter may need a newer version |\n| Conflicts between linters | Disable the less useful one with a comment explaining why |\n| v1 config errors after upgrade | Run `golangci-lint migrate` to convert config format |\n| Slow on large repos | Reduce `run.concurrency` or exclude directories in `run.skip-dirs` |\n\n## Parallelizing Legacy Codebase Cleanup\n\nWhen adopting linting on a legacy codebase, use up to 5 parallel sub-agents (via the Agent tool) to fix independent linter categories simultaneously:\n\n- Sub-agent 1: Run `golangci-lint run --fix ./...` for auto-fixable issues\n- Sub-agent 2: Fix security linter findings (bodyclose, sqlclosecheck, gosec)\n- Sub-agent 3: Fix error handling issues (errcheck, nilerr, wrapcheck)\n- Sub-agent 4: Fix style and formatting (gofumpt, goimports, revive)\n- Sub-agent 5: Fix code quality (gocritic, unused, ineffassign)\n\n## Cross-References\n\n- → See `samber/cc-skills-golang@golang-continuous-integration` skill for CI pipeline with golangci-lint-action\n- → See `samber/cc-skills-golang@golang-code-style` skill for style rules that linters enforce\n- → See `samber/cc-skills-golang@golang-security` skill for SAST tools beyond linting (gosec, govulncheck)","tags":["golang","linter","skills","samber","agent","agent-skills","antigravity","claude","claude-code","code","codex","coding"],"capabilities":["skill","source-samber","skill-golang-linter","topic-agent","topic-agent-skills","topic-antigravity","topic-claude","topic-claude-code","topic-code","topic-codex","topic-coding","topic-copilot","topic-cursor","topic-gemini","topic-gemini-cli-extension"],"categories":["cc-skills-golang"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/samber/cc-skills-golang/golang-linter","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add samber/cc-skills-golang","source_repo":"https://github.com/samber/cc-skills-golang","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 1358 github stars · SKILL.md body (5,606 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T12:53:01.704Z","embedding":null,"createdAt":"2026-04-18T21:55:12.395Z","updatedAt":"2026-04-24T12:53:01.704Z","lastSeenAt":"2026-04-24T12:53:01.704Z","tsv":"'/assets/.golangci.yml':216,294 '/nolint':344,357,374,378,385,388,390,397,411,603 '/references/linter-reference.md':318,595 '/references/nolint-directives.md':435 '1':377,459,740 '10':566 '100':164 '2':389,472,755 '3':400,484,766 '33':224,302,332 '4':415,492,777 '42':565 '5':722,788 '5m':636 'action':367,543,548,812 'addit':621 'adopt':494,713 'agent':94,109,143,726,729,739,754,765,776,787 'aggreg':163 'alway':186 'anti':455 'anti-pattern':454 'auto':239,474,749 'auto-fix':238,473,748 'avail':274 'background':93 'bad':369 'bare':410 'bash':229 'best':6 'beyond':835 'binari':169 'blanket':370 'bodyclos':420,760 'categori':308,735 'caus':350 'chang':467 'check':321,600,658 'choos':74 'ci':77,188,539,806 'class':56 'clean':512 'cleanup':67,149,711 'code':46,85,90,130,250,497,509,515,642,654,790,817 'codebas':710,718 'comment':396,679 'commit':487 'common':625 'complet':118 'complex':326 'comprehens':428 'config':683,694 'configur':12,19,72,80,178,211,215,232,290,305 'conflict':669 'context':622 'continu':110,554,802 'convert':693 'correct':324 'cover':16 'cross':796 'cross-refer':795 'deadlin':629 'default':635 'describ':568 'descript':313,329 'detail':306 'develop':60,184,457 'dir':707 'direct':25,345,379,391,434 'directori':704 'disabl':672 'enabl':76,206,226,269 'enable-on':268 'enforc':404,825 'engin':48 'errcheck':358,386,398,771 'error':364,684,768 'everi':189,465 'exampl':431 'exceed':630 'exclud':703 'exist':129 'explain':680 'fals':612 'featur':113 'file':104 'find':759 'fire':360 'fire-and-forget':359 'first':55,351 'first-class':54 'fix':100,126,240,248,347,475,483,527,532,732,746,756,767,778,789 'fixabl':750 'flag':409,583 'fmt':258,491,533,537 'follow':78,561 'forget':362 'format':179,249,485,563,695,781 'found':657 'frequent':182 'from-rev':500,645 'function':451 'github':542 'go':14,45,89,150,159,190,352 'gocrit':792 'gofumpt':782 'goimport':783 'golang':2,553,801,816,829 'golang-code-styl':815 'golang-continuous-integr':552,800 'golang-lint':1 'golang-secur':828 'golangci':10,97,154,235,245,252,256,265,277,286,469,480,489,522,529,535,546,616,660,689,743,810 'golangci-lint':9,96,153,234,244,251,255,264,276,285,468,479,488,521,528,534,615,659,688,742 'golangci-lint-act':545,809 'golangci.yml':20,73,195,293,504,634 'good':353 'gosec':762,837 'govet':271 'govulncheck':838 'gradual':511 'handl':769 'head':648 'hoc':66 'implement':111 'includ':393 'increas':631 'increment':493 'independ':733 'ineffassign':794 'info':284 'integr':555,803 'interpret':26,133,557 'interpret/fix':119 'issu':127,241,560,570,626,639,751,770 'issues.new':499,644 'justif':356,395,442 'larg':146,698 'large-scal':145 'launch':91 'legaci':148,496,641,709,717 'less':674 'line':447 'lint':3,5,11,27,51,98,122,137,151,155,160,236,246,253,257,266,278,287,341,470,481,490,507,520,523,526,530,536,547,617,651,661,690,714,744,811,836 'lint-fix':525 'linter':18,31,40,75,165,204,225,233,262,275,279,303,307,312,316,320,333,355,383,403,419,460,572,575,582,591,605,655,662,663,671,734,758,824 'linter-nam':571,604 'list':272 'log':363 'logger.sync':368,375 'look':588 'main':108 'makefil':516,519 'manag':30 'mani':638 'may':664 'messag':567 'migrat':691 'miss':413 'mode':69,71,86,120 'modifi':103 'must':192,380,392 'name':384,573,576,606 'need':665 'never':416 'new':88,653 'new/changed':508 'newer':667 'nilerr':772 'nolint':24,433 'nolintlint':402 'old':514 'one':337,676 'output':28,123,134,281,558 'overview':152 'parallel':140,173,708,723 'parenthes':578 'part':57 'path/to/file.go':564 'pattern':429,443,456 'per':311,446,450 'per-funct':449 'per-lin':445 'per-lint':310 'perform':327 'persona':41 'pipelin':540,807 'posit':613 'possibl':243 'post':65 'post-hoc':64 'practic':7 'problem':627 'product':220,298 'production-readi':219,297 'project':15,191 'provid':4,175,295 'qualiti':47,791 'quick':227 'read':121 'readi':221,299 'reason':373,399,414,426,607 'recommend':214,292,518 'reduc':700 'refer':228,317,594,797 'repo':699 'result':115 'rev':502,647 'reviv':784 'root':349 'rule':376,406,822 'run':17,39,95,99,170,180,230,237,247,259,267,288,463,471,482,524,531,618,687,741,745 'run.concurrency':701 'run.skip':706 'run.timeout':632 'samber/cc-skills-golang':551,799,814,827 'sast':833 'scale':147 'section':83 'secur':328,418,757,830 'see':212,314,432,549,798,813,826 'sequenti':84 'set':32,498,643 'setup':70,222,300,541 'signific':466 'simultan':736 'singl':168,261 'skill':35,556,804,819,831 'skill-golang-linter' 'slow':696 'solut':628 'sourc':199 'source-samber' 'spare':346 'specif':354 'specifi':381 'sqlclosecheck':421,761 'standard':158 'start':131 'step':68 'strong':425 'style':325,779,818,821 'sub':142,725,738,753,764,775,786 'sub-ag':141,724,737,752,763,774,785 'suppress':21,124,136,340,371,417,438,452,601 'surfac':114 'target':517 'tell':579 'time':283,624 'tool':161,730,834 'topic-agent' 'topic-agent-skills' 'topic-antigravity' 'topic-claude' 'topic-claude-code' 'topic-code' 'topic-codex' 'topic-coding' 'topic-copilot' 'topic-cursor' 'topic-gemini' 'topic-gemini-cli-extension' 'treat':50 'truth':201 'understand':597 'unifi':177 'unus':793 'upgrad':686 'use':33,139,339,343,585,614,675,719 'user':38 'v1':682 'v2':254 'verbos':280,289,619 'version':668 'via':727 'vs':448 'warn':22,125,138,342 'whenev':36 'without':372,422 'workflow':61,82,458 'wrapcheck':773 'write':87,441 '~1':649","prices":[{"id":"ddbda4c8-29f7-4db2-b8db-582b23bb39c4","listingId":"4ea28911-b105-4a86-9a3b-653d9824ec71","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"samber","category":"cc-skills-golang","install_from":"skills.sh"},"createdAt":"2026-04-18T21:55:12.395Z"}],"sources":[{"listingId":"4ea28911-b105-4a86-9a3b-653d9824ec71","source":"github","sourceId":"samber/cc-skills-golang/golang-linter","sourceUrl":"https://github.com/samber/cc-skills-golang/tree/main/skills/golang-linter","isPrimary":false,"firstSeenAt":"2026-04-18T21:55:12.395Z","lastSeenAt":"2026-04-24T12:53:01.704Z"}],"details":{"listingId":"4ea28911-b105-4a86-9a3b-653d9824ec71","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"samber","slug":"golang-linter","github":{"repo":"samber/cc-skills-golang","stars":1358,"topics":["agent","agent-skills","ai","antigravity","claude","claude-code","code","codex","coding","copilot","cursor","gemini","gemini-cli-extension","openclaw","opencode","plugin","skills","skillsmp","vibe-coding"],"license":"mit","html_url":"https://github.com/samber/cc-skills-golang","pushed_at":"2026-04-23T21:44:30Z","description":"🧑‍🎨 A collection of Golang agentic skills that works","skill_md_sha":"8d535212252e8eb91f7818efdff54f5a8950bd3d","skill_md_path":"skills/golang-linter/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/samber/cc-skills-golang/tree/main/skills/golang-linter"},"layout":"multi","source":"github","category":"cc-skills-golang","frontmatter":{"name":"golang-lint","license":"MIT","description":"Provides linting best practices and golangci-lint configuration for Go projects. Covers running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and managing linter settings. Use this skill whenever the user runs linters, configures golangci-lint, asks about lint warnings or suppressions, sets up code quality tooling, or asks which linters to enable for a Go project. Also use when the user mentions golangci-lint, go vet, staticcheck, revive, or any Go linting tool.","compatibility":"Designed for Claude Code or similar AI coding agents, and for projects using Golang."},"skills_sh_url":"https://skills.sh/samber/cc-skills-golang/golang-linter"},"updatedAt":"2026-04-24T12:53:01.704Z"}}