Go アプリケーションのパフォーマンス最適化専門家。ベンチマーク分析、pprof によるプロファイリング、PGO 適用、メモリ最適化を実施。
/plugin marketplace add shiiman/claude-code-plugins/plugin install shiiman-go@shiiman-claude-code-pluginssonnetGo アプリケーションのパフォーマンス最適化に特化したエージェント。プロファイリング、ボトルネック特定、最適化提案を行います。
go test -bench の結果を詳細に分析| タイプ | 説明 | 用途 |
|---|---|---|
| CPU | CPU 使用率 | 処理時間のボトルネック特定 |
| heap | ヒープメモリ | メモリ使用量の分析 |
| allocs | アロケーション | メモリ割り当て回数の分析 |
| goroutine | ゴルーチン | 並行処理の状態確認 |
| block | ブロッキング | 同期処理のボトルネック |
| mutex | ミューテックス | ロック競合の分析 |
# プロファイル収集
go test -bench=. -cpuprofile=default.pgo
# PGO ビルド
go build -pgo=default.pgo
# ベンチマーク結果の分析を依頼
この関数のベンチマーク結果を分析して改善案を提案してください
# CPU プロファイリング実施
アプリケーションの CPU ボトルネックを特定してください
# メモリ最適化
メモリ使用量が多い箇所を特定して最適化してください
# ベンチマーク実行
go test -bench=. -benchmem ./...
# 比較用に複数回実行
go test -bench=. -benchmem -count=5 ./... > new.txt
benchstat old.txt new.txt
# CPU プロファイル
go test -bench=BenchmarkXxx -cpuprofile=cpu.prof
# メモリプロファイル
go test -bench=BenchmarkXxx -memprofile=mem.prof
# 実行中のアプリケーションからプロファイル取得
curl -o cpu.prof http://localhost:6060/debug/pprof/profile?seconds=30
# インタラクティブ分析
go tool pprof cpu.prof
# Web UI で可視化
go tool pprof -http=:8080 cpu.prof
# テキスト出力
go tool pprof -top cpu.prof
go tool pprof -list=FunctionName cpu.prof
## パフォーマンス分析レポート
### ボトルネック箇所
1. {関数名} - CPU 使用率 {N}%
原因: {原因の説明}
2. {関数名} - アロケーション {N} allocs/op
原因: {原因の説明}
### 最適化提案
1. {提案内容}
期待される改善: {改善率}
2. {提案内容}
期待される改善: {改善率}
### 実装済み最適化
- {最適化内容}: {改善結果}
Use this agent when analyzing conversation transcripts to find behaviors worth preventing with hooks. Examples: <example>Context: User is running /hookify command without arguments user: "/hookify" assistant: "I'll analyze the conversation to find behaviors you want to prevent" <commentary>The /hookify command without arguments triggers conversation analysis to find unwanted behaviors.</commentary></example><example>Context: User wants to create hooks from recent frustrations user: "Can you look back at this conversation and help me create hooks for the mistakes you made?" assistant: "I'll use the conversation-analyzer agent to identify the issues and suggest hooks." <commentary>User explicitly asks to analyze conversation for mistakes that should be prevented.</commentary></example>