skills/go-code-review/SKILL.md
Use when reviewing Go code or checking code against community style standards. Also use proactively before submitting a Go PR or when reviewing any Go code changes, even if the user doesn't explicitly request a style review. Does not cover language-specific syntax — delegates to specialized skills.
npx skillsauth add cxuu/golang-skills go-code-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use
assets/review-template.mdwhen formatting the output of a code review to ensure consistent structure with Must Fix / Should Fix / Nits severity grouping.
gofmt -d . and go vet ./... to catch mechanical issues firstValidation: After completing the review, re-read the diff once more to verify every flagged issue is real. Remove any finding you cannot justify with a specific line reference.
gofmt or goimports → go-linting_; handle, return, or (exceptionally) panic → go-error-handlingMixedCaps or mixedCaps, never underscores; unexported is maxLength not MAX_LENGTH → go-namingURL/url, ID/id, HTTP/http (e.g., ServeHTTP, xmlHTTPRequest) → go-namingi, r, c); longer names for wider scope → go-namingc for Client); no this, self, me; consistent across methods → go-namingchubby.File not chubby.ChubbyFile); avoid util, common, misc → go-packageserror, string, len, cap, append, copy, new, make → go-declarationsvar t []string (nil) over t := []string{} (non-nil zero-length) → go-data-structures*T methods' receivers by value → go-data-structurescrypto/rand for keys, not math/rand → go-defensivevar/const/type in parenthesized blocks; separate unrelated → go-declarationsvar for intentional zero values; := for explicit assignments → go-declarationsvar for zero structs → go-declarationsany: Prefer any over interface{} in new code → go-declarations/* name */ comments for ambiguous bool/int args, or use custom types → go-functionsf for go vet → go-functionsstring not *string for small fixed-size types → go-performance+ for simple; fmt.Sprintf for formatting; strings.Builder for loops → go-performancelog/slog, not log or fmt.Println for operational logging → go-loggingimport _ "pkg" only in main package or tests → go-packagesExample functions or tests demonstrating usage → go-documentationgot != want → go-testinghttptest.NewServer + real client over mocking HTTP → go-testingRun automated pre-review checks:
bash scripts/pre-review.sh ./... # text output
bash scripts/pre-review.sh --json ./... # structured JSON output
Or manually: gofmt -l <path> && go vet ./... && golangci-lint run ./...
Fix any issues before proceeding to the checklist above. For linter setup and configuration, see go-linting.
Read references/WEB-SERVER.md when building a production HTTP server and want to verify your code applies concurrency, error handling, context, documentation, and naming conventions together.
tools
Use when writing, reviewing, or improving Go test code — including table-driven tests, subtests, parallel tests, test helpers, test doubles, and assertions with cmp.Diff. Also use when a user asks to write a test for a Go function, even if they don't mention specific patterns like table-driven tests or subtests. Does not cover benchmark performance testing (see go-performance).
development
Use when working with Go formatting, line length, nesting, naked returns, semicolons, or core style principles. Also use when a style question isn't covered by a more specific skill, even if the user doesn't reference a specific style rule. Does not cover domain-specific patterns like error handling, naming, or testing (see specialized skills). Acts as fallback when no more specific style skill applies.
development
Use when optimizing Go code, investigating slow performance, or writing performance-critical sections. Also use when a user mentions slow Go code, string concatenation in loops, or asks about benchmarking, even if the user doesn't explicitly mention performance patterns. Does not cover concurrent performance patterns (see go-concurrency).
development
Use when creating Go packages, organizing imports, managing dependencies, or deciding how to structure Go code into packages. Also use when starting a new Go project or splitting a growing codebase into packages, even if the user doesn't explicitly ask about package organization. Does not cover naming individual identifiers (see go-naming).