golang-performancelisted
Install: claude install-skill reagin/agent-skills
# Go Performance Optimization
Optimize an observed constraint, not code that merely looks slow. Preserve correctness, maintainability, and operational safety while improving the metric the user actually cares about.
## Establish the Performance Contract
Before editing, record:
- the workload and environment;
- the primary metric, such as latency, throughput, CPU, allocation rate, resident memory, or startup time;
- a representative baseline and its variance;
- the target or regression threshold;
- correctness and resource guardrails;
- whether the bottleneck is inside this Go process or in an external dependency.
If there is no useful evidence yet, gather a focused profile, trace, benchmark, or production metric first. Do not claim an optimization based only on a code pattern.
## Diagnose the Dominant Cost
Use the evidence to route the investigation:
| Signal | Read |
| --- | --- |
| CPU profile dominated by application code | [references/cpu.md](references/cpu.md) |
| Allocation or retained-heap profile is high | [references/memory.md](references/memory.md) |
| Time is spent waiting on network, disk, database, or syscalls | [references/io-networking.md](references/io-networking.md) |
| GC, scheduler, memory limit, or build profile is implicated | [references/runtime.md](references/runtime.md) |
| Repeated work, hot lookups, or duplicate concurrent requests dominate | [references/caching.md](references/caching.md) |
| A production change needs metric validation | [ref