go-performance

go-performance is a skill for Claude Code, Codex from muratmirgun/gophers. It costs 89 tokens per session (2,041 once invoked), scanned A, original, MIT.

A guide for measuring and improving the speed and memory use of Go programs. It uses benchmarks and profiles, which show where a program spends time or allocates memory.

In plain words
What is it for?
Use it to benchmark hot code paths, inspect CPU or memory bottlenecks, reduce allocations, tune common string and formatting operations, and compare repeated runs.
Why use it?
It replaces guesses about performance with measurements and an orderly way to test whether each change actually helps.

Skill for Claude CodeCodex

Part of the gophers plugin — 26 skills, 4 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/muratmirgun/gophers/go-performance
Any agent
npx skills add muratmirgun/gophers --skill go-performance
Clone the repo
git clone --depth 1 https://github.com/muratmirgun/gophers

Made for: Claude Code, Codex.

Or install gophers, the plugin that ships this one along with the rest of its 26 skills, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for go-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/muratmirgun/gophers/go-performance.svg)](https://agentmods.dev/skills/muratmirgun/gophers/go-performance)
Your own site
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-performance"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-performance.svg" alt="Measured on agentmods" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,041 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00089 $0.02041
Opus 5 $0.00044 $0.01020
Sonnet 5 $0.00018 $0.00408
Haiku 4.5 $0.00009 $0.00204

Measured 5d ago against content hash e8dbde142911, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

go-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude-plugin/skills/go-performance/SKILL.md · 187 lines

How it starts

The opening of the file, as written. The whole thing — 187 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go Performance

Performance work in Go follows one rule: measure first. Intuition about bottlenecks is wrong roughly 80% of the time. Profile, hypothesise, change one thing, re-measure. The patterns in this skill apply only on hot paths — premature optimisation makes code worse without making it faster.

Core Rules

  1. Profile before optimising. go test -bench, pprof, fgprof — never guess.
  2. One change at a time. Multi-change "optimisation" passes are unreviewable.
  3. Compare with benchstat. Single runs lie; you need ≥6 runs to see signal.
  4. Allocation reduction usually beats CPU micro-optimisation — the GC is fast but not free.
  5. Rule out external bottlenecks first. If 90% of latency is the DB, faster Go code is irrelevant.
  6. Document optimisations in comments. Future readers will revert "ugly" code without context.

Iterative Methodology

The cycle is: define goal → write benchmark → measure baseline → diagnose → improve one thing → re-measure → commit with the diff.

# baseline
go test -bench=BenchmarkHotPath -benchmem -count=6 ./pkg/... | tee /tmp/report-1.txt

# (apply ONE change)

# compare
go test -bench=BenchmarkHotPath -benchmem -count=6 ./pkg/... | tee /tmp/report-2.txt
benchstat /tmp/report-1.txt /tmp/report-2.txt

If benchstat shows no statistically significant change, the optimisation didn't work — revert it. Keep the /tmp/report-*.txt files as an audit trail; paste the benchstat output in the commit body.

Read references/benchmarking-and-pprof.md for benchmark writing, pprof workflow, and b.Loop() (Go 1.24+).

Rule Out External Bottlenecks First

Before optimising any Go code, check that the bottleneck is actually in your process:

  • fgprof — captures on-CPU and off-CPU (I/O wait) time. If off-CPU dominates, the issue is elsewhere.
  • Goroutine profile — many goroutines blocked in net.(*conn).Read or database/sql means external I/O is the limit.
  • Distributed tracing — span breakdown shows which upstream is slow.

Read the full file on GitHub · 187 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 187 lines · 89 tokens per session scan A e8dbde142911

Subscribe to this mod's changes

go-performance is a skill published in the GitHub repository muratmirgun/gophers (8 stars, last pushed 24d ago), licensed MIT. It adds 89 tokens to every session and 2,041 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

go

Use when writing Go services, CLIs, or libraries. Covers idiomatic error wrapping, goroutine and context discipline, interface design, table-driven tests, and the race detector.

nimadorostkar/Claude-Skills-collection · 38 tokens

golang-pro

Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming…

Jeffallan/claude-skills · 95 tokens

developing-genkit-go

Develop AI-powered applications using Genkit in Go. Use when the user asks to build AI features, agents, flows, or tools in Go using Genkit, or when working with Genkit Go code involving generation, prompts, streaming, tool calling, or model providers.

google/skills · 60 tokens

programming

Applies strict, modern language practice (typed errors, exhaustive match, TDD) for Python, Rust, TypeScript, and Go. Use for work on .py, .rs, .ts, or .go files.

code-yeongyu/oh-my-openagent · 49 tokens

authoring-go-sdk-tasks

Writes Airflow task logic in Go using the Airflow Go SDK. Use when the user wants to implement Airflow tasks in Go, asks about BundleProvider/RegisterDags, the bundlev1 Registry/Dag interfaces, registering Go tasks (AddTask/AddTaskWithName), dependency injection by parameter type (context.Context, sdk.TIRunContext…

astronomer/agents · 165 tokens

deploying-go-sdk-bundles

Builds, packs, and deploys compiled Airflow Go SDK bundles so the ExecutableCoordinator can run them. Use when the user wants to compile a Go task bundle, asks about go build, go tool airflow-go-pack, the AFBNDL01 self-contained executable bundle, packing or inspecting a bundle, placing it under executablesroot…

astronomer/agents · 146 tokens