# Optimize Go Performance with Profiling

Go services can become slow or memory-heavy without clear evidence. This skill guides profiling, allocation analysis, concurrency tuning, and benchmark-driven optimization.

## Install

```bash
npx skillstore add joseph obrien/89jobrien-golang-performance
```

## Metadata

- Status: approved
- Slug: 89jobrien-golang-performance
- Version: 1.0.1
- Author version: 1.0.1
- Skillstore revision: r1
- Version status: valid
- Tree hash: 890b3a88c8a06bc5f6d86286d1941ce0ccc012081840d6493bd406c1bdd7a2f7
- Author: Joseph OBrien
- GitHub username: 89jobrien
- License: MIT
- Repository: https://github.com/89jobrien/steve/tree/main/steve/skills/golang-performance
- Ref: c4037264bbd363c572662d6154a3ab28f5ca4f53
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, external\_commands, network
- Quality score: 82
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/89jobrien-golang-performance
- Manifest: https://skillstore.pages.dev/api/skills/89jobrien-golang-performance/manifest

## Capabilities

- Explains CPU, heap, and allocation profiling with pprof endpoints and local commands.
- Shows programmatic CPU and memory profile collection using Go runtime packages.
- Describes allocation reduction using preallocated slices, builders, copies, and sync.Pool.
- Covers escape analysis commands and examples that identify heap allocations.
- Demonstrates worker pools, buffered channels, lock sharding, and sync.Map tradeoffs.
- Provides benchmark patterns for timing, allocation reports, and implementation comparisons.

## Use Cases

- Diagnose Slow API Paths: Plan CPU and memory profiling for Go services with latency or throughput issues.
- Reduce Memory Pressure: Identify allocation-heavy code paths and choose practical changes that reduce garbage collection pressure.
- Review Optimization Proposals: Evaluate concurrency, data structure, and benchmark changes before merging performance work.

## Prompt Templates

### Plan a Profile

```
Use this skill to create a profiling plan for my Go service. Focus on CPU, heap, and allocation data to collect first.
```

### Reduce Allocations

```
Review my Go function for avoidable allocations. Suggest changes that preserve readability and explain how to benchmark them.
```

### Tune Concurrency

```
Analyze my worker pool and locking strategy for contention risks. Recommend measurements and safer concurrency improvements.
```

### Interpret Benchmarks

```
Compare these Go benchmark results and profile observations. Identify the likely bottleneck and propose the next experiment.
```

## Limitations

- It provides guidance and examples, but it does not run benchmarks by itself.
- Recommendations must be validated against your workload and production profile data.
- Examples assume standard Go tooling and access to the target project.
- It does not cover every runtime flag, trace workflow, or third-party profiler.

## Best Practices

- Measure with profiles and benchmarks before changing performance-sensitive code.
- Optimize one bottleneck at a time, then remeasure with the same workload.
- Keep profiling endpoints local or access controlled when used outside development.

## Anti Patterns

- Optimizing code based only on intuition or style preferences.
- Applying every optimization pattern without workload evidence.
- Comparing benchmark runs from different machines, loads, or compiler settings.

## Security Audit

- Audited at: 2026-07-05T12:34:46.471\+00:00
- Summary: The static findings are false positives caused by Markdown fences, Go import blocks, local pprof URLs, and headings that contain the word avoid. No evidence found of prompt injection, secret handling, network exfiltration, or automatic command execution in SKILL.md.

## Stats

- Views: 252
- Downloads: 15
- Favorites: 0
- Popularity score: 0
