AgentLint Verified 100/100210 Go repos analyzed

    Go CLAUDE.md & AGENTS.md Template

    Table-driven tests, race detector flags, and explicit error wrapping from 210 Go repos.

    # Go Project — Go Service Harness
    
    Go 1.23 service using standard library HTTP/gRPC patterns, `golangci-lint`, and race-checked tests.
    
    ## Commands
    
    - Fast targeted test: `go test ./internal/pkg/... -run TestTarget -v`
    - Full race-checked suite: `go test -race ./...`
    - Lint & vet: `golangci-lint run && go vet ./...`
    - Build: `go build ./...`
    
    ## Rules
    
    - Don't discard errors with `_` or log-and-continue silently. Instead wrap and return them with `fmt.Errorf("context: %w", err)`. Because swallowed errors obscure root causes in production traces.
    - Don't add third-party frameworks when the Go standard library solves the problem cleanly. Instead prefer `net/http`, `context`, and `slog`. Because minimal dependencies keep binaries auditable.
    - Write table-driven unit tests for every exported function and run `go test -race` before finalizing concurrency edits.
    - When editing protobuf schemas, read `proto/README.md` before regenerating stubs.
    
    ## Continuity
    
    - Keep `.env` and `CLAUDE.local.md` gitignored and summarize open items in `HANDOFF.md`.

    Most Adopted Go Rules Across Real Open-Source Repos

    Measured across 210 public Go repositories in the 4,533-repo harness study:

    unit-teststesting

    Write unit tests for all changes

    44.3%93 repos
    error-handlingpatterns

    Proper error handling with context

    38.1%80 repos
    golangci-linttooling

    Use golangci-lint

    34.8%73 repos
    dockertooling

    Docker for containerization

    34.8%73 repos
    conventional-commitsworkflow

    Use conventional commit messages

    29.0%61 repos
    error-wrappingpatterns

    Wrap errors with context using %w

    27.6%58 repos
    go-vettooling

    Run go vet before committing

    26.7%56 repos
    testifytesting

    Use testify for assertions

    24.3%51 repos
    Essential Commands (Checks W1 & W7)
    install
    go mod download
    fastTest
    go test ./pkg/target/... -run TestName -v
    fullTest
    go test -race ./...
    lint
    golangci-lint run && go vet ./...
    build
    go build ./...
    Common Go Agent Pitfalls
    • 01Agents ignore returned error values with _ or swallow context without fmt.Errorf("...: %w", err).
    • 02Skipping -race hides goroutine data races until production load.

    More Verified Stack Templates