performance-benchmark-specialist
Performance benchmarking expertise for shell tools, covering benchmark design, statistical analysis (min/max/mean/median/stddev), performance targets (<100ms, >90% hit rate), workspace generation, and comprehensive reporting
What this skill does
# Performance Benchmark Specialist
Comprehensive performance benchmarking expertise for shell-based tools, focusing on rigorous measurement, statistical analysis, and actionable performance optimization using patterns from the unix-goto project.
## When to Use This Skill
Use this skill when:
- Creating performance benchmarks for shell scripts
- Measuring and validating performance targets
- Implementing statistical analysis for benchmark results
- Designing benchmark workspaces and test environments
- Generating performance reports with min/max/mean/median/stddev
- Comparing baseline vs optimized performance
- Storing benchmark results in CSV format
- Validating performance regressions
- Optimizing shell script performance
Do NOT use this skill for:
- Application profiling (use language-specific profilers)
- Production performance monitoring (use APM tools)
- Load testing web services (use JMeter, k6, etc.)
- Simple timing measurements (use basic `time` command)
## Core Performance Philosophy
### Performance-First Development
Performance is NOT an afterthought - it's a core requirement from day one.
**unix-goto Performance Principles:**
1. **Define targets BEFORE implementation**
2. **Measure EVERYTHING that matters**
3. **Use statistical analysis, not single runs**
4. **Test at realistic scale**
5. **Validate against targets automatically**
### Performance Targets from unix-goto
| Metric | Target | Rationale |
|--------|--------|-----------|
| Cached navigation | <100ms | Sub-100ms feels instant to users |
| Bookmark lookup | <10ms | Near-instant access required |
| Cache speedup | >20x | Significant improvement over uncached |
| Cache hit rate | >90% | Most lookups should hit cache |
| Cache build | <5s | Fast initial setup, minimal wait |
**Achieved Results:**
- Cached navigation: 26ms (74ms under target)
- Cache build: 3-5s (meets target)
- Cache hit rate: 92-95% (exceeds target)
- Speedup ratio: 8x (work in progress to reach 20x)
## Core Knowledge
### Standard Benchmark Structure
Every benchmark follows this exact structure:
```bash
#!/bin/bash
# Benchmark: [Description]
# ============================================
# Setup
# ============================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$SCRIPT_DIR/.."
source "$SCRIPT_DIR/bench-helpers.sh"
source "$REPO_DIR/lib/module.sh"
# ============================================
# Main Function
# ============================================
main() {
bench_header "Benchmark Title"
echo "Configuration:"
echo " Iterations: 10"
echo " Warmup: 3 runs"
echo " Workspace: medium (50 folders)"
echo ""
benchmark_feature
generate_summary
}
# ============================================
# Benchmark Function
# ============================================
benchmark_feature() {
bench_section "Benchmark Section"
# Setup
local workspace=$(bench_create_workspace "medium")
# Phase 1: Baseline
echo "Phase 1: Baseline measurement"
echo "─────────────────────────────────"
# Warmup
bench_warmup "command" 3
# Run benchmark
local baseline_stats=$(bench_run "baseline" "command" 10)
# Extract statistics
IFS=',' read -r min max mean median stddev <<< "$baseline_stats"
# Print results
bench_print_stats "$baseline_stats" "Baseline Results"
# Phase 2: Optimized
echo ""
echo "Phase 2: Optimized measurement"
echo "─────────────────────────────────"
# Implementation of optimization
optimize_feature
# Warmup
bench_warmup "optimized_command" 3
# Run benchmark
local optimized_stats=$(bench_run "optimized" "optimized_command" 10)
# Extract statistics
IFS=',' read -r opt_min opt_max opt_mean opt_median opt_stddev <<< "$optimized_stats"
# Print results
bench_print_stats "$optimized_stats" "Optimized Results"
# Compare and analyze
local speedup=$(bench_compare "$mean" "$opt_mean")
echo ""
echo "Performance Analysis:"
echo " Speedup ratio: ${speedup}x"
# Assert targets
bench_assert_target "$opt_mean" 100 "Optimized performance"
# Save results
bench_save_result "benchmark_name" "$baseline_stats" "baseline"
bench_save_result "benchmark_name" "$optimized_stats" "optimized"
# Cleanup
bench_cleanup_workspace "$workspace"
}
# ============================================
# Execute
# ============================================
main
exit 0
```
### Benchmark Helper Library
The complete helper library provides ALL benchmarking utilities:
```bash
#!/bin/bash
# bench-helpers.sh - Comprehensive benchmark utilities
# ============================================
# Configuration
# ============================================
BENCH_RESULTS_DIR="${BENCH_RESULTS_DIR:-$HOME/.goto_benchmarks}"
BENCH_WARMUP_ITERATIONS="${BENCH_WARMUP_ITERATIONS:-3}"
BENCH_DEFAULT_ITERATIONS="${BENCH_DEFAULT_ITERATIONS:-10}"
# ============================================
# Timing Functions
# ============================================
# High-precision timing in milliseconds
bench_time_ms() {
local cmd="$*"
local start=$(date +%s%N)
eval "$cmd" > /dev/null 2>&1
local end=$(date +%s%N)
echo $(((end - start) / 1000000))
}
# Warmup iterations to reduce noise
bench_warmup() {
local cmd="$1"
local iterations="${2:-$BENCH_WARMUP_ITERATIONS}"
for i in $(seq 1 $iterations); do
eval "$cmd" > /dev/null 2>&1
done
}
# Run benchmark with N iterations
bench_run() {
local name="$1"
local cmd="$2"
local iterations="${3:-$BENCH_DEFAULT_ITERATIONS}"
local times=()
for i in $(seq 1 $iterations); do
local time=$(bench_time_ms "$cmd")
times+=("$time")
printf " Run %2d: %dms\n" "$i" "$time"
done
bench_calculate_stats "${times[@]}"
}
# ============================================
# Statistical Analysis
# ============================================
# Calculate comprehensive statistics
bench_calculate_stats() {
local values=("$@")
local count=${#values[@]}
if [ $count -eq 0 ]; then
echo "0,0,0,0,0"
return 1
fi
# Sort values for percentile calculations
IFS=$'\n' sorted=($(sort -n <<<"${values[*]}"))
unset IFS
# Min and Max
local min=${sorted[0]}
local max=${sorted[$((count-1))]}
# Mean (average)
local sum=0
for val in "${values[@]}"; do
sum=$((sum + val))
done
local mean=$((sum / count))
# Median (50th percentile)
local mid=$((count / 2))
if [ $((count % 2)) -eq 0 ]; then
# Even number of values - average the two middle values
local median=$(( (${sorted[$mid-1]} + ${sorted[$mid]}) / 2 ))
else
# Odd number of values - take the middle value
local median=${sorted[$mid]}
fi
# Standard deviation
local variance=0
for val in "${values[@]}"; do
local diff=$((val - mean))
variance=$((variance + diff * diff))
done
variance=$((variance / count))
# Use bc for square root if available, otherwise approximate
if command -v bc &> /dev/null; then
local stddev=$(echo "scale=2; sqrt($variance)" | bc)
else
# Simple approximation without bc
local stddev=$(awk "BEGIN {printf \"%.2f\", sqrt($variance)}")
fi
# Return CSV format: min,max,mean,median,stddev
echo "$min,$max,$mean,$median,$stddev"
}
# Compare two measurements and calculate speedup
bench_compare() {
local baseline="$1"
local optimized="$2"
if [ "$optimized" -eq 0 ]; then
echo "inf"
return
fi
if command -v bc &> /dev/null; then
local speedup=$(echo "scale=2; $baseline / $optimized" | bc)
else
local speedup=$(awk "BEGIN {printf \"%.2f\", $baseline / $optimized}")
fi
echo "$speedup"
}
# Calculate percentile
bench_percentile() {
local percentile="$1"
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.