Skip to content
Development
Command

/bottleneck

Systematic performance bottleneck analysis and optimization across application stack

From plugin
claude-cmd
316180 skills180 commands

Command definition

bottleneck.md
allowed-tools: Bash(top:*), Bash(htop:*), Bash(iostat:*), Bash(free:*), Bash(uptime:*), Bash(ps:*), Bash(netstat:*), Bash(rg:*), Bash(fd:*), Bash(jq:*), Bash(gdate:*), Bash(psql:*), Bash(mysql:*), Read, Write, Task
name: "Bottleneck"
description: "Systematic performance bottleneck analysis and optimization across application stack"
author: "wcygan"
tags: ["code","analyze"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

/bottleneck

Context

  • Session ID: !`gdate +%s%N 2>/dev/null || date +%s000000000 2>/dev/null || echo "session-$(date +%s)000000000"`
  • Target system: $ARGUMENTS
  • Current system load: !`uptime | awk -F'load average:' '{print $2}' || echo "Load info unavailable"`
  • Memory usage: !`free -h 2>/dev/null | head -2 || vm_stat 2>/dev/null | head -5 || echo "Memory info unavailable"`
  • CPU cores: !`nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo "1"`
  • Active processes: !`ps aux --sort=-%cpu 2>/dev/null | head -5 || ps aux | head -5 || echo "Process info unavailable"`
  • Project structure: !`fd . -t d -d 2 2>/dev/null | head -10 || find . -type d -maxdepth 2 2>/dev/null | head -10 || echo "No project structure detected"`
  • Technology stack: !`fd -e json -e toml -e yaml . 2>/dev/null | rg "(package\.json|Cargo\.toml|deno\.json|docker-compose\.yml|pom\.xml)" | head -3 || echo "No config files detected"`
  • Monitoring tools: !`which prometheus grafana 2>/dev/null || echo "No monitoring tools detected"`

Your Task

**IMMEDIATELY DEPLOY 10 PARALLEL PERFORMANCE ANALYSIS AGENTS** for ultra-fast comprehensive bottleneck analysis: **$ARGUMENTS**

Think deeply about comprehensive performance optimization while maximizing parallel execution for 10x speedup.

**CRITICAL**: Launch ALL agents simultaneously in first response - NO sequential processing.

Parallel Performance Analysis Framework

STEP 1: **LAUNCH ALL 10 AGENTS SIMULTANEOUSLY**

**NO SEQUENTIAL PROCESSING** - Deploy these specialized performance analysis agents in parallel:

1. **CPU & Memory Analysis Agent**: CPU utilization patterns, memory allocation, garbage collection pressure, resource contention 2. **Database Performance Agent**: Query performance, index usage, connection pooling, slow queries, database-specific bottlenecks 3. **Network & I/O Agent**: Network latency, bandwidth utilization, disk I/O patterns, storage performance 4. **Application Code Profiling Agent**: Application logic, algorithmic inefficiencies, code-level performance issues, hot paths 5. **Infrastructure & Deployment Agent**: Monitoring tools, deployment configuration, system architecture bottlenecks 6. **Caching & Storage Agent**: Cache hit rates, storage efficiency, data access patterns, memory usage optimization 7. **Concurrency & Threading Agent**: Thread pool efficiency, lock contention, async patterns, parallel processing bottlenecks 8. **External Dependencies Agent**: Third-party API performance, service mesh latency, external database connections 9. **Resource Scaling Agent**: Auto-scaling efficiency, resource allocation patterns, capacity planning issues 10. **Monitoring & Observability Agent**: Existing monitoring gaps, alerting thresholds, performance baseline establishment

**Expected speedup**: 10x faster than sequential bottleneck analysis.

STEP 2: Initialize Parallel Session Management

// /tmp/bottleneck-analysis-$SESSION_ID.json
{
  "sessionId": "$SESSION_ID",
  "timestamp": "$(date -Iseconds)",
  "target": "$ARGUMENTS",
  "phase": "parallel_analysis",
  "architecture": "auto-detect",
  "analysis_domains": [
    "cpu_memory",
    "database",
    "network_io",
    "application_code",
    "infrastructure",
    "caching_storage",
    "concurrency",
    "external_deps",
    "scaling",
    "monitoring"
  ],
  "baseline_metrics": {},
  "discovered_bottlenecks": [],
  "optimization_recommendations": [],
  "monitoring_setup": {}
}

STEP 3: Parallel Bottleneck Discovery & Analysis

**ALL AGENTS WORK CONCURRENTLY:**

**Performance Bottleneck Discovery Execution:**

# System metrics and performance indicators
CPU_USAGE=$(top -bn1 2>/dev/null | rg "Cpu\(s\)" | awk '{print $2}' | cut -d'%' -f1 || echo "0")
MEMORY_USED=$(free -h 2>/dev/null | awk 'NR==2{printf "%.1f", $3/$2*100}' || echo "0")
LOAD_AVG=$(uptime | awk -F'load average:' '{print $2}' || echo "0, 0, 0")

# Database and application patterns
rg "SELECT.*FROM|UPDATE.*SET|INSERT.*INTO" . --type sql -n | head -10
rg "sleep|wait|block|sync|lock" . -n | head -10

# Performance anti-patterns
rg "N\+1|nested.*loop|sequential.*scan" . -n
rg "synchronized|mutex|lock|await|Promise\.all" . -n

TRY: Launch all 10 parallel agents for comprehensive bottleneck analysis Execute concurrent discovery across all performance dimensions Collect baseline metrics and performance indicators Synthesize findings from all agent results Generate optimization recommendations with impact estimates Update session state: phase = "bottleneck_analysis_complete"

CATCH (agent_failures): Continue with available agent results Document failed analysis areas Provide partial bottleneck assessment with gaps identified Generate basic optimization roadmap

FINALLY: Aggregate all parallel agent findings Create comprehensive bottleneck assessment matrix Generate structured optimization plan with effort estimates Save artifacts: bottleneck-analysis.md, optimization-roadmap.md Clean up temporary analysis files

STEP 4: **Parallel Results Synthesis**

WAIT for ALL 10 agents to complete bottleneck analysis AGGREGATE findings from all parallel streams:

  • CPU and memory utilization patterns and optimization opportunities
  • Database query performance, slow queries, and index optimization recommendations
  • Network latency, bandwidth issues, and I/O bottlenecks
  • Application code profiling with hot paths and algorithmic inefficiencies
  • Infrastructure configuration issues and deployment bottlenecks
  • Caching efficiency and storage optimization oppor
Read more
@kiliczsh
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Stars on GitHub

Momentum

stars in total
316
Star history of kiliczsh/claude-cmd on GitHub, a chart by star-history.com

Other commands on claude-cmd.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command