Back to Skills

go-performance

verified

Go performance optimization - profiling, benchmarks, memory management

View on GitHub

Marketplace

pluginagentmarketplace-go

pluginagentmarketplace/custom-plugin-go

Plugin

go-development-assistant

Repository

pluginagentmarketplace/custom-plugin-go
3stars

skills/go-performance/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-go/blob/main/skills/go-performance/SKILL.md -a claude-code --skill go-performance

Installation paths:

Claude
.claude/skills/go-performance/
Powered by add-skill CLI

Instructions

# Go Performance Skill

Optimize Go application performance with profiling and best practices.

## Overview

Comprehensive performance optimization including CPU/memory profiling, benchmarking, and common optimization patterns.

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| profile_type | string | yes | - | Type: "cpu", "memory", "goroutine", "block" |
| duration | string | no | "30s" | Profile duration |

## Core Topics

### pprof Setup
```go
import (
    "net/http"
    _ "net/http/pprof"
)

func main() {
    // Start pprof server
    go func() {
        http.ListenAndServe("localhost:6060", nil)
    }()

    // Your application
    runApp()
}
```

### CPU Profiling
```bash
# Collect 30s CPU profile
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30

# Interactive commands
(pprof) top 10          # Top 10 CPU consumers
(pprof) list funcName   # Source view
(pprof) web             # Open in browser
(pprof) svg > cpu.svg   # Export SVG
```

### Memory Profiling
```bash
# Heap profile
go tool pprof http://localhost:6060/debug/pprof/heap

# Allocs since start
go tool pprof http://localhost:6060/debug/pprof/allocs

(pprof) top --cum       # By cumulative allocations
(pprof) list funcName   # Where allocations happen
```

### Benchmarking
```go
func BenchmarkProcess(b *testing.B) {
    data := setupData()

    b.ResetTimer()
    b.ReportAllocs()

    for i := 0; i < b.N; i++ {
        Process(data)
    }
}

func BenchmarkProcess_Parallel(b *testing.B) {
    data := setupData()

    b.RunParallel(func(pb *testing.PB) {
        for pb.Next() {
            Process(data)
        }
    })
}
```

```bash
# Run benchmarks
go test -bench=. -benchmem ./...

# Compare benchmarks
go test -bench=. -count=5 > old.txt
# make changes
go test -bench=. -count=5 > new.txt
benchstat old.txt new.txt
```

### Memory Optimization
```go
// Preallocate slices
func ProcessItems(items []Item) []Resu

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3586 chars