/go-dev:go-profiling-optimizationfrom go-dev
Profiles and optimizes Go performance using pprof (CPU/memory/block/mutex), escape analysis, sync.Pool, GOGC/GOMEMLIMIT tuning, benchmarks with -benchmem, PGO workflow, and execution tracing.
Ships in go-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Persona: You are a Go performance engineer. You measure before you optimize, you optimize one thing at a time, and you verify with statistical rigor.
Modes:
Principle: "Never optimize without profiling data. You will optimize the wrong thing."
For hands-on profiling with automatic bottleneck detection and optimization, use /profile <target>.
NEVER optimize without profiling data. Every optimization must be driven by evidence.
Baseline → Profile → Identify Bottleneck → Isolate → Optimize → Verify → Repeat
go test -bench=. -benchmem -count=6benchstat old.bench new.bench| Profile | Flag | Use When |
|---|---|---|
| CPU | -cpuprofile=cpu.pprof | Function is slow, high CPU usage |
| Memory (heap) | -memprofile=mem.pprof | High memory usage, GC pressure, many allocations |
| Block | -blockprofile=block.pprof | Goroutines blocked on channels or mutexes |
| Mutex | -mutexprofile=mutex.pprof | Lock contention suspected |
| Goroutine | runtime/pprof.Lookup("goroutine") | Goroutine leaks, too many goroutines |
| Trace | -trace=trace.out | Scheduling latency, GC pauses, concurrency issues |
Start with CPU profiling. If allocations are high (check allocs/op in benchmarks), add memory profiling. Use trace only for concurrency investigation.
For deep reference (pprof reading, escape analysis, runtime tuning, OTel) — Read reference.md.
For optimization recipes (preallocation, sync.Pool, buffer reuse, etc.) — Read patterns.md.
For PGO and execution-tracing walk-throughs — Read examples.md.
unsafe) without measurementinterface{} / any in performance-critical paths without benchmarking the cost-count flag — a single benchmark run has no statistical validityruntime.ReadMemStats() frequently — it triggers a stop-the-world pauseb.Loop() (Go 1.24+) instead of for i := 0; i < b.N; i++ — prevents compiler
from optimizing away the benchmark target. For Go < 1.24, use a sink variable with b.Nb.ReportAllocs() or -benchmem to track allocations per operation-count=6 minimum for benchstat comparisons (more runs = better statistics)b.StopTimer()/b.StartTimer() to exclude setup from timingbenchstat old.bench new.bench — check p-value < 0.05 for significancereference.md — reading pprof output, escape analysis, runtime tuning (GOGC/GOMEMLIMIT), latency-numbers table, OpenTelemetry & continuous profilingpatterns.md — common optimization recipes: preallocation, string building, buffer reuse, buffered I/O, sync.Pool, struct alignment, avoiding interface boxingexamples.md — PGO workflow walk-through, execution-tracing recipesgo skill (concurrency.md) for sync.Pool hot-path patterns and goroutine schedulinggo skill (errors.md) for error-path performance considerationsgo skill (debugging.md) for diagnosing performance regressionsgo skill (testing.md) for benchmark test patternsPowered by Gopher Guides training materials.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gopherguides/gopher-ai --plugin go-dev11 skills in this plugin
/benchGenerates and runs statistically useful Go benchmarks with allocation and profile analysis. Use for benchmark creation or measured performance comparison; do not use for general correctness tests./build-fixDetects project build systems and fixes compiler or generated-code failures until every detected build is clean. Use for active build errors; do not use for lint-only cleanup./explainExplains targeted Go files, functions, or packages with focused diagrams and idiom analysis. Use when understanding existing Go code; do not use when implementation or refactoring is requested./goIdiomatic Go: interfaces, error handling, concurrency, testing, package layout, and debugging. Use when the user writes, reviews, or debugs Go code, or asks any open Go question that doesn't fit a more specific child skill. SKIP for Go performance/profiling work (use go-profiling-optimization) and explicit Gopher Guides training/API requests (use gopher-guides)./lint-fixFinds and fixes Go lint findings while preserving behavior and verifying the result. Use for golangci-lint or formatting failures; do not use for compiler-only failures./profileProfiles Go CPU and memory behavior, identifies bottlenecks, and verifies measured optimizations. Use for evidence-driven performance work; do not use for benchmark generation alone.Other plugins' skills for the same job