analyze-perf
Go プロジェクトのパフォーマンスを計測・分析する。「パフォーマンス計測」「ベンチマーク」「perf」「性能測定」「プロファイリング」「最適化提案」「パフォーマンス分析」などで起動。ベンチマーク実行、プロファイリング、改善案の提示をサポート。
Best use case
analyze-perf is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Go プロジェクトのパフォーマンスを計測・分析する。「パフォーマンス計測」「ベンチマーク」「perf」「性能測定」「プロファイリング」「最適化提案」「パフォーマンス分析」などで起動。ベンチマーク実行、プロファイリング、改善案の提示をサポート。
Teams using analyze-perf should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/analyze-perf/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How analyze-perf Compares
| Feature / Agent | analyze-perf | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Go プロジェクトのパフォーマンスを計測・分析する。「パフォーマンス計測」「ベンチマーク」「perf」「性能測定」「プロファイリング」「最適化提案」「パフォーマンス分析」などで起動。ベンチマーク実行、プロファイリング、改善案の提示をサポート。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Analyze-Perf
Go プロジェクトのパフォーマンスを計測・分析し、改善案を提示します。
## 引数
- `[パッケージパス]`: 対象パッケージ(例: ./internal/handler)
- `--bench`: ベンチマークのみ実行
- `--profile`: プロファイリングを実行
- `--help`: ヘルプを表示
## 実行フロー
```
1. 対象コードの特定
↓
2. ベースライン測定
↓
3. ボトルネック分析
↓
4. 改善案提示
↓
5. ユーザーと方針決定
↓
6. 修正実装
↓
7. 効果測定
```
## 実行手順
### 1. ベンチマーク実行
```bash
# 基本的なベンチマーク
go test -bench=. -benchmem ./...
# 特定パッケージのベンチマーク
go test -bench=. -benchmem ./internal/handler
# 複数回実行して安定した結果を取得
go test -bench=. -benchmem -count=3 ./... | tee baseline.txt
```
### 2. プロファイリング
```bash
# CPU プロファイル
go test -bench=. -cpuprofile=cpu.prof ./...
go tool pprof cpu.prof
# メモリプロファイル
go test -bench=. -memprofile=mem.prof ./...
go tool pprof mem.prof
# pprof コマンド
# top - 実行時間が最も長い関数を表示
# list - 特定関数のソースコード行ごとの分析
# web - グラフ形式で可視化
```
### 3. 結果レポート
```
## パフォーマンス分析結果
### ベンチマーク結果
- BenchmarkXxx: {N} ns/op
- メモリアロケーション: {M} B/op
- アロケーション回数: {K} allocs/op
### 特定されたボトルネック
1. {関数名}: {問題の説明}
2. {関数名}: {問題の説明}
### 改善案
| 提案 | 内容 | 期待される改善 |
|------|------|---------------|
| 1 | {改善内容} | {効果} |
| 2 | {改善内容} | {効果} |
どの改善案を適用しますか?
```
## 改善案の観点
| 観点 | 改善例 |
|------|--------|
| データ構造 | slice、map の適切な選択 |
| アルゴリズム | 計算量の削減、キャッシング |
| 並行処理 | goroutine、channel、ワーカープール |
| メモリ管理 | sync.Pool、スライスの事前確保 |
| 文字列操作 | strings.Builder の使用 |
| PGO | Profile-Guided Optimization(Go 1.22+) |
## 期待される改善率の目安
| 最適化内容 | 期待される改善率 |
|-----------|----------------|
| スライスの事前確保 | メモリ 30-50% 削減 |
| ポインタレシーバ | CPU 20-40% 高速化 |
| strings.Builder | 文字列操作 2-5x 高速化 |
| sync.Pool | アロケーション 50-80% 削減 |
| 並行処理最適化 | スループット 2-10x 向上 |
| PGO | 全体 2-14% 高速化 |
## benchstat による比較
```bash
# 最適化前
go test -bench=. -benchmem -count=3 ./... | tee before.txt
# 最適化後
go test -bench=. -benchmem -count=3 ./... | tee after.txt
# 比較
benchstat before.txt after.txt
```
## 重要な注意事項
- ✅ 最適化前に必ずベンチマークで現状を測定
- ✅ 修正前後のベンチマーク結果を比較して効果を確認
- ✅ 実際にボトルネックとなっている箇所に集中
- ❌ パフォーマンス向上のために可読性を大きく損なわない
- ❌ 早すぎる最適化を避けるRelated Skills
analyze-video-performance-skill
Analyze your uploaded YouTube videos' performance against competitor benchmarks using Playwright MCP. Use when asked to review video analytics, compare performance, check how a video is doing, or reflect on a video's success.
analyze-patterns
Use this skill when you need to analyze code for design patterns, anti-patterns, naming conventions, and code duplication. This skill excels at identifying architectural patterns, detecting code smells, and ensuring consistency across the codebase.
analyze-copper-inventory-rebuild-signal
用「庫存快速回補」作為短期警戒訊號,評估銅價是否接近短線高點,同時給出一個「長期是否偏便宜」的歷史分位數判讀。
acc-analyze-coupling-cohesion
Analyzes coupling and cohesion metrics in PHP codebases. Calculates Afferent/Efferent coupling (Ca/Ce), LCOM metrics, instability index, and abstractness. Identifies highly coupled modules and low cohesion classes.
ac-stop-hook-analyzer
Analyze context and decide on continuation via Stop hook. Use when determining if work should continue, analyzing completion status, making continuation decisions, or implementing the Two-Claude pattern.
performing-cryptographic-audit-of-application
A cryptographic audit systematically reviews an application's use of cryptographic primitives, protocols, and key management to identify vulnerabilities such as weak algorithms, insecure modes, hardco
analyze-test-results
Analyze test failures and CI artifacts to identify and fix bugs
analyze-test-failures
This skill should be used when the user asks to "analyze failing tests", "debug test failures", "investigate test errors", or provides specific failing test cases to examine. Analyzes failing test cases with a balanced, investigative approach to determine whether failures indicate test issues or genuine bugs.
analyze-test-coverage
Analyze test coverage gaps and report findings
acc-analyze-test-coverage
Analyzes PHP codebase for test coverage gaps. Detects untested classes, methods, branches, exception paths, and edge cases. Provides actionable recommendations.
analyze-prd
Analyze existing PRDs to generate actionable implementation plans, risk assessments, and resource estimates
Analyze Regressions
Grade component health based on regression triage metrics for OpenShift releases