AgentStack
SKILL verified MIT Self-run

Go Performance Review

skill-johnqtcg-awesome-skills-go-performance-review · by johnqtcg

Review Go code for performance issues including slice/map pre-allocation, string concatenation, N+1 queries, connection pool configuration, sync.Pool, memory alignment, lock scope, buffered I/O, and HTTP transport tuning. Trigger when code contains make(), loops, database queries, string building, sync primitives, HTTP clients, or hot-path operations. Use for performance-focused review.

No reviews yet
0 installs
17 views
0.0% view→install

Install

$ agentstack add skill-johnqtcg-awesome-skills-go-performance-review

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Go Performance Review? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Go Performance Review

Purpose

Identify performance issues and resource inefficiency in Go code. This skill exists because performance findings are almost all Medium severity and get systematically crowded out when mixed with High-severity Security/Concurrency findings.

Important distinction: lock contention is performance (here); race condition is concurrency (go-concurrency-review).

This skill does NOT cover: security, concurrency correctness, code style, test quality, error handling, or business logic — those belong to sibling vertical skills.

When To Use

  • Code contains make([]T, ...) or make(map[K]V, ...)
  • Code builds strings in loops
  • Code queries DB/Redis inside loops
  • Code configures connection pools or HTTP clients
  • Code runs on hot paths (per-request, high-frequency)

When NOT To Use

  • Security vulnerabilities → go-security-review
  • Race conditions, goroutine leaks → go-concurrency-review
  • Code style/lint → go-quality-review
  • Error handling → go-error-review

Mandatory Gates

1) Go Version Gate

Read go.mod. Key: strings.Clone (1.20+), slices.Clone (1.21+).

2) Anti-Example Suppression Gate

MUST quote specific evidence. Category match alone insufficient.

Embedded anti-examples:

  • "Should pre-allocate slice" — when slice is small ( 0 (seeded reference tables, system lookups). | \.Count\(& (compound: confirm .Find\( also present in same function AND no if.*total.*==.*0 or if total == 0 early-exit guard) |

Severity Rubric

Medium — Performance issue impacting latency, throughput, or resource usage under load.

Low — Minor optimization with limited real-world impact.

Evidence Rules

  • Quantify when possible: "N+1 executes N round-trips", "slice grows through log2(N) allocations"
  • For pre-allocation: state the known upper bound and current allocation
  • Hot-path requirement: cite evidence code runs frequently (per-request, in loop, high-QPS handler)
  • Do NOT flag cold-path optimizations
  • Merge rule: same issue at ≥3 locations → one finding with location list

Output Format

Findings

[Medium|Low] Short Title
  • ID: PERF-NNN
  • Location: path:line
  • Impact: Quantified performance consequence (allocations, syscalls, round-trips)
  • Evidence: Current code vs optimal pattern
  • Recommendation: Specific fix with code example
  • Action: follow-up (performance issues are rarely must-fix)

Suppressed Items

[Suppressed] Short Title
  • Reason: Anti-example matched + evidence cited (cold-path, small size, etc.)

Execution Status

  • Go version: X.Y
  • Grep pre-scan: X/11 items hit, Z confirmed as findings (2 semantic-only)
  • Excluded (generated): list or None
  • References loaded: list

Summary

1-2 lines. Count by severity.

Example Output

### Findings

#### [Medium] Slice Pre-allocation Missing in Hot Path
- **ID:** PERF-001
- **Location:** `internal/service/batch.go:42`
- **Impact:** len(userIDs) allocations per request instead of 1 — slice grows via append in loop processing user batch
- **Evidence:** `results := make([]User, 0)` at L42; `results = append(results, user)` in loop at L48; `len(userIDs)` is known at L40
- **Recommendation:** `results := make([]User, 0, len(userIDs))`
- **Action:** follow-up

#### [Medium] N+1 Query in Order Processing
- **ID:** PERF-002
- **Location:** `internal/service/order.go:55-60`
- **Impact:** N database round-trips per batch — one SELECT per order item
- **Evidence:** `for _, item := range items { product, _ := repo.GetProduct(ctx, item.ProductID) }` — N individual queries
- **Recommendation:** Batch: `products, err := repo.GetProductsByIDs(ctx, productIDs)` with `WHERE id IN (?)`
- **Action:** follow-up

### Suppressed Items
#### [Suppressed] Slice Pre-allocation in Config Loading
- **Reason:** `make([]Plugin, 0)` at config.go:12 — cold path (called once at startup, typically <5 plugins). Anti-example: "small slice in cold path"

### Execution Status
- Go version: 1.21
- Excluded (generated): None
- References loaded: go-performance-patterns.md, go-database-patterns.md

### Summary
2 Medium findings (slice pre-allocation, N+1 query). Cold-path items suppressed.

No-Finding Case

If no issues found: state No performance findings identified. Still output Execution Status.

Load References Selectively

| Reference | Load When | |-----------|-----------| | references/go-performance-patterns.md | Always | | references/go-database-patterns.md | Code involves database queries, connection pools | | references/go-review-anti-examples.md | Always |

Review Discipline

  • Performance only — not security, concurrency, quality, tests, errors, or logic
  • Execute ALL 13 checklist items — this is the most commonly skipped dimension; isolation solves that
  • Distinguish hot-path vs cold-path: only flag frequently executed code
  • Quantify impact — "costs N allocations per request" is better than "suboptimal"

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.