agentleFS
abevzabevz/devops-skills/skills/go-code-review/SKILL.md

go-code-review

Skill0 starsChanged 41 days agoMITView on GitHub

Use when reviewing Go code for idiomatic style, correctness, concurrency, or maintainability. Mention "review this go code", "is this idiomatic go", or "go code review"; use pr-review for a cross-language diff with no Go focus and go-testing-review for tests specifically.

5 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use go-error-handling.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • rjansenSkill

    go-error-handling

    This skill should be used when the user asks to "handle errors in Go", "create a custom error type", "wrap errors", "use sentinel errors", "choose between %w and %v", "fix error handling", "propagate errors", or mentions errors.Is, errors.As, errors.Join, fmt.Errorf, error wrapping, or single-handling principle. Provides a decision tree for choosing the right error pattern and Go-specific idioms for error propagation, naming, and handling. NOT for panic/recover in HTTP middleware (use go-code-review) or test assertion errors (use go-test-quality).

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 7 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the changed code, callers, nearby tests, and relevant interfaces.

    line 18
  2. Distinctive:

    Do not substitute style preferences for correctness findings.

    line 22
  3. Distinctive:

    Follow the Workflow, Safety rules, and Quality checklist below.

    line 26
  4. Very specific:

    Use when reviewing Go code for quality — separate from pr-review (broader, any language) and go-testing-review (tests specifically).

    line 36
  5. Very specific:

    Check idiomatic Go: naming (short, clear, no Hungarian notation), package structure (no utils/common dumping grounds), effective use of the …

    line 47
  6. Very specific:

    Check context usage: context.Context passed as the first parameter, not stored in a struct.

    line 50
  7. Very specific:

    Check error handling: errors wrapped with %w for context, not swallowed or logged-and- ignored.

    line 53
  8. Very specific:

    Check naming: exported identifiers documented, receiver names short and consistent, interfaces named for behavior (-er convention) where …

    line 56
  9. Distinctive:

    Check package boundaries: no import cycles, internal packages used to hide implementation details that shouldn't be part of the public API.

    line 58
  10. Distinctive:

    Check concurrency safety: shared state protected by a mutex or owned by a single goroutine.

    line 60
  11. Very specific:

    Check resource cleanup: defer Close()/defer cancel() used correctly, not inside a loop in a way that delays cleanup until the function …

    line 63
  12. Very specific:

    Check logging: structured, leveled logging instead of ad hoc fmt.Println/log.Println in library code.

    line 65
  13. Very specific:

    Check performance: obvious unnecessary allocations in hot paths (e.g.

    line 67
  14. Very specific:

    Check security: unchecked input passed to exec.Command, SQL built via string concatenation, unsafe deserialization, secrets logged or …

    line 69
  15. Distinctive:

    Do not rewrite the whole file — point to specific lines and specific fixes.

    line 74
  16. Distinctive:

    Do not flag goroutine/channel patterns as leaks without tracing whether they actually have no termination condition — false positives here …

    line 77

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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 Code Review

TL;DR checklist

  • Check idiomatic Go, package boundaries, context propagation, and error handling.
  • Inspect concurrency, resource cleanup, and API behavior at call sites.
  • Report concrete findings with their impact and location.

Key read-only checks

  • Read the changed code, callers, nearby tests, and relevant interfaces.

Common pitfalls

  • Do not substitute style preferences for correctness findings.

Agent procedure

Follow the Workflow, Safety rules, and Quality checklist below.

Quick references

  • Workflow below.

Last verified: unverified

When to use

Use when reviewing Go code for quality — separate from pr-review (broader, any language) and go-testing-review (tests specifically). Use this one when the focus is Go-specific code quality itself.

Goal

Catch non-idiomatic patterns, concurrency hazards, and maintainability issues specific to Go, with concrete fixes.

Workflow

  1. Check idiomatic Go: naming (short, clear, no Hungarian notation), package structure (no utils/common dumping grounds), effective use of the standard library over reinventing it.
  2. Check context usage: context.Context passed as the first parameter, not stored in a struct; cancellation/timeouts respected in long-running or I/O operations; no context.Background() used deep in call chains where a real context should propagate.
  3. Check error handling: errors wrapped with %w for context, not swallowed or logged-and- ignored; sentinel errors compared with errors.Is, not ==; no panic for ordinary error conditions.
  4. Check naming: exported identifiers documented, receiver names short and consistent, interfaces named for behavior (-er convention) where idiomatic.
  5. Check package boundaries: no import cycles, internal packages used to hide implementation details that shouldn't be part of the public API.
  6. Check concurrency safety: shared state protected by a mutex or owned by a single goroutine; goroutines have a clear termination condition (no leaks); channels have a clear owner/closer.
  7. Check resource cleanup: defer Close()/defer cancel() used correctly, not inside a loop in a way that delays cleanup until the function returns.
  8. Check logging: structured, leveled logging instead of ad hoc fmt.Println/log.Println in library code.
  9. Check performance: obvious unnecessary allocations in hot paths (e.g. repeated string concatenation instead of strings.Builder), but don't over-optimize code that isn't hot.
  10. Check security: unchecked input passed to exec.Command, SQL built via string concatenation, unsafe deserialization, secrets logged or hardcoded.

Safety rules

  • Do not rewrite the whole file — point to specific lines and specific fixes.
  • Distinguish idiom violations (style) from actual bugs (concurrency hazard, resource leak, security issue) in severity.
  • Do not flag goroutine/channel patterns as leaks without tracing whether they actually have no termination condition — false positives here are common and costly to chase.

Output format

## Correctness / concurrency issues
## Security issues
## Idiom / style issues
## Performance notes (only if in a demonstrably hot path)
## Suggestions

Quality checklist

  • Concurrency safety was traced (goroutine termination, shared state protection), not assumed
  • Context propagation was checked end-to-end for I/O paths
  • Errors are wrapped/compared idiomatically (%w, errors.Is/As)
  • Findings are ranked by real impact (bug > idiom), not treated as equally severe
  • No whole-file rewrite was proposed

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.