More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    go Best Practices Audit

    1

    Audit Go code for goroutine leaks, concurrency bugs, slice and allocation waste, and modern Go 1.21+ idioms that go vet and staticcheck do not flag.

    Free

    4 usesSecurity scanned
    go-best-practices-audit

    go-best-practices-audit

    Example session with this skill installed

    "Review this HTTP handler — it's in our hot path and we're seeing memory spikes."

    • Read your context and instructions
    • Compiled the go-best-practices-audit

    GO BEST PRACTICES AUDIT — handleSearch
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

    [HIGH] Unpre-allocated slice growth
    var results []SearchResult — nil slice, will realloc repeatedly.
    Fix: results := make([]SearchResult, 0, len(allDocuments))

    [HIGH] Quadratic string search on full document corpus
    strings.Contains in a loop over all documents is O(n*m).
    For 100K documents at 2KB each, this scans 200MB per request.
    Fix: Use an inverted index or full-text search (bleve, Elasticsearch).

    [MEDIUM] Missing context.Context propagation
    No request context — if the client disconnects, the search continues.
    Fix: Accept ctx context.Context and check ctx.Err() in the loop.

    [MEDIUM] No error handling on json.Encode
    json.NewEncoder(w).Encode(results) — encode error is ignored.
    Fix: if err := json.NewEncoder(w).Encode(results); err != nil { ... }

    [LOW] No input validation on query
    Emp

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The Problem

    Your Go service passes go vet and staticcheck with zero warnings. In production, it leaks goroutines on every failed HTTP request — growing memory by 2MB per minute until the OOM killer fires. A tight loop appends to a slice without pre-allocation, causing 40,000 heap allocations per request. An error from json.Unmarshal is assigned to _ and the service silently serves corrupted data. Your code reviewer catches none of these because they look like standard Go code. The issues are real but outside the scope of static analysis tools.

    What You Get

    • Concurrency audit that flags goroutine leaks (missing termination paths), context propagation gaps (no context on blocking I/O), channel misuse (unclosed channels, deadlock potential from circular dependencies), unprotected shared state (missing sync.Mutex), and WaitGroup ordering errors
    • Performance audit identifying slice pre-allocation opportunities, string concatenation in loops (O(n²) → strings.Builder), map pre-allocation, unnecessary interface boxing in hot paths, buffer reuse with sync.Pool, and JSON encoding inefficiency
    • Error handling audit catching ignored errors (assigned to _), broken error chains (fmt.Errorf with %v instead of %w), deferred functions that swallow errors, bare recover() without re-panic, and missing error variable declarations
    • Structural audit checking package cohesion, import grouping (goimports style), naming conventions (interfaces with -er suffix, no Hungarian notation), file structure (internal/, cmd/, doc.go), and custom error patterns
    • Modern Go (1.21+) adoption recommending min/max/clear built-ins, slices package (slices.Sort, slices.Contains, slices.Clone), maps package, structured logging with log/slog, and t.Cleanup() in tests
    • Verification checklist with go vet, go test -race, staticcheck, and golangci-lint validation steps, plus confirmation that every error return is handled or explicitly documented as ignored

    Why This Beats Prompting It Yourself

    When you ask an LLM to "review my Go code," it identifies surface-level issues (unused variables, missing error checks on well-known functions) but misses the architectural patterns: a goroutine that blocks on a channel send when the receiver has already returned, a function that calls get_node (the Go equivalent: accessing shared state without synchronization) in a hot loop, or a deferred function that overwrites an existing error. This skill applies a structured five-phase methodology that mirrors how senior Go engineers actually audit code — not a checklist of individual rules but a systematic sweep through architecture, performance, concurrency, error handling, and modern patterns.

    Example Session

    You: "Review this HTTP handler — it's in our hot path and we're seeing memory spikes."

    func handleSearch(w http.ResponseWriter, r *http.Request) {
        query := r.URL.Query().Get("q")
        var results []SearchResult
        for _, doc := range allDocuments {
            if strings.Contains(doc.Content, query) {
                results = append(results, doc)
            }
        }
        json.NewEncoder(w).Encode(results)
    }
    

    Agent output:

    GO BEST PRACTICES AUDIT — handleSearch
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
    [HIGH] Unpre-allocated slice growth
      var results []SearchResult — nil slice, will realloc repeatedly.
      Fix: results := make([]SearchResult, 0, len(allDocuments))
    
    [HIGH] Quadratic string search on full document corpus
      strings.Contains in a loop over all documents is O(n*m).
      For 100K documents at 2KB each, this scans 200MB per request.
      Fix: Use an inverted index or full-text search (bleve, Elasticsearch).
    
    [MEDIUM] Missing context.Context propagation
      No request context — if the client disconnects, the search continues.
      Fix: Accept ctx context.Context and check ctx.Err() in the loop.
    
    [MEDIUM] No error handling on json.Encode
      json.NewEncoder(w).Encode(results) — encode error is ignored.
      Fix: if err := json.NewEncoder(w).Encode(results); err != nil { ... }
    
    [LOW] No input validation on query
      Empty string matches everything — may be intentional but verify.
    
    VERDICT: 2 HIGH, 2 MEDIUM, 1 LOW — fix slice allocation before merge,
    optimize search strategy before production load.
    

    Use Cases

    • Pre-merge code review for Go services, CLIs, and libraries
    • Production incident postmortems involving goroutine leaks or memory growth
    • Performance optimization of hot paths (API handlers, data processing pipelines)
    • New team member onboarding to Go idioms and project conventions
    • Auditing legacy Go code before a major version upgrade

    Known Limitations

    The audit is static analysis — it does not run the code or measure actual memory/CPU usage. For memory allocation hotspots, pair this audit with go test -bench and pprof profiling. The concurrency audit can detect potential deadlock patterns but cannot guarantee deadlock freedom in complex distributed systems. Premature optimization warnings are calibrated to avoid flagging small slices and short loops that the compiler handles efficiently.

    The audit is static analysis — it does not run the code or measure actual memory/CPU usage. For memory allocation hotspots, pair this audit with go test -bench and pprof profiling. The concurrency audit can detect potential deadlock patterns but cannot guarantee deadlock freedom in complex distributed systems. Premature optimization warnings are calibrated to avoid flagging small slices and sh

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    4 uses

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 5 months ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Read Files
    Network Access
    Listed5 months ago
    Updated1 month ago

    What's inside

    Frequently Asked Questions

    While linters catch syntax errors, this skill evaluates structural design, concurrency safety, and the use of modern Go 1.21+ features like generic constraints and the slog package.

    This skill is optimized for LLMs with coding capabilities (such as GPT-4 or Claude 3.5) and can be integrated into any AI agent platform that supports custom skill sets or system instruction sets.

    Yes, the skill is specifically designed to recognize and implement the latest Go 1.21 and 1.22 idioms, including the clear() built-in and updated loop variable semantics.

    Upon purchase, you receive the production-ready prompt configuration and a set of instructions to immediately deploy the audit skill to your preferred AI agent environment.

    The skill is highly effective at identifying common concurrency pitfalls, such as improper WaitGroup placement, unbuffered channel deadlocks, and missing mutex locks in shared state.

    Updates are released periodically to reflect changes in the Go ecosystem and improvements in AI model reasoning; customers receive lifetime access to all future versions of the Go Best Practices Audit.

    New in Code Quality & Review