Our review
Profiles CPU and memory of Go code using pprof to identify performance bottlenecks.
Strengths
- Detailed analysis of CPU hotspots and memory allocators
- Generates tabular reports with actionable observations
- Provides optimization suggestions with function references
Limitations
- Requires code to be runnable with benchmarks (go test -bench=.)
- Only works for Go code
- Profiles are generated on benchmarks, not on real execution
When investigating high CPU or memory usage in a Go application.
For production profiling or languages other than Go.
Security analysis
SafeThe skill uses standard Go tooling for profiling, with no destructive or exfiltrating behaviors. Package path is user-provided but confined to Go test contexts. No network calls or disablement of safety features.
No concerns found
Examples
/profile cpu ./internal/index//profile memory ./.../profile all .name: profile description: Run CPU and memory profiling with pprof to identify performance hotspots. Use when investigating high resource usage. disable-model-invocation: true argument-hint: "cpu|memory|all package-path"
CPU and Memory Profiling
Profile Go code to identify CPU hotspots and memory allocators using pprof.
Usage
/profile cpu ./internal/index/- CPU profiling on index package/profile memory ./internal/repo/- Memory profiling on repo package/profile all ./...- Both CPU and memory on all packages
Steps
-
Parse arguments
- First argument: Profile type (
cpu,memory, orall) - Second argument: Package path (defaults to
./...)
- First argument: Profile type (
-
Create profile output directory
mkdir -p .profiles -
Run profiling benchmarks
For CPU profiling:
go test -cpuprofile=.profiles/cpu.prof -bench=. $PACKAGE 2>&1For memory profiling:
go test -memprofile=.profiles/mem.prof -bench=. $PACKAGE 2>&1 -
Analyze CPU profile
go tool pprof -top -cum .profiles/cpu.prof 2>&1 | head -30Identify:
- Top 10 CPU consumers by cumulative time
- Functions with high self time (computation hotspots)
- Unexpected entries (potential optimization targets)
-
Analyze memory profile
go tool pprof -top -alloc_space .profiles/mem.prof 2>&1 | head -30Identify:
- Top allocators by total bytes
- Functions with high allocation counts
- Potential sources of GC pressure
-
Generate flamegraph data (if requested)
go tool pprof -raw .profiles/cpu.prof > .profiles/cpu.raw -
Report findings
Structure the report as:
CPU Hotspots
| Function | Self% | Cum% | Observation | |----------|-------|------|-------------|
Memory Allocators
| Function | Bytes | Allocs | Observation | |----------|-------|--------|-------------|
Optimization Suggestions
- List specific, actionable recommendations
- Reference line numbers where applicable
- Note any patterns (e.g., repeated allocations in loops)
Interpreting Results
CPU Profile Indicators
- High self%: Direct computation hotspot
- High cum% but low self%: Calls expensive functions
- runtime.*: GC or scheduler overhead
Memory Profile Indicators
- High alloc_space: Total memory pressure
- High alloc_objects: GC pressure from many small allocations
- Repeated patterns: Loop allocations, string concatenation
Common Hotspots in Veloria
Watch for issues in:
(*Index).Search- Regex compilation, line reading(*Repository).Load- Index file mapping(*IndexedExtension).Update- Hot-swap operations- HTTP handlers - JSON marshaling, response writing
Cleanup
Profile files are stored in .profiles/. Add to .gitignore if not already present.
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.