Agent skill

Golang Performance

by unxed in unxed/f4

Golang performance optimization patterns and methodology - if X bottleneck, then apply Y.

MITAuto-check passedDevelopment

Install Golang Performance

skills CLI
$ npx skills add unxed/f4 --skill golang-performance -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install unxed/f4 golang-performance --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/unxed/f4.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/golang-performance .claude/skills/golang-performance && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
golang-performance
GitHub stars
244
Used in
3 other repos
Token cost
~2.4k tokens
SKILL.md length
921 words
Files
9 (incl. references, assets)
Skills in repo
36
Repo updated
First seen
Licence
MIT

At a glance

Golang performance optimization patterns and methodology - if X bottleneck, then apply Y.

  • Works in 3 steps: Profile before optimizing — intuition… → Allocation reduction yields the biggest… → Document optimizations — add code…
  • Benchmarks have identified a bottleneck and you need the right optimization pattern to fix it
  • SKILL.md covers Core Philosophy, Rule Out External Bottlenecks…, Iterative Optimization… and Decision Tree: Where Is Time…, plus 4 more sections
  • Calls go

What it does

Golang Performance is an agent skill from unxed/f4. Golang performance optimization patterns and methodology - if X bottleneck, then apply Y. Covers allocation reduction, CPU efficiency, memory layout, GC tuning, pooling, caching, and hot-path optimization. Use when profiling or benchmarks have identified a bottleneck and you need the right optimization pattern to fix it. Also use when performing performance code review to suggest improvements or benchmarks that could help identify quick performance gains. Not for measurement methodology (→ See…

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 11 other files, including reference files and assets (for example `assets/prometheus-alerts.yml`, `evals/evals.json` and `references/caching.md`). Compatibility notes: Designed for Claude Code, Codex or similar harness, and for projects using Golang.

It sits in Development, covering Performance optimization and Caching. It works with Go. The repository describes itself as: dual pane like a charm. The licence is MIT.

When your agent uses it

  • Benchmarks have identified a bottleneck and you need the right optimization pattern to fix it
  • Performing performance code review to suggest improvements
  • Benchmarks that could help identify quick performance gains

Example prompts

  • “/golang-performance”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang.
  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, Bash(benchstat:*), Bash(fieldalignment:*), Bash(staticcheck:*), Bash(curl:*), Bash(fgprof:*), Bash(perf:*), WebSearch, AskUserQuestion, EnterWorktree, ExitWorktree

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Profile before optimizing — intuition about bottlenecks is wrong ~80% of the time. Use pprof to find actual hot spots (→ See…
  2. Allocation reduction yields the biggest ROI — Go's GC is fast but not free. Reducing allocations per request often matters more than…
  3. Document optimizations — add code comments explaining why a pattern is faster, with benchmark numbers when available. Future readers need…

What it can do on your machine

Read from SKILL.md and the folder at commit 447642e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • Grep
    • Bash(go:*)
    • Bash(golangci-lint:*)
    • Bash(git:*)
    • Agent
    • WebFetch

    …and 10 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code, Codex or similar harness, and for projects using Golang.

    From compatibility in the SKILL.md frontmatter.

Context cost

Golang Performance loads about 2.4k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 163 tokens; SKILL.md has 921 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~163
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~20k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from unxed/f4 at commit 447642e, republished under its MIT licence (© unxed). 921 words, ~2,354 tokens.

Download SKILL.mdSave it as .claude/skills/golang-performance/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
golang-performance
description
Golang performance optimization patterns and methodology - if X bottleneck, then apply Y. Covers allocation reduction, CPU efficiency, memory layout, GC tuning, pooling, caching, and hot-path optimization. Use when profiling or benchmarks have identified a bottleneck and you need the right optimization pattern to fix it. Also use when performing performance code review to suggest improvements or benchmarks that could help identify quick performance gains. Not for measurement methodology (→ See `samber/cc-skills-golang@golang-benchmark` skill) or debugging workflow (→ See `samber/cc-skills-golang@golang-troubleshooting` skill).
allowed-tools
Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, Bash(benchstat:*), Bash(fieldalignment:*), Bash(staticcheck:*), Bash(curl:*), Bash(fgprof:*), Bash(perf:*), WebSearch, AskUserQuestion, EnterWorktree, ExitWorktree
compatibility
Designed for Claude Code, Codex or similar harness, and for projects using Golang.
user-invocable
true
license
MIT
metadata.author
samber
metadata.version
1.3.2
paths
**/*.go

Persona: You are a Go performance engineer. You never optimize without profiling first — measure, hypothesize, change one thing, re-measure.

Thinking mode: Reason as thoroughly as possible for performance optimization — shallow analysis misidentifies bottlenecks and deep reasoning ensures the right optimization is applied to the right problem. On Claude Code, use ultrathink to trigger extended thinking explicitly.

Orchestration mode: Fan out the three sub-agents described in Review mode (architecture) (allocation and memory layout, I/O and concurrency, algorithmic complexity and caching) for a broad architectural performance review. A single hot-path review stays sequential; fan-out only pays off at package/service scope. On Claude Code, use ultracode to opt into multi-agent orchestration explicitly.

Modes:

  • Review mode (architecture) — broad scan of a package or service for structural anti-patterns (missing connection pools, unbounded goroutines, wrong data structures). Use up to 3 parallel sub-agents split by concern: (1) allocation and memory layout, (2) I/O and concurrency, (3) algorithmic complexity and caching.
  • Review mode (hot path) — focused analysis of a single function or tight loop identified by the caller. Work sequentially; one sub-agent is sufficient.
  • Optimize mode — a bottleneck has been identified by profiling. Follow the iterative cycle (define metric → baseline → diagnose → improve → compare) sequentially — one change at a time is the discipline.

Dependencies:

  • benchstat: go install golang.org/x/perf/cmd/benchstat@latest

Go Performance Optimization

Core Philosophy

  1. Profile before optimizing — intuition about bottlenecks is wrong ~80% of the time. Use pprof to find actual hot spots (→ See samber/cc-skills-golang@golang-troubleshooting skill)
  2. Allocation reduction yields the biggest ROI — Go's GC is fast but not free. Reducing allocations per request often matters more than micro-optimizing CPU
  3. Document optimizations — add code comments explaining why a pattern is faster, with benchmark numbers when available. Future readers need context to avoid reverting an "unnecessary" optimization

Rule Out External Bottlenecks First

Before optimizing Go code, verify the bottleneck is in your process — if 90% of latency is a slow DB query or API call, reducing allocations won't help.

Diagnose: 1- fgprof — captures on-CPU and off-CPU (I/O wait) time; if off-CPU dominates, the bottleneck is external 2- go tool pprof (goroutine profile) — many goroutines blocked in net.(*conn).Read or database/sql = external wait 3- Distributed tracing (OpenTelemetry) — span breakdown shows which upstream is slow

When external: optimize that component instead — query tuning, caching, connection pools, circuit breakers (→ See samber/cc-skills-golang@golang-database skill, Caching Patterns).

Iterative Optimization Methodology

The cycle: Define Goals → Benchmark → Diagnose → Improve → Benchmark
  1. Define your metric — latency, throughput, memory, or CPU? Without a target, optimizations are random
  2. Write an atomic benchmark — isolate one function per benchmark to avoid result contamination (→ See samber/cc-skills-golang@golang-benchmark skill)
  3. Measure baseline — go test -bench=BenchmarkMyFunc -benchmem -count=6 ./pkg/... | tee /tmp/report-1.txt
  4. Diagnose — use the Diagnose lines in each deep-dive section to pick the right tool
  5. Improve — apply ONE optimization at a time with an explanatory comment
  6. Compare — benchstat /tmp/report-1.txt /tmp/report-2.txt to confirm statistical significance
  7. Commit — paste the benchstat output in the commit body so reviewers and future readers see the exact improvement; follow the perf(scope): summary commit type
  8. Repeat — increment report number, tackle next bottleneck

Refer to library documentation for known patterns before inventing custom solutions. Keep all /tmp/report-*.txt files as an audit trail.

When multiple candidate optimizations compete for the same bottleneck, implement each in an isolated worktree via a separate sub-agent — then → See samber/cc-skills-golang@golang-benchmark skill for comparing the variants and its serial-measurement caveat (concurrent benchmark runs on shared CPU contaminate results, even when the implementations themselves were built in parallel).

Show full SKILL.md (349 more words)Show less

Decision Tree: Where Is Time Spent?

BottleneckSignal (from pprof)Action
Too many allocationsalloc_objects high in heap profileMemory optimization
CPU-bound hot loopfunction dominates CPU profileCPU optimization
GC pauses / OOMhigh GC%, container limitsRuntime tuning
Network / I/O latencygoroutines blocked on I/OI/O & networking
Repeated expensive worksame computation/fetch multiple timesCaching patterns
Wrong algorithmO(n²) where O(n) existsAlgorithmic complexity
Lock contentionmutex/block profile hot→ See samber/cc-skills-golang@golang-concurrency skill
Slow queriesDB time dominates traces→ See samber/cc-skills-golang@golang-database skill

Common Mistakes

MistakeFix
Optimizing without profilingProfile with pprof first — intuition is wrong ~80% of the time
Default http.Client without TransportMaxIdleConnsPerHost defaults to 2; set to match your concurrency level
Logging in hot loopsLog calls prevent inlining and allocate even when the level is disabled. Use slog.LogAttrs
panic/recover as control flowpanic allocates a stack trace and unwinds the stack; use error returns
unsafe without benchmark proofOnly justified when profiling shows >10% improvement in a verified hot path
No GC tuning in containersSet GOMEMLIMIT to 80-90% of container memory to prevent OOM kills
reflect.DeepEqual in production50-200x slower than typed comparison; use slices.Equal, maps.Equal, bytes.Equal

Deep Dives

  • Memory Optimization — allocation patterns, backing array leaks, sync.Pool, struct alignment
  • CPU Optimization — inlining, cache locality, false sharing, ILP, reflection avoidance
  • I/O & Networking — HTTP transport config, streaming, JSON performance, cgo, batch operations
  • Runtime Tuning — GOGC, GOMEMLIMIT, GC diagnostics, GOMAXPROCS, PGO
  • Caching Patterns — algorithmic complexity, compiled patterns, singleflight, work avoidance
  • Production Observability — Prometheus metrics, PromQL queries, continuous profiling, alerting rules

CI Regression Detection

Automate benchmark comparison in CI to catch regressions before they reach production. → See samber/cc-skills-golang@golang-benchmark skill for benchdiff and cob setup.

Cross-References

  • → See samber/cc-skills-golang@golang-benchmark skill for benchmarking methodology, benchstat, and b.Loop() (Go 1.24+)
  • → See samber/cc-skills-golang@golang-troubleshooting skill for pprof workflow, escape analysis diagnostics, and performance debugging
  • → See samber/cc-skills-golang@golang-data-structures skill for slice/map preallocation and strings.Builder
  • → See samber/cc-skills-golang@golang-concurrency skill for worker pools, sync.Pool API, goroutine lifecycle, and lock contention
  • → See samber/cc-skills-golang@golang-safety skill for defer in loops, slice backing array aliasing
  • → See samber/cc-skills-golang@golang-database skill for connection pool tuning and batch processing
  • → See samber/cc-skills-golang@golang-observability skill for continuous profiling in production

© unxed, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 8 other files (references, assets) in .agents/skills/golang-performance of unxed/f4.

  • SKILL.md
  • assets/prometheus-alerts.yml
  • evals/evals.json
  • references/caching.md
  • references/cpu.md
  • references/io-networking.md
  • references/memory.md
  • references/observability.md
  • references/runtime.md

Open the folder on GitHubat commit 447642e

Used in 3 other repositories

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in unxed/f4, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Golang Performance next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Golang Performance compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Golang Performance this skillunxed/f42443 repos~2.4kAutomated safety check: PassMIT
Caffeine Cache Optimization Experimentsben-manes/caffeine18k—~2.6kAutomated safety check: NotesApache-2.0
Keybase RPC Log Analysiskeybase/client9.3k—~3kAutomated safety check: PassBSD-3-Clause
Performance CheckZeroDeng01/sublinkPro1.7k—~1.8kAutomated safety check: PassMIT
Climber Step Minimizationben-manes/caffeine18k—~3kAutomated safety check: NotesApache-2.0
Go Guidelinesmhmtszr/go-guidelines104—~885Automated safety check: WarnMIT

Similar skills

  • Runs controlled JMH experiments on the Caffeine cache to find shared contention and hot-path waste, then reviews correctness and returns a reviewable patch.

    18k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check: notes
  • Captures a clean Keybase service log and analyzes it for redundant, duplicated or looping RPCs, then checks whether a caching fix reduced the calls.

    9.3k GitHub stars~3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Performance Check

    ZeroDeng01/sublinkPro

    Checklist for reviewing code changes that touch queries, APIs, rendering, caching or algorithms for performance, scalability and resource-usage problems.

    1.7k GitHub stars~1.8k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Climber Step Minimization

    ben-manes/caffeine

    Prices each step of the window climber algorithm by disabling it in turn, to find steps that no longer earn their keep and branches that no longer fire.

    18k GitHub stars~3k tokensUpdated today
    DevelopmentAuto-check: notes
  • Go Guidelines

    mhmtszr/go-guidelines

    Applies version-aware Go guidance when writing or reviewing Go code, loading only the reference files that match the task, from syntax and performance to concurrency and testing.

    104 GitHub stars~885 tokensUpdated 1 mo ago
    DevelopmentAuto-check: warnings
  • Searches synthetic workloads for cases where Caffeine's adaptive eviction policy falls short of its achievable hit rate, then classifies each gap by cause.

    18k GitHub stars~18k tokensUpdated today
    DevelopmentAuto-check: notes

More from unxed/f4

All 36 skills in this repo
  • Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt.

    244 GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check passed
  • Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt.

    244 GitHub starsUsed in 3 repos~2.5k tokens
    Auto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    244 GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed
  • Security audit checklist based on OWASP Top 10 and best practices.

    244 GitHub stars~5.4k tokensUpdated today
    Auto-check: notes
  • Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters, functional options, acronyms, test functions, and…

    244 GitHub starsUsed in 2 repos~3.1k tokens
    Auto-check passed
  • Golang concurrency design — goroutine lifecycle and leak prevention, channels and select, channel ownership and direction, sync.Mutex/RWMutex/sync.Map/sync.Once/atomics, errgroup, singleflight…

    244 GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed

Works with

Categories

Questions about Golang Performance

What does Golang Performance do?

Golang performance optimization patterns and methodology - if X bottleneck, then apply Y. Golang Performance is an agent skill from unxed/f4. Golang performance optimization patterns and methodology - if X bottleneck, then apply Y.

When should I use Golang Performance?

Golang Performance fits situations like: benchmarks have identified a bottleneck and you need the right optimization pattern to fix it; performing performance code review to suggest improvements; benchmarks that could help identify quick performance gains.

How do I install Golang Performance in Claude Code?

Run `npx skills add unxed/f4 --skill golang-performance -a claude-code`. Or copy the skill folder (.agents/skills/golang-performance in unxed/f4) into .claude/skills/golang-performance in your project. Claude Code loads it when a task matches its description.

How do I install Golang Performance in Codex?

Run `npx skills add unxed/f4 --skill golang-performance -a codex`. Or copy the skill folder (.agents/skills/golang-performance in unxed/f4) into .agents/skills/golang-performance in your project. Codex loads it when a task matches its description.

Can I use Golang Performance in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add unxed/f4 --skill golang-performance -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-performance, .gemini/skills/golang-performance, .github/skills/golang-performance and .opencode/skills/golang-performance in your project.

What does Golang Performance need to run?

Going by SKILL.md and its folder, Golang Performance needs the command-line tools its instructions call (go). Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, Bash(benchstat:*), Bash(fieldalignment:*), Bash(staticcheck:*), Bash(curl:*), Bash(fgprof:*), Bash(perf:*), WebSearch, AskUserQuestion, EnterWorktree, ExitWorktree. Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang..

Does Golang Performance access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Golang Performance safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Golang Performance use?

Golang Performance is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Golang Performance use?

About 2.4k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18k tokens, read only when the agent opens those files.

What are the alternatives to Golang Performance?

Skills that share tags, products or a category with Golang Performance: Caffeine Cache Optimization Experiments (ben-manes/caffeine, 18k stars), Keybase RPC Log Analysis (keybase/client, 9.3k stars), Performance Check (ZeroDeng01/sublinkPro, 1.7k stars) and Climber Step Minimization (ben-manes/caffeine, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Golang Performance?

unxed (a GitHub user) maintains it in unxed/f4, which has 244 GitHub stars. The repository holds 36 skills in this directory. The repository was last updated on October 10, 2026.

Source: unxed/f4 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.