Go Performance

🌐Community
by cxuu Β· vlatest Β· Repository

Helps with Go, performance optimization as part of agent workflows workflows.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add go-performance npx -- -y @trustedskills/go-performance
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "go-performance": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/go-performance"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill provides guidance and tools for optimizing Go program performance within an agent workflow. It focuses on identifying and addressing bottlenecks in critical code sections ("hot paths") through techniques like using strconv instead of fmt for string conversions, avoiding repeated string-to-byte conversions, specifying container capacity when initializing maps and slices, and choosing appropriate string concatenation methods. The skill includes a script to benchmark Go code and compare results.

When to use it

  • When debugging slow Go applications or services.
  • During performance reviews of existing Go codebases.
  • To optimize specific functions or loops identified as bottlenecks.
  • When needing to improve the efficiency of string manipulation operations in Go.
  • Before deploying a Go application to production, to ensure optimal resource usage.

Key capabilities

  • Benchmarking: Runs Go benchmarks using bench-compare.sh with optional baseline comparison via benchstat. Results can be saved for future comparisons.
  • String Conversion Optimization: Recommends using strconv over fmt for string conversions due to performance differences.
  • Byte Conversion Optimization: Suggests converting strings to byte slices once outside of loops to avoid repeated allocations.
  • Container Capacity Hints: Provides guidance on specifying capacity when initializing maps and slices with make().
  • Pass-by-Value Guidance: Offers advice on avoiding unnecessary pointer usage in function arguments for small, fixed-size types like strings.
  • String Concatenation Strategies: Suggests choosing the appropriate string concatenation method (+, fmt.Sprintf, strings.Builder, strings.Join, backtick literals) based on complexity and context.

Example prompts

  • "Analyze this Go code snippet for performance bottlenecks."
  • "Benchmark this function using the provided script, comparing it to a previous version."
  • "Suggest ways to optimize string conversions in this loop."
  • "How can I improve the allocation efficiency of this map initialization?"

Tips & gotchas

  • Focus optimization efforts on "hot paths"β€”the most frequently executed code sections. Premature optimization elsewhere is discouraged.
  • The bench-compare.sh script requires bash execution and may have specific command line options (run with --help).
  • Map capacity hints are approximations, not guarantees of complete preemptive allocation.

Tags

πŸ›‘οΈ

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates β€” what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
cxuu
Installs
100

🌐 Community

Passed automated security scans.