.claude/skills/performance/when-analyzing-performance-use-performance-analysis/SKILL.md
Comprehensive performance analysis, bottleneck detection, and optimization recommendations for Claude Flow swarms
npx skillsauth add DNYoussef/ai-chrome-extension when-analyzing-performance-use-performance-analysisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive performance analysis for Claude Flow swarms including bottleneck detection, profiling, benchmarking, and actionable optimization recommendations.
Role: Analyze system performance and identify issues Responsibilities:
Role: Run performance benchmarks and comparisons Responsibilities:
Role: Deep performance profiling and optimization Responsibilities:
Measure current performance and establish baseline metrics.
# Collect baseline metrics
npx claude-flow@alpha performance baseline \
--duration 300 \
--interval 5 \
--output baseline-metrics.json
# Run benchmark suite
npx claude-flow@alpha benchmark run \
--type swarm \
--iterations 10 \
--output benchmark-results.json
# Profile system resources
npx claude-flow@alpha performance profile \
--include-cpu \
--include-memory \
--include-network \
--output resource-profile.json
# Collect agent metrics
npx claude-flow@alpha agent metrics --all --format json > agent-metrics.json
# Store baseline
npx claude-flow@alpha memory store \
--key "performance/baseline" \
--file baseline-metrics.json
# Generate baseline report
npx claude-flow@alpha performance report \
--type baseline \
--metrics baseline-metrics.json \
--output baseline-report.md
Swarm-Level:
Agent-Level:
System-Level:
# Store performance baseline
npx claude-flow@alpha memory store \
--key "performance/baseline/timestamp" \
--value "$(date -Iseconds)"
npx claude-flow@alpha memory store \
--key "performance/baseline/metrics" \
--value '{
"throughput": 145.2,
"latency": 38.5,
"utilization": 0.78,
"errorRate": 0.012,
"timestamp": "'$(date -Iseconds)'"
}'
Deep profiling of system components to identify performance characteristics.
# Profile swarm execution
npx claude-flow@alpha performance profile-swarm \
--duration 300 \
--sample-rate 100 \
--output swarm-profile.json
# Profile individual agents
for AGENT in $(npx claude-flow@alpha agent list --format json | jq -r '.[].id'); do
npx claude-flow@alpha performance profile-agent \
--agent-id "$AGENT" \
--duration 60 \
--output "profiles/agent-$AGENT.json"
done
# Profile memory usage
npx claude-flow@alpha memory profile \
--show-hotspots \
--show-leaks \
--output memory-profile.json
# Profile network communication
npx claude-flow@alpha performance profile-network \
--show-latency \
--show-bandwidth \
--output network-profile.json
# Generate flamegraph
npx claude-flow@alpha performance flamegraph \
--input swarm-profile.json \
--output flamegraph.svg
# Analyze CPU hotspots
npx claude-flow@alpha performance hotspots \
--type cpu \
--threshold 5 \
--output cpu-hotspots.json
# Identify slow functions
SLOW_FUNCTIONS=$(jq '[.profile[] | select(.time > 100)]' swarm-profile.json)
# Identify memory hogs
MEMORY_HOGS=$(jq '[.memory[] | select(.usage > 100)]' memory-profile.json)
# Identify network bottlenecks
NETWORK_ISSUES=$(jq '[.network[] | select(.latency > 50)]' network-profile.json)
echo "Slow Functions: $(echo $SLOW_FUNCTIONS | jq length)"
echo "Memory Hogs: $(echo $MEMORY_HOGS | jq length)"
echo "Network Issues: $(echo $NETWORK_ISSUES | jq length)"
Identify and categorize performance issues and bottlenecks.
# Run comprehensive analysis
npx claude-flow@alpha performance analyze \
--input swarm-profile.json \
--detect-bottlenecks \
--detect-memory-leaks \
--detect-deadlocks \
--output analysis-results.json
# Identify bottlenecks by type
npx claude-flow@alpha performance bottlenecks \
--categorize \
--priority-order \
--output bottleneck-report.json
# Analyze agent performance
npx claude-flow@alpha agent analyze-performance \
--all \
--identify-underperformers \
--output agent-analysis.json
# Analyze coordination overhead
npx claude-flow@alpha performance coordination-overhead \
--calculate \
--breakdown \
--output coordination-analysis.json
# Root cause analysis
npx claude-flow@alpha performance root-cause \
--issue "high-latency" \
--trace-back \
--output root-cause-analysis.json
Critical Issues:
High Priority:
Medium Priority:
Low Priority:
# Store analysis results
npx claude-flow@alpha memory store \
--key "performance/analysis/issues" \
--value '{
"critical": 0,
"high": 3,
"medium": 8,
"low": 12,
"timestamp": "'$(date -Iseconds)'"
}'
# Store bottleneck information
npx claude-flow@alpha memory store \
--key "performance/analysis/bottlenecks" \
--file bottleneck-report.json
Apply optimizations based on analysis and measure improvements.
# Get optimization recommendations
npx claude-flow@alpha performance recommend \
--based-on analysis-results.json \
--prioritize \
--output recommendations.json
# Apply automatic optimizations
npx claude-flow@alpha performance optimize \
--recommendations recommendations.json \
--auto-apply safe-optimizations
# Manual optimizations
# 1. Fix identified bottlenecks
# 2. Optimize hot paths
# 3. Reduce coordination overhead
# 4. Improve resource utilization
# Optimize swarm topology
npx claude-flow@alpha swarm optimize-topology \
--based-on analysis-results.json
# Optimize agent allocation
npx claude-flow@alpha agent rebalance \
--strategy performance-optimized
# Optimize memory usage
npx claude-flow@alpha memory optimize \
--reduce-footprint \
--clear-unused
# Apply neural optimizations
npx claude-flow@alpha neural train \
--pattern convergent \
--iterations 10
Parallelization:
# Increase parallelism for independent tasks
npx claude-flow@alpha swarm configure \
--max-parallel-tasks 8
Caching:
# Enable result caching
npx claude-flow@alpha performance cache \
--enable \
--strategy lru \
--max-size 1000
Load Balancing:
# Rebalance agent workloads
npx claude-flow@alpha swarm rebalance \
--strategy adaptive \
--target-variance 0.1
Resource Allocation:
# Optimize resource allocation
npx claude-flow@alpha agent configure --all \
--memory-limit auto \
--cpu-limit auto
Measure improvements and validate optimization effectiveness.
# Collect post-optimization metrics
npx claude-flow@alpha performance baseline \
--duration 300 \
--output optimized-metrics.json
# Run comparison benchmark
npx claude-flow@alpha benchmark run \
--type swarm \
--iterations 10 \
--output optimized-benchmark.json
# Compare before/after
npx claude-flow@alpha performance compare \
--baseline baseline-metrics.json \
--current optimized-metrics.json \
--output improvement-report.json
# Calculate improvements
THROUGHPUT_IMPROVEMENT=$(jq '.improvements.throughput.percentage' improvement-report.json)
LATENCY_IMPROVEMENT=$(jq '.improvements.latency.percentage' improvement-report.json)
echo "Throughput improved by: $THROUGHPUT_IMPROVEMENT%"
echo "Latency improved by: $LATENCY_IMPROVEMENT%"
# Validate improvements meet targets
npx claude-flow@alpha performance validate \
--improvements improvement-report.json \
--targets performance-targets.json
# Generate final report
npx claude-flow@alpha performance report \
--type comprehensive \
--include-baseline \
--include-analysis \
--include-optimizations \
--include-results \
--output final-performance-report.md
# Archive performance data
npx claude-flow@alpha performance archive \
--output performance-archive-$(date +%Y%m%d).tar.gz
Minimum Improvements:
Validation Checks:
# Check if improvements meet targets
if (( $(echo "$THROUGHPUT_IMPROVEMENT >= 15" | bc -l) )); then
echo "✓ Throughput target met"
else
echo "✗ Throughput target not met"
fi
if (( $(echo "$LATENCY_IMPROVEMENT >= 20" | bc -l) )); then
echo "✓ Latency target met"
else
echo "✗ Latency target not met"
fi
Symptoms: Metrics unchanged after optimization Solution: Re-analyze bottlenecks, verify optimizations applied correctly
Symptoms: Performance worse after optimization Solution: Rollback changes, re-evaluate optimization strategy
Symptoms: Performance varies significantly between runs Solution: Increase measurement duration, check for external factors
development
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
development
Comprehensive framework for analyzing, creating, and refining prompts for AI systems using evidence-based techniques
data-ai
Implement adaptive learning with ReasoningBank for pattern recognition, strategy optimization, and continuous improvement
development
Create new Claude Code Skills with proper YAML frontmatter, progressive disclosure structure, and complete directory organization