go-performance

go-performance is a skill for Claude Code from cxuu/golang-skills. It costs 62 tokens per session (1,218 once invoked), scanned A, original, Apache-2.0.

Guidance for making Go code faster, especially in frequently executed sections called hot paths. It covers string conversion, repeated string-to-byte conversion, container capacity, benchmarking, and profiling.

In plain words
What is it for?
Use it when investigating slow Go code, optimizing loops or string handling, writing performance-sensitive code, or comparing benchmark results.
Why use it?
It helps find changes that reduce running time or memory allocations without optimizing code that does not matter. It also provides ways to compare performance changes.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the golang-skills plugin — 20 skills shipped together

Good fit Use it when investigating slow Go code, optimizing loops or string handling, writing performance-sensitive code, or comparing benchmark results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cxuu/golang-skills/go-performance
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.

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

Made for: Claude Code.

Or install golang-skills, the plugin that ships this one along with the rest of its 20 skills.

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/cxuu/golang-skills/go-performance/github.svg)](https://agentmods.dev/skills/cxuu/golang-skills/go-performance)
Your own site
<a href="https://agentmods.dev/skills/cxuu/golang-skills/go-performance"><img src="https://agentmods.dev/badge/skills/cxuu/golang-skills/go-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for go-performance

Your own site · 80×15
<a href="https://agentmods.dev/skills/cxuu/golang-skills/go-performance"><img src="https://agentmods.dev/badge/skills/cxuu/golang-skills/go-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,218 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 18 Mar 2026
  • Snyk pass 16 Mar 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00062 $0.01218
Opus 5 $0.00031 $0.00609
Sonnet 5 $0.00012 $0.00244
Haiku 4.5 $0.00006 $0.00122

Measured 11d ago against content hash ac5a1532acf9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/bench-compare.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/go-performance/SKILL.md · 144 lines

How it starts

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

Go Performance Patterns

Resource Routing

  • scripts/bench-compare.sh - Run when comparing benchmark results, saving baselines, or producing JSON benchmark metadata.
  • references/BENCHMARKS.md - Read when writing benchmarks, using benchstat, or profiling with pprof.
  • references/STRING-OPTIMIZATION.md - Read when optimizing string conversion, concatenation, or byte/string boundaries.

Performance-specific guidelines apply only to the hot path. Don't prematurely optimize—focus these patterns where they matter most.


Prefer strconv over fmt

When converting primitives to/from strings, strconv is faster than fmt:

s := strconv.Itoa(rand.Int()) // ~2x faster than fmt.Sprint()
Approach Speed Allocations
fmt.Sprint 143 ns/op 2 allocs/op
strconv.Itoa 64.2 ns/op 1 allocs/op

Avoid Repeated String-to-Byte Conversions

Convert a fixed string to []byte once outside the loop:

data := []byte("Hello world")
for b.Loop() { // Go 1.24+; use b.N loops only for older Go
    w.Write(data) // ~7x faster than []byte("...") each iteration
}

Prefer Specifying Container Capacity

Specify container capacity where possible to allocate memory up front. This minimizes subsequent allocations from copying and resizing as elements are added.

Map Capacity Hints

Provide capacity hints when initializing maps with make():

m := make(map[string]os.DirEntry, len(files))

Note: Unlike slices, map capacity hints do not guarantee complete preemptive allocation—they approximate the number of hashmap buckets required.

Slice Capacity

Provide capacity hints when initializing slices with make(), particularly when appending:

data := make([]int, 0, size)

Unlike maps, slice capacity is not a hint—the compiler allocates exactly that much memory. Subsequent append() operations incur zero allocations until capacity is reached.

Approach Time (100M iterations)
No capacity 2.48s
With capacity 0.21s

Read the full file on GitHub · 144 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago First seen · 144 lines · 62 tokens per session scan A ac5a1532acf9

Subscribe to this mod's changes

go-performance is a skill published in the GitHub repository cxuu/golang-skills (158 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 62 tokens to every session and 1,218 once invoked, about $0.0003 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-30.