coding-agents
Go Performance Skill: Stop Guessing, Start Benchmarking
Discover how the go-performance agent skill helps developers optimize Go code with benchmark-driven patterns and strconv over fmt.
Where this fits
You're reviewing a pull request and spot a for loop that builds a string with +=. It works, but something feels off. Or you're profiling a service that's slower than expected, and you suspect the hot path is doing unnecessary allocations. The go-performance skill steps in exactly here: it gives your coding agent the knowledge and scripts to turn vague "this is slow" complaints into benchmark-driven, concrete optimizations—without touching concurrency, which is handled by a separate skill.
Why agents benefit
- Detects implicit performance issues: The skill triggers on mentions of slow Go code or string concatenation in loops, even if you don't explicitly ask for optimization. Your agent will proactively suggest a benchmark before changing anything.
- Runs real benchmarks, not guesses: It includes
scripts/bench-compare.shto compare before/after results, save baselines, and emit JSON metadata—so you get evidence, not opinions. - Knows the right pattern for the job: It routes to
references/STRING-OPTIMIZATION.mdfor string/byte boundaries andreferences/BENCHMARKS.mdfor pprof and benchstat, so the agent applies the correct technique for the specific bottleneck. - Avoids premature optimization: The skill explicitly scopes performance patterns to the hot path. Your agent will resist micro-optimizing cold code, keeping the diff focused and reviewable.
- Uses
strconvoverfmtwhen it matters: For primitive-to-string conversions, the skill teaches the ~2x fasterstrconv.Itoa()approach, with allocation metrics to justify the change.
Practical scenarios
A user reports "my API endpoint is slow"
Instead of guessing, the agent reads references/BENCHMARKS.md, writes a micro-benchmark for the suspected handler, runs it with -benchmem, and identifies the allocation-heavy line. It then applies a targeted fix—like preallocating a slice—and re-runs the benchmark to show the improvement.
A code review flags string concatenation in a loop
Your agent sees s += fmt.Sprintf(...) inside a loop. It recognizes the pattern from the skill description, switches to strings.Builder or strconv for numeric parts, and adds a benchmark to prove the change doesn't regress. The review comment becomes a data-backed suggestion.
A developer asks "should I use fmt.Sprintf or strconv?"
The skill's reference table gives a clear answer: strconv wins on speed and allocations for simple conversions. The agent can generate a quick comparison benchmark using the provided script and show the numbers, making the decision obvious.
Add it to your agent workflow
Install the skill with a single command:
npx skills add cxuu/golang-skills --skill go-performance
Then, in your agent's instructions or tools list, enable the skill for Go-related tasks. For example, when a user says "this function is slow," your agent will automatically:
- Read
references/BENCHMARKS.mdfor profiling guidance. - Write a benchmark against the current implementation.
- Apply a pattern from the skill (e.g.,
strconvoverfmt). - Run
scripts/bench-compare.shto produce a before/after comparison.
Compare before adopting
Before adding this skill to your agent's toolbox, check:
- Quality signals: Look at the GitHub repo (156 stars, active maintenance) and the clarity of the README. Does it have concrete examples and scripts, or just vague advice?
- Maintenance freshness: Verify the last commit date. Skills that stagnate can become liabilities.
- Alternatives: Other Go optimization skills exist, but few come with a benchmark comparison script built in. That's a differentiator.
- Workflow fit: Does your agent already handle concurrency separately? This skill explicitly excludes concurrent patterns, so ensure you pair it with
go-concurrencyif needed.
Why it is worth tracking
The go-performance skill is a solid example of a focused, evidence-driven coding skill. Its star count and the presence of reusable scripts indicate community trust. As the skill ecosystem grows, tracking how this one evolves—especially its benchmark tooling and pattern references—will tell you if it stays ahead of Go's performance best practices. It's worth evaluating now, and if your team writes Go, it's likely to become a permanent part of your agent's workflow. For more agent skills like this, browse the OpenAgentSkill directory to see how it compares with other coding-focused skills.
Featured Skill
go-performance
Skill by cxuu