[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M76XHTFZQ5B8FFB37S21R76S":3,"skill-same:01M76XHTFZQ5B8FFB37S21R76S":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M76XHTFZQ5B8FFB37S21R76S","afrexai-performance-engineering",null,"Complete performance engineering system — profiling, optimization, load testing, capacity planning, and performance culture. Use when diagnosing slow applications, optimizing code\u002Fqueries\u002Finfrastructure, load testing before launch, planning capacity, or building performance into CI\u002FCD. Covers Node.js, Python, Go, Java, databases, APIs, and frontend.","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fa\u002Fafrexai-performance-engineering\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: afrexai-performance-engineering\ndescription: Complete performance engineering system — profiling, optimization, load testing, capacity planning, and performance culture. Use when diagnosing slow applications, optimizing code\u002Fqueries\u002Finfrastructure, load testing before launch, planning capacity, or building performance into CI\u002FCD. Covers Node.js, Python, Go, Java, databases, APIs, and frontend.\nmetadata:\n  openclaw:\n    os: [linux, darwin, win32]\n---\n\n# Performance Engineering System\n\n> From \"it's slow\" to \"here's why and here's the fix\" — a complete methodology for measuring, diagnosing, optimizing, and preventing performance problems.\n\n## Phase 1: Performance Investigation Brief\n\nBefore touching anything, define the problem.\n\n```yaml\n# performance-brief.yaml\ninvestigation:\n  reported_by: \"\"\n  reported_date: \"\"\n  system: \"\"              # service\u002Fapp name\n  environment: \"\"         # production, staging, dev\n\nproblem_statement:\n  symptom: \"\"             # \"API response time increased 3x\"\n  impact: \"\"              # \"15% of users seeing timeouts\"\n  since_when: \"\"          # \"After deploy v2.14 on Feb 20\"\n  affected_scope: \"\"      # \"All endpoints\" | \"Only \u002Fsearch\" | \"Users in EU\"\n\nbaselines:\n  target_p50: \"\"          # e.g., \"200ms\"\n  target_p95: \"\"          # e.g., \"500ms\"\n  target_p99: \"\"          # e.g., \"1000ms\"\n  current_p50: \"\"\n  current_p95: \"\"\n  current_p99: \"\"\n  throughput_target: \"\"   # e.g., \"1000 rps\"\n  error_rate_target: \"\"   # e.g., \"\u003C0.1%\"\n\nconstraints:\n  budget: \"\"              # time\u002Fmoney for optimization\n  risk_tolerance: \"\"      # \"Can we change the schema?\" \"Can we add caching?\"\n  deadline: \"\"            # \"Must fix before Black Friday\"\n\nhypothesis:\n  primary: \"\"             # \"N+1 queries in the new recommendation engine\"\n  secondary: \"\"           # \"Connection pool exhaustion under load\"\n  evidence: \"\"            # \"Slow query log shows 200+ queries per request\"\n```\n\n### Performance Budget Framework\n\nSet budgets BEFORE building, not after complaints:\n\n| Metric | Web App | API | Mobile | Batch Job |\n|--------|---------|-----|--------|-----------|\n| P50 response | \u003C200ms | \u003C100ms | \u003C300ms | N\u002FA |\n| P95 response | \u003C500ms | \u003C250ms | \u003C800ms | N\u002FA |\n| P99 response | \u003C1s | \u003C500ms | \u003C1.5s | N\u002FA |\n| Error rate | \u003C0.1% | \u003C0.01% | \u003C0.5% | \u003C0.001% |\n| Time to Interactive | \u003C3s | N\u002FA | \u003C2s | N\u002FA |\n| Memory per request | \u003C50MB | \u003C20MB | \u003C100MB | \u003C1GB |\n| CPU per request | \u003C100ms | \u003C50ms | \u003C200ms | N\u002FA |\n| Throughput | 100+ rps | 500+ rps | N\u002FA | items\u002Fmin |\n\n## Phase 2: Measurement & Profiling\n\n### The Golden Rule\n**Never optimize without measuring first. Never measure without a hypothesis.**\n\n### Profiling Decision Tree\n\n```\nIs it slow?\n├── YES → Where is time spent?\n│   ├── CPU-bound → Profile CPU (flame graph)\n│   │   ├── Hot function found → Optimize algorithm\u002Fdata structure\n│   │   └── Spread evenly → Architecture problem (too many layers)\n│   ├── I\u002FO-bound → Profile I\u002FO\n│   │   ├── Database → Query analysis (Phase 4)\n│   │   ├── Network → Connection profiling\n│   │   ├── Disk → I\u002FO scheduler + buffering\n│   │   └── External API → Caching + async + circuit breaker\n│   ├── Memory-bound → Profile allocations\n│   │   ├── GC pressure → Reduce allocations, pool objects\n│   │   ├── Memory leak → Heap snapshot comparison\n│   │   └── Cache thrashing → Resize or eviction policy\n│   └── Concurrency-bound → Profile locks\u002Fcontention\n│       ├── Lock contention → Reduce critical section, lock-free structures\n│       ├── Thread starvation → Pool sizing\n│       └── Deadlock → Lock ordering analysis\n└── NO → Define \"fast enough\" (see budgets above)\n```\n\n### CPU Profiling by Language\n\n#### Node.js\n```bash\n# Built-in profiler (V8)\nnode --prof app.js\nnode --prof-process isolate-*.log > profile.txt\n\n# Inspector-based (connect Chrome DevTools)\nnode --inspect app.js\n# Open chrome:\u002F\u002Finspect → Profiler → Start\n\n# Clinic.js (best overall Node.js profiler)\nnpx clinic doctor -- node app.js\nnpx clinic flame -- node app.js    # Flame graph\nnpx clinic bubbleprof -- node app.js  # Async bottlenecks\n\n# 0x (flame graphs)\nnpx 0x app.js\n```\n\n#### Python\n```python\n# cProfile (built-in)\nimport cProfile\nimport pstats\n\nprofiler = cProfile.Profile()\nprofiler.enable()\n# ... code to profile ...\nprofiler.disable()\n\nstats = pstats.Stats(profiler)\nstats.sort_stats('cumulative')\nstats.print_stats(20)  # Top 20\n\n# Line profiler (pip install line-profiler)\n# Add @profile decorator, then:\n# kernprof -l -v script.py\n\n# py-spy (sampling profiler, no code changes)\n# pip install py-spy\n# py-spy top --pid \u003CPID>\n# py-spy record -o profile.svg --pid \u003CPID>  # Flame graph\n\n# Scalene (CPU + memory + GPU)\n# pip install scalene\n# scalene script.py\n```\n\n#### Go\n```go\n\u002F\u002F Built-in pprof\nimport (\n    \"net\u002Fhttp\"\n    _ \"net\u002Fhttp\u002Fpprof\"\n    \"runtime\u002Fpprof\"\n)\n\n\u002F\u002F HTTP server (add to existing server)\n\u002F\u002F Access: http:\u002F\u002Flocalhost:6060\u002Fdebug\u002Fpprof\u002F\ngo func() { http.ListenAndServe(\":6060\", nil) }()\n\n\u002F\u002F CLI analysis\n\u002F\u002F go tool pprof http:\u002F\u002Flocalhost:6060\u002Fdebug\u002Fpprof\u002Fprofile?seconds=30\n\u002F\u002F go tool pprof -http=:8080 profile.out  # Web UI\n```\n\n#### Java\n```bash\n# async-profiler (best for JVM)\n# https:\u002F\u002Fgithub.com\u002Fasync-profiler\u002Fasync-profiler\n.\u002Fasprof -d 30 -f profile.html \u003CPID>\n\n# JFR (built-in since JDK 11)\njava -XX:StartFlightRecording=duration=60s,filename=rec.jfr MyApp\njfr print --events CPULoad rec.jfr\n\n# jstack (thread dump)\njstack \u003CPID> > threads.txt\n```\n\n### Memory Profiling\n\n#### Leak Detection Pattern (any language)\n```\n1. Take heap snapshot at T0\n2. Run suspected operation N times\n3. Force GC\n4. Take heap snapshot at T1\n5. Compare: objects that grew = potential leak\n6. Check: are they reachable? From where? (retention path)\n```\n\n#### Node.js Memory\n```javascript\n\u002F\u002F Heap snapshot\nconst v8 = require('v8');\nconst fs = require('fs');\n\nfunction takeSnapshot(label) {\n  const snapshotStream = v8.writeHeapSnapshot();\n  console.log(`Heap snapshot written to ${snapshotStream}`);\n}\n\n\u002F\u002F Process memory monitoring\nsetInterval(() => {\n  const mem = process.memoryUsage();\n  console.log({\n    rss_mb: (mem.rss \u002F 1048576).toFixed(1),\n    heap_used_mb: (mem.heapUsed \u002F 1048576).toFixed(1),\n    heap_total_mb: (mem.heapTotal \u002F 1048576).toFixed(1),\n    external_mb: (mem.external \u002F 1048576).toFixed(1),\n  });\n}, 10000);\n```\n\n#### Python Memory\n```python\n# tracemalloc (built-in)\nimport tracemalloc\n\ntracemalloc.start()\n# ... code ...\nsnapshot = tracemalloc.take_snapshot()\ntop = snapshot.statistics('lineno')\nfor stat in top[:10]:\n    print(stat)\n\n# objgraph (pip install objgraph)\nimport objgraph\nobjgraph.show_most_common_types(limit=20)\nobjgraph.show_growth(limit=10)  # Call twice to see what's growing\n```\n\n### Flame Graph Interpretation\n\n```\nReading a flame graph:\n┌─────────────────────────────────────────────┐\n│                  main()                      │  ← Entry point (bottom)\n├──────────────────────┬──────────────────────┤\n│     processData()    │    renderOutput()     │  ← Width = time spent\n├──────────┬───────────┤                      │\n│ parseCSV │ validate  │                      │  ← Tall = deep call stack\n├──────────┤           │                      │\n│ readline │           │                      │  ← Top = where CPU burns\n└──────────┴───────────┴──────────────────────┘\n\nWHAT TO LOOK FOR:\n1. Wide plateaus at top → CPU-intensive leaf function (optimize this!)\n2. Many thin towers → excessive function calls (batch or reduce)\n3. Recursive patterns → potential stack overflow risk\n4. Unexpected width → function taking more time than expected\n5. GC\u002Fruntime frames → memory pressure\n\nACTION RULES:\n- Plateau >20% width → must investigate\n- Plateau >40% width → almost certainly the bottleneck\n- If top 3 functions = 80% of time → focused optimization will work\n- If evenly distributed → architectural change needed\n```\n\n## Phase 3: Common Optimization Patterns\n\n### Algorithm & Data Structure Optimizations\n\n| Problem | Bad O() | Fix | Good O() |\n|---------|---------|-----|----------|\n| Search unsorted array | O(n) | Sort + binary search, or use Set\u002FMap | O(log n) or O(1) |\n| Nested loop matching | O(n²) | Hash map lookup | O(n) |\n| Repeated string concat | O(n²) | StringBuilder\u002Fjoin array | O(n) |\n| Sorting already-sorted data | O(n log n) | Check if sorted first | O(n) |\n| Finding duplicates | O(n²) | Set-based detection | O(n) |\n| Frequent min\u002Fmax of changing data | O(n) per query | Heap\u002Fpriority queue | O(log n) |\n\n### Caching Strategy Decision Matrix\n\n```\nShould you cache this?\n├── Does the same input always produce the same output?\n│   ├── YES → Cache candidate ✓\n│   └── NO → Can you define a valid TTL?\n│       ├── YES → Cache with TTL ✓\n│       └── NO → Don't cache ✗\n├── Is it called frequently?\n│   ├── \u003C10x\u002Fmin → Probably not worth caching\n│   └── >10x\u002Fmin → Cache ✓\n├── Is the source data expensive to compute\u002Ffetch?\n│   ├── \u003C10ms → Probably not worth caching\n│   └── >10ms → Cache ✓\n└── Does staleness cause problems?\n    ├── Critical (financial, auth) → Short TTL or cache-aside with invalidation\n    ├── Important (user data) → 1-5 min TTL with invalidation\n    └── Tolerant (content, search) → 5-60 min TTL\n\nCACHE LAYERS (use in order):\n1. In-process (Map\u002FLRU) → \u003C1μs, limited by memory, per-instance\n2. Shared cache (Redis\u002FMemcached) → \u003C1ms, shared across instances\n3. CDN\u002Fedge cache → \u003C10ms, geographic distribution\n4. Browser cache → 0ms for user, stale risk\n\nINVALIDATION STRATEGIES:\n- TTL-based: simplest, best for read-heavy + staleness-tolerant\n- Event-based: publish cache-invalidate on write, best for consistency\n- Write-through: update cache on every write, best for write-read patterns\n- Cache-aside: app manages cache explicitly, most flexible\n```\n\n### Connection Pooling\n\n```yaml\n# Sizing formula\npool_size: min(available_cores * 2 + effective_spindle_count, max_connections \u002F num_instances)\n\n# Rules of thumb:\n# - PostgreSQL: connections = cores * 2 + 1 (per pgBouncer docs)\n# - MySQL: keep total connections \u003C 150 for most workloads\n# - HTTP clients: match to concurrent request volume\n# - Redis: usually 5-10 per instance is enough\n\n# Warning signs of pool problems:\n# - \"connection timeout\" errors under load\n# - Response time spikes at regular intervals\n# - Idle connections holding resources\n# - Connection count hitting max_connections\n```\n\n### Async & Concurrency Patterns\n\n```javascript\n\u002F\u002F BAD: Sequential when independent\nconst user = await getUser(id);\nconst orders = await getOrders(id);\nconst prefs = await getPreferences(id);\n\u002F\u002F Total: user_time + orders_time + prefs_time\n\n\u002F\u002F GOOD: Parallel when independent\nconst [user, orders, prefs] = await Promise.all([\n  getUser(id),\n  getOrders(id),\n  getPreferences(id),\n]);\n\u002F\u002F Total: max(user_time, orders_time, prefs_time)\n\n\u002F\u002F GOOD: Controlled concurrency for many items\n\u002F\u002F (npm: p-limit, p-map, or manual semaphore)\nimport pLimit from 'p-limit';\nconst limit = pLimit(10); \u002F\u002F Max 10 concurrent\nconst results = await Promise.all(\n  items.map(item => limit(() => processItem(item)))\n);\n```\n\n```python\n# Python: asyncio for I\u002FO-bound\nimport asyncio\n\nasync def fetch_all(ids):\n    # Parallel\n    tasks = [fetch_one(id) for id in ids]\n    return await asyncio.gather(*tasks)\n\n# Python: ProcessPoolExecutor for CPU-bound\nfrom concurrent.futures import ProcessPoolExecutor\nwith ProcessPoolExecutor(max_workers=4) as pool:\n    results = list(pool.map(cpu_intensive_fn, items))\n```\n\n### N+1 Query Detection & Fix\n\n```\nSYMPTOM: Response time scales linearly with result count\nDETECTION: Enable query logging, count queries per request\n\n# Bad: N+1\nusers = db.query(\"SELECT * FROM users LIMIT 100\")\nfor user in users:\n    orders = db.query(f\"SELECT * FROM orders WHERE user_id = {user.id}\")\n# Result: 1 + 100 = 101 queries\n\n# Fix 1: JOIN\nSELECT u.*, o.* FROM users u\nLEFT JOIN orders o ON o.user_id = u.id\nLIMIT 100\n\n# Fix 2: Batch load (better for large datasets)\nusers = db.query(\"SELECT * FROM users LIMIT 100\")\nuser_ids = [u.id for u in users]\norders = db.query(f\"SELECT * FROM orders WHERE user_id IN ({','.join(user_ids)})\")\n# Result: 2 queries regardless of count\n\n# Fix 3: ORM eager loading\n# Drizzle: .with(users.orders)\n# SQLAlchemy: joinedload(User.orders)\n# Prisma: include: { orders: true }\n```\n\n## Phase 4: Database Performance\n\n### Query Optimization Checklist\n\n```\nFor every slow query:\n□ Run EXPLAIN ANALYZE (not just EXPLAIN)\n□ Check: is it doing a sequential scan on a large table?\n□ Check: is the row estimate accurate? (bad stats = bad plan)\n□ Check: are there implicit type casts preventing index use?\n□ Check: is it sorting more data than needed? (add LIMIT earlier)\n□ Check: is it joining in the right order?\n□ Check: can a covering index eliminate table lookups?\n□ Check: is the query running during peak hours? (schedule if batch)\n```\n\n### EXPLAIN ANALYZE Interpretation\n\n```sql\n-- PostgreSQL EXPLAIN output reading guide:\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;\n\n-- Key metrics to check:\n-- 1. Actual time vs estimated time (large gap = stale stats → ANALYZE)\n-- 2. Rows actual vs estimated (>10x off = bad stats)\n-- 3. Seq Scan on large table (>10K rows) = needs index\n-- 4. Sort with external merge = needs more work_mem or index\n-- 5. Nested Loop with large outer = consider hash\u002Fmerge join\n-- 6. Buffers shared hit vs read (low hit ratio = needs more shared_buffers)\n```\n\n### Index Strategy Guide\n\n```\nWHEN TO ADD AN INDEX:\n✓ WHERE clause column (equality or range)\n✓ JOIN condition column\n✓ ORDER BY column (if query is index-only scan candidate)\n✓ Foreign key column (prevents table lock on parent delete)\n✓ Column in a unique constraint\n\nWHEN NOT TO ADD AN INDEX:\n✗ Table has \u003C1000 rows (seq scan is fine)\n✗ Column has very low cardinality (boolean, status with 3 values)\n✗ Write-heavy table where reads are rare\n✗ You already have 8+ indexes on the table (diminishing returns, write penalty)\n\nINDEX TYPES:\n- B-tree (default): equality, range, sorting, LIKE 'prefix%'\n- Hash: equality only (rarely better than B-tree)\n- GIN: arrays, JSONB, full-text search\n- GiST: geometry, range types, full-text\n- BRIN: large tables with natural ordering (timestamps, sequential IDs)\n\nCOMPOSITE INDEX RULES:\n1. Equality columns first, then range columns\n2. Most selective column first (if all equality)\n3. Index on (a, b) works for WHERE a=1 AND b=2 AND for WHERE a=1 alone\n4. Index on (a, b) does NOT work for WHERE b=2 alone\n```\n\n## Phase 5: Load Testing\n\n### Load Test Design\n\n```yaml\n# load-test-plan.yaml\ntest_name: \"\"\ntarget: \"\"              # URL\u002Fendpoint\ndate: \"\"\n\nscenarios:\n  - name: \"Baseline\"\n    description: \"Normal traffic pattern\"\n    vus: 50               # Virtual users\n    duration: \"5m\"\n    ramp_up: \"30s\"\n    think_time: \"1-3s\"    # Pause between requests\n\n  - name: \"Peak\"\n    description: \"2x normal traffic (expected peak)\"\n    vus: 100\n    duration: \"10m\"\n    ramp_up: \"1m\"\n\n  - name: \"Stress\"\n    description: \"Find the breaking point\"\n    vus_start: 50\n    vus_end: 500\n    step_duration: \"2m\"   # Add users every 2 min\n    step_size: 50\n\n  - name: \"Soak\"\n    description: \"Memory leaks, connection exhaustion\"\n    vus: 50\n    duration: \"2h\"\n\npass_criteria:\n  p95_response_ms: 500\n  error_rate_pct: 0.1\n  throughput_rps: 200\n```\n\n### k6 Load Test Template\n\n```javascript\n\u002F\u002F load-test.js (run: k6 run load-test.js)\nimport http from 'k6\u002Fhttp';\nimport { check, sleep } from 'k6';\nimport { Rate, Trend } from 'k6\u002Fmetrics';\n\nconst errorRate = new Rate('errors');\nconst responseTime = new Trend('response_time');\n\nexport const options = {\n  stages: [\n    { duration: '30s', target: 20 },   \u002F\u002F Ramp up\n    { duration: '3m', target: 20 },    \u002F\u002F Steady\n    { duration: '30s', target: 50 },   \u002F\u002F Peak\n    { duration: '3m', target: 50 },    \u002F\u002F Steady peak\n    { duration: '30s', target: 0 },    \u002F\u002F Ramp down\n  ],\n  thresholds: {\n    http_req_duration: ['p(95)\u003C500'],   \u002F\u002F 95% under 500ms\n    errors: ['rate\u003C0.01'],              \u002F\u002F \u003C1% error rate\n  },\n};\n\nexport default function () {\n  const res = http.get('https:\u002F\u002Fapi.example.com\u002Fendpoint');\n\n  check(res, {\n    'status 200': (r) => r.status === 200,\n    'response \u003C 500ms': (r) => r.timings.duration \u003C 500,\n  });\n\n  errorRate.add(res.status !== 200);\n  responseTime.add(res.timings.duration);\n\n  sleep(Math.random() * 2 + 1); \u002F\u002F 1-3s think time\n}\n```\n\n### Load Test Results Analysis\n\n```\nREADING RESULTS:\n┌──────────────────────────────────────────┐\n│ Metric          │ Healthy │ Warning │ Bad│\n├──────────────────────────────────────────┤\n│ p50\u002Fp95 ratio   │ \u003C2x     │ 2-5x    │>5x│  ← High ratio = tail latency problem\n│ p95\u002Fp99 ratio   │ \u003C2x     │ 2-3x    │>3x│  ← Outliers affecting some users\n│ Error rate      │ \u003C0.1%   │ 0.1-1%  │>1%│  ← Above 1% = user-visible\n│ Throughput drop  │ \u003C5%     │ 5-20%   │>20%│ ← System under stress\n│ CPU at peak     │ \u003C70%    │ 70-85%  │>85%│ ← No headroom\n│ Memory at peak  │ \u003C75%    │ 75-90%  │>90%│ ← Risk of OOM\n│ GC pause time   │ \u003C50ms   │ 50-200ms│>200ms│ ← GC storm\n└──────────────────────────────────────────┘\n\nBOTTLENECK IDENTIFICATION:\n- Throughput plateaus but CPU is low → I\u002FO bound (DB, network, disk)\n- Throughput plateaus and CPU is high → CPU bound (optimize hot path)\n- Response time climbs linearly → Queue building (capacity limit)\n- Response time climbs exponentially → Resource exhaustion (connection pool, memory)\n- Errors spike at specific VU count → Hard limit hit (max connections, file descriptors)\n```\n\n## Phase 6: Frontend Performance\n\n### Core Web Vitals Optimization\n\n```\nMETRIC      │ GOOD    │ NEEDS WORK │ POOR   │ HOW TO FIX\n────────────┼─────────┼────────────┼────────┼────────────────────────\nLCP         │ \u003C2.5s   │ 2.5-4s     │ >4s    │ Optimize largest image\u002Ftext\nFID\u002FINP     │ \u003C100ms  │ 100-300ms  │ >300ms │ Break up long tasks, defer JS\nCLS         │ \u003C0.1    │ 0.1-0.25   │ >0.25  │ Set dimensions, font-display\n\nLCP FIXES (in priority order):\n1. Preload the LCP image: \u003Clink rel=\"preload\" as=\"image\" href=\"...\">\n2. Use responsive images: srcset with correct sizes\n3. Serve WebP\u002FAVIF (30-50% smaller)\n4. Remove render-blocking CSS\u002FJS from \u003Chead>\n5. Use CDN for static assets\n6. Server-side render the above-fold content\n\nINP FIXES:\n1. Break long tasks (>50ms) with requestIdleCallback or setTimeout(0)\n2. Use web workers for CPU-intensive work\n3. Debounce\u002Fthrottle event handlers\n4. Defer non-critical JS: \u003Cscript defer> or dynamic import()\n5. Avoid layout thrashing (batch DOM reads, then batch writes)\n\nCLS FIXES:\n1. Always set width\u002Fheight on \u003Cimg> and \u003Cvideo>\n2. Use aspect-ratio CSS for dynamic content\n3. Reserve space for ads\u002Fembeds\n4. Use font-display: swap with size-adjusted fallback\n5. Never insert content above existing content\n```\n\n### Bundle Optimization\n\n```\nANALYSIS:\n- Webpack: npx webpack-bundle-analyzer stats.json\n- Vite: npx vite-bundle-visualizer\n- Next.js: @next\u002Fbundle-analyzer\n\nREDUCTION STRATEGIES (in order of impact):\n1. Code splitting: dynamic import() for routes and heavy components\n2. Tree shaking: use ESM imports, avoid barrel files (index.ts re-exports)\n3. Replace heavy libraries:\n   - moment.js (330KB) → date-fns (tree-shakeable) or dayjs (2KB)\n   - lodash (530KB) → lodash-es (tree-shakeable) or native JS\n   - chart.js → lightweight alternative for simple charts\n4. Lazy load below-fold components\n5. Externalize large deps to CDN (React, etc.)\n6. Compress: Brotli > gzip (15-20% smaller)\n```\n\n## Phase 7: Infrastructure & Scaling\n\n### Scaling Decision Framework\n\n```\nVERTICAL SCALING (scale up):\n✓ Quick fix, no code changes\n✓ Database servers (often best first move)\n✓ Memory-bound workloads\n✗ Diminishing returns past 8-16 cores\n✗ Single point of failure\n✗ Expensive at high end\n\nHORIZONTAL SCALING (scale out):\n✓ Stateless services (APIs, workers)\n✓ Read-heavy workloads (read replicas)\n✓ Geographic distribution\n✗ Requires stateless design\n✗ Adds complexity (load balancing, session management)\n✗ Not all workloads parallelize\n\nSCALING CHECKLIST:\n□ Can we optimize the code first? (cheapest option)\n□ Can we add caching? (often 10-100x improvement)\n□ Can we add a read replica? (if read-heavy)\n□ Can we queue and process async? (if latency-tolerant)\n□ Can we scale vertically? (if CPU\u002Fmemory bound)\n□ Do we need horizontal scaling? (if all above exhausted)\n```\n\n### Auto-scaling Configuration\n\n```yaml\n# Kubernetes HPA example\napiVersion: autoscaling\u002Fv2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: api-server\nspec:\n  scaleTargetRef:\n    apiVersion: apps\u002Fv1\n    kind: Deployment\n    name: api-server\n  minReplicas: 2\n  maxReplicas: 20\n  metrics:\n    - type: Resource\n      resource:\n        name: cpu\n        target:\n          type: Utilization\n          averageUtilization: 70    # Scale at 70% CPU\n    - type: Resource\n      resource:\n        name: memory\n        target:\n          type: Utilization\n          averageUtilization: 80\n  behavior:\n    scaleUp:\n      stabilizationWindowSeconds: 60    # Wait 1m before scaling up\n      policies:\n        - type: Percent\n          value: 50                      # Max 50% increase per step\n          periodSeconds: 60\n    scaleDown:\n      stabilizationWindowSeconds: 300   # Wait 5m before scaling down\n      policies:\n        - type: Percent\n          value: 25                      # Max 25% decrease per step\n          periodSeconds: 120\n```\n\n## Phase 8: Capacity Planning\n\n### Capacity Model Template\n\n```yaml\n# capacity-model.yaml\nservice: \"\"\nlast_updated: \"\"\n\ncurrent_state:\n  daily_requests: 0\n  peak_rps: 0\n  avg_response_ms: 0\n  instances: 0\n  cpu_peak_pct: 0\n  memory_peak_pct: 0\n  db_connections_peak: 0\n  storage_used_gb: 0\n\ngrowth_model:\n  request_growth_monthly_pct: 0    # e.g., 15%\n  storage_growth_monthly_gb: 0\n  seasonal_peak_multiplier: 0      # e.g., 3x for Black Friday\n\nprojections:\n  # Formula: current * (1 + growth_rate)^months * seasonal_multiplier\n  3_month:\n    daily_requests: 0\n    peak_rps: 0\n    instances_needed: 0\n    storage_gb: 0\n    estimated_cost: \"\"\n  6_month:\n    daily_requests: 0\n    peak_rps: 0\n    instances_needed: 0\n    storage_gb: 0\n    estimated_cost: \"\"\n  12_month:\n    daily_requests: 0\n    peak_rps: 0\n    instances_needed: 0\n    storage_gb: 0\n    estimated_cost: \"\"\n\nheadroom_rules:\n  cpu: \"Scale when sustained >70% for 5m\"\n  memory: \"Scale when >80%\"\n  storage: \"Alert when >75%, expand when >85%\"\n  db_connections: \"Alert when >80% of max\"\n```\n\n### Cost-Performance Tradeoff Analysis\n\n```\nFor every optimization, calculate:\n\nROI = (time_saved_per_month × cost_per_hour) \u002F implementation_cost\n\nEXAMPLE:\n- P95 latency: 800ms → 200ms after optimization\n- Requests\u002Fmonth: 10M\n- Time saved: 600ms × 10M = 1,667 hours of compute\n- Compute cost: $0.05\u002Fhour = $83\u002Fmonth savings\n- Implementation: 16 hours × $150\u002Fhr = $2,400\n- Payback: 29 months ← NOT WORTH IT for cost alone\n\nBUT ALSO CONSIDER:\n- User experience improvement → conversion rate\n- Reduced infrastructure needs → fewer instances\n- Headroom for growth → delayed scaling investment\n- Developer productivity → faster local dev cycles\n```\n\n## Phase 9: Performance in CI\u002FCD\n\n### Automated Performance Gates\n\n```yaml\n# .github\u002Fworkflows\u002Fperf-gate.yml\nname: Performance Gate\non: pull_request\n\njobs:\n  benchmark:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Run benchmarks\n        run: |\n          # Run your benchmark suite\n          npm run benchmark -- --json > bench-results.json\n\n      - name: Compare with baseline\n        run: |\n          # Compare against main branch baseline\n          node scripts\u002Fcompare-benchmarks.js \\\n            --baseline benchmarks\u002Fbaseline.json \\\n            --current bench-results.json \\\n            --threshold 10  # Fail if >10% regression\n\n      - name: Load test (on staging)\n        if: github.base_ref == 'main'\n        run: |\n          k6 run --out json=load-results.json tests\u002Fload-test.js\n          # Check thresholds automatically via k6\n\n      - name: Bundle size check\n        run: |\n          npm run build\n          node scripts\u002Fcheck-bundle-size.js \\\n            --max-size 250KB \\\n            --max-increase 5%\n```\n\n### Performance Regression Detection\n\n```\nAUTOMATED CHECKS (run on every PR):\n□ Unit benchmarks: critical path functions \u003C threshold\n□ Bundle size: total and per-chunk limits\n□ Lighthouse CI: Core Web Vitals pass\n□ Query count: no N+1 regressions (count queries per test)\n□ Memory: no leak patterns in test suite\n\nWEEKLY CHECKS (cron job):\n□ Production p50\u002Fp95\u002Fp99 trends (compare to 4-week average)\n□ Error rate trends\n□ Database slow query log review\n□ Infrastructure cost vs traffic ratio\n□ Cache hit rates\n\nMONTHLY REVIEW:\n□ Capacity model update\n□ Performance budget review\n□ Top 10 slowest endpoints → optimization candidates\n□ Cost-performance analysis\n□ Load test full suite against staging\n```\n\n## Phase 10: Performance Culture\n\n### Performance Review Checklist\n\nScore your system (0-100):\n\n```\nMEASUREMENT (25 points):\n□ (5) Performance budgets defined for all key metrics\n□ (5) Real User Monitoring (RUM) in production\n□ (5) Alerting on p95 degradation\n□ (5) Dashboards visible to team\n□ (5) Regular load testing\n\nPREVENTION (25 points):\n□ (5) Performance gates in CI\u002FCD\n□ (5) Bundle size limits enforced\n□ (5) Query count checks in tests\n□ (5) Code review includes perf review\n□ (5) Capacity planning model maintained\n\nOPTIMIZATION (25 points):\n□ (5) Caching strategy documented\n□ (5) Database indexes reviewed quarterly\n□ (5) No known N+1 queries\n□ (5) Connection pools properly sized\n□ (5) Async patterns used for I\u002FO\n\nOPERATIONS (25 points):\n□ (5) Auto-scaling configured and tested\n□ (5) Slow query logging enabled\n□ (5) Memory leak monitoring\n□ (5) Performance incident runbook exists\n□ (5) Monthly performance review\n```\n\n### Common Anti-Patterns\n\n```\n1. PREMATURE OPTIMIZATION\n   Problem: Optimizing before measuring\n   Fix: Profile first, optimize the measured bottleneck\n\n2. MICRO-BENCHMARKING IN ISOLATION\n   Problem: Function is fast alone but slow in context (cache, contention)\n   Fix: Always benchmark in realistic conditions with realistic data\n\n3. OPTIMIZING THE WRONG LAYER\n   Problem: Tuning app code when the DB is the bottleneck\n   Fix: Use distributed tracing to find the actual bottleneck\n\n4. CACHING EVERYTHING\n   Problem: Cache invalidation bugs, stale data, memory pressure\n   Fix: Cache selectively using the decision matrix (Phase 3)\n\n5. PREMATURE HORIZONTAL SCALING\n   Problem: Adding instances when single instance is underoptimized\n   Fix: Vertical optimization first, scale second\n\n6. IGNORING TAIL LATENCY\n   Problem: p50 is fine but p99 is terrible\n   Fix: Investigate outliers — they're often the most important users\n\n7. LOAD TESTING IN DEV\n   Problem: Dev environment doesn't match production\n   Fix: Load test against staging with production-like data\n\n8. OPTIMIZING COLD PATHS\n   Problem: Spending time on rarely-executed code\n   Fix: Profile in production to find actual hot paths\n```\n\n## Quick Reference: Tool Selection\n\n| Task | Recommended Tool | Alternative |\n|------|-----------------|-------------|\n| HTTP benchmarking | k6 | wrk, ab, hey |\n| CPU profiling (Node) | clinic flame | 0x, --prof |\n| CPU profiling (Python) | py-spy | Scalene, cProfile |\n| CPU profiling (Go) | pprof | go tool trace |\n| CPU profiling (Java) | async-profiler | JFR, VisualVM |\n| Memory profiling | language-specific (see Phase 2) | |\n| CLI benchmarking | hyperfine | time |\n| Bundle analysis | webpack-bundle-analyzer | source-map-explorer |\n| Web performance | Lighthouse | WebPageTest |\n| DB query analysis | EXPLAIN ANALYZE | pgMustard, pganalyze |\n| Distributed tracing | Jaeger, Zipkin | OpenTelemetry |\n| APM | Datadog, New Relic | Grafana + Prometheus |\n| Continuous profiling | Pyroscope | Parca |\n\n## Natural Language Commands\n\n```\n\"Profile this function\"     → CPU profiling with flame graph\n\"Why is this endpoint slow\" → Full investigation brief + profiling\n\"Load test the API\"         → k6 test design and execution\n\"Check for memory leaks\"    → Heap snapshot comparison workflow\n\"Optimize this query\"       → EXPLAIN ANALYZE + index recommendations\n\"Review frontend perf\"      → Core Web Vitals audit + bundle analysis\n\"Plan capacity for 10x\"     → Capacity model with projections\n\"Set up perf monitoring\"    → CI\u002FCD gates + dashboards + alerts\n\"Find the bottleneck\"       → Profiling decision tree walkthrough\n\"Score our performance\"     → Performance review checklist (0-100)\n\"Compare before and after\"  → Benchmark comparison methodology\n\"Reduce bundle size\"        → Bundle analysis + reduction strategies\n```\n","# Performance Engineering System\n\n> From \"it's slow\" to \"here's why and here's the fix\" — a complete methodology for measuring, diagnosing, optimizing, and preventing performance problems.\n\n## Phase 1: Performance Investigation Brief\n\nBefore touching anything, define the problem.\n\n```yaml\n# performance-brief.yaml\ninvestigation:\n  reported_by: \"\"\n  reported_date: \"\"\n  system: \"\"              # service\u002Fapp name\n  environment: \"\"         # production, staging, dev\n\nproblem_statement:\n  symptom: \"\"             # \"API response time increased 3x\"\n  impact: \"\"              # \"15% of users seeing timeouts\"\n  since_when: \"\"          # \"After deploy v2.14 on Feb 20\"\n  affected_scope: \"\"      # \"All endpoints\" | \"Only \u002Fsearch\" | \"Users in EU\"\n\nbaselines:\n  target_p50: \"\"          # e.g., \"200ms\"\n  target_p95: \"\"          # e.g., \"500ms\"\n  target_p99: \"\"          # e.g., \"1000ms\"\n  current_p50: \"\"\n  current_p95: \"\"\n  current_p99: \"\"\n  throughput_target: \"\"   # e.g., \"1000 rps\"\n  error_rate_target: \"\"   # e.g., \"\u003C0.1%\"\n\nconstraints:\n  budget: \"\"              # time\u002Fmoney for optimization\n  risk_tolerance: \"\"      # \"Can we change the schema?\" \"Can we add caching?\"\n  deadline: \"\"            # \"Must fix before Black Friday\"\n\nhypothesis:\n  primary: \"\"             # \"N+1 queries in the new recommendation engine\"\n  secondary: \"\"           # \"Connection pool exhaustion under load\"\n  evidence: \"\"            # \"Slow query log shows 200+ queries per request\"\n```\n\n### Performance Budget Framework\n\nSet budgets BEFORE building, not after complaints:\n\n| Metric | Web App | API | Mobile | Batch Job |\n|--------|---------|-----|--------|-----------|\n| P50 response | \u003C200ms | \u003C100ms | \u003C300ms | N\u002FA |\n| P95 response | \u003C500ms | \u003C250ms | \u003C800ms | N\u002FA |\n| P99 response | \u003C1s | \u003C500ms | \u003C1.5s | N\u002FA |\n| Error rate | \u003C0.1% | \u003C0.01% | \u003C0.5% | \u003C0.001% |\n| Time to Interactive | \u003C3s | N\u002FA | \u003C2s | N\u002FA |\n| Memory per request | \u003C50MB | \u003C20MB | \u003C100MB | \u003C1GB |\n| CPU per request | \u003C100ms | \u003C50ms | \u003C200ms | N\u002FA |\n| Throughput | 100+ rps | 500+ rps | N\u002FA | items\u002Fmin |\n\n## Phase 2: Measurement & Profiling\n\n### The Golden Rule\n**Never optimize without measuring first. Never measure without a hypothesis.**\n\n### Profiling Decision Tree\n\n```\nIs it slow?\n├── YES → Where is time spent?\n│   ├── CPU-bound → Profile CPU (flame graph)\n│   │   ├── Hot function found → Optimize algorithm\u002Fdata structure\n│   │   └── Spread evenly → Architecture problem (too many layers)\n│   ├── I\u002FO-bound → Profile I\u002FO\n│   │   ├── Database → Query analysis (Phase 4)\n│   │   ├── Network → Connection profiling\n│   │   ├── Disk → I\u002FO scheduler + buffering\n│   │   └── External API → Caching + async + circuit breaker\n│   ├── Memory-bound → Profile allocations\n│   │   ├── GC pressure → Reduce allocations, pool objects\n│   │   ├── Memory leak → Heap snapshot comparison\n│   │   └── Cache thrashing → Resize or eviction policy\n│   └── Concurrency-bound → Profile locks\u002Fcontention\n│       ├── Lock contention → Reduce critical section, lock-free structures\n│       ├── Thread starvation → Pool sizing\n│       └── Deadlock → Lock ordering analysis\n└── NO → Define \"fast enough\" (see budgets above)\n```\n\n### CPU Profiling by Language\n\n#### Node.js\n```bash\n# Built-in profiler (V8)\nnode --prof app.js\nnode --prof-process isolate-*.log > profile.txt\n\n# Inspector-based (connect Chrome DevTools)\nnode --inspect app.js\n# Open chrome:\u002F\u002Finspect → Profiler → Start\n\n# Clinic.js (best overall Node.js profiler)\nnpx clinic doctor -- node app.js\nnpx clinic flame -- node app.js    # Flame graph\nnpx clinic bubbleprof -- node app.js  # Async bottlenecks\n\n# 0x (flame graphs)\nnpx 0x app.js\n```\n\n#### Python\n```python\n# cProfile (built-in)\nimport cProfile\nimport pstats\n\nprofiler = cProfile.Profile()\nprofiler.enable()\n# ... code to profile ...\nprofiler.disable()\n\nstats = pstats.Stats(profiler)\nstats.sort_stats('cumulative')\nstats.print_stats(20)  # Top 20\n\n# Line profiler (pip install line-profiler)\n# Add @profile decorator, then:\n# kernprof -l -v script.py\n\n# py-spy (sampling profiler, no code changes)\n# pip install py-spy\n# py-spy top --pid \u003CPID>\n# py-spy record -o profile.svg --pid \u003CPID>  # Flame graph\n\n# Scalene (CPU + memory + GPU)\n# pip install scalene\n# scalene script.py\n```\n\n#### Go\n```go\n\u002F\u002F Built-in pprof\nimport (\n    \"net\u002Fhttp\"\n    _ \"net\u002Fhttp\u002Fpprof\"\n    \"runtime\u002Fpprof\"\n)\n\n\u002F\u002F HTTP server (add to existing server)\n\u002F\u002F Access: http:\u002F\u002Flocalhost:6060\u002Fdebug\u002Fpprof\u002F\ngo func() { http.ListenAndServe(\":6060\", nil) }()\n\n\u002F\u002F CLI analysis\n\u002F\u002F go tool pprof http:\u002F\u002Flocalhost:6060\u002Fdebug\u002Fpprof\u002Fprofile?seconds=30\n\u002F\u002F go tool pprof -http=:8080 profile.out  # Web UI\n```\n\n#### Java\n```bash\n# async-profiler (best for JVM)\n# https:\u002F\u002Fgithub.com\u002Fasync-profiler\u002Fasync-profiler\n.\u002Fasprof -d 30 -f profile.html \u003CPID>\n\n# JFR (built-in since JDK 11)\njava -XX:StartFlightRecording=duration=60s,filename=rec.jfr MyApp\njfr print --events CPULoad rec.jfr\n\n# jstack (thread dump)\njstack \u003CPID> > threads.txt\n```\n\n### Memory Profiling\n\n#### Leak Detection Pattern (any language)\n```\n1. Take heap snapshot at T0\n2. Run suspected operation N times\n3. Force GC\n4. Take heap snapshot at T1\n5. Compare: objects that grew = potential leak\n6. Check: are they reachable? From where? (retention path)\n```\n\n#### Node.js Memory\n```javascript\n\u002F\u002F Heap snapshot\nconst v8 = require('v8');\nconst fs = require('fs');\n\nfunction takeSnapshot(label) {\n  const snapshotStream = v8.writeHeapSnapshot();\n  console.log(`Heap snapshot written to ${snapshotStream}`);\n}\n\n\u002F\u002F Process memory monitoring\nsetInterval(() => {\n  const mem = process.memoryUsage();\n  console.log({\n    rss_mb: (mem.rss \u002F 1048576).toFixed(1),\n    heap_used_mb: (mem.heapUsed \u002F 1048576).toFixed(1),\n    heap_total_mb: (mem.heapTotal \u002F 1048576).toFixed(1),\n    external_mb: (mem.external \u002F 1048576).toFixed(1),\n  });\n}, 10000);\n```\n\n#### Python Memory\n```python\n# tracemalloc (built-in)\nimport tracemalloc\n\ntracemalloc.start()\n# ... code ...\nsnapshot = tracemalloc.take_snapshot()\ntop = snapshot.statistics('lineno')\nfor stat in top[:10]:\n    print(stat)\n\n# objgraph (pip install objgraph)\nimport objgraph\nobjgraph.show_most_common_types(limit=20)\nobjgraph.show_growth(limit=10)  # Call twice to see what's growing\n```\n\n### Flame Graph Interpretation\n\n```\nReading a flame graph:\n┌─────────────────────────────────────────────┐\n│                  main()                      │  ← Entry point (bottom)\n├──────────────────────┬──────────────────────┤\n│     processData()    │    renderOutput()     │  ← Width = time spent\n├──────────┬───────────┤                      │\n│ parseCSV │ validate  │                      │  ← Tall = deep call stack\n├──────────┤           │                      │\n│ readline │           │                      │  ← Top = where CPU burns\n└──────────┴───────────┴──────────────────────┘\n\nWHAT TO LOOK FOR:\n1. Wide plateaus at top → CPU-intensive leaf function (optimize this!)\n2. Many thin towers → excessive function calls (batch or reduce)\n3. Recursive patterns → potential stack overflow risk\n4. Unexpected width → function taking more time than expected\n5. GC\u002Fruntime frames → memory pressure\n\nACTION RULES:\n- Plateau >20% width → must investigate\n- Plateau >40% width → almost certainly the bottleneck\n- If top 3 functions = 80% of time → focused optimization will work\n- If evenly distributed → architectural change needed\n```\n\n## Phase 3: Common Optimization Patterns\n\n### Algorithm & Data Structure Optimizations\n\n| Problem | Bad O() | Fix | Good O() |\n|---------|---------|-----|----------|\n| Search unsorted array | O(n) | Sort + binary search, or use Set\u002FMap | O(log n) or O(1) |\n| Nested loop matching | O(n²) | Hash map lookup | O(n) |\n| Repeated string concat | O(n²) | StringBuilder\u002Fjoin array | O(n) |\n| Sorting already-sorted data | O(n log n) | Check if sorted first | O(n) |\n| Finding duplicates | O(n²) | Set-based detection | O(n) |\n| Frequent min\u002Fmax of changing data | O(n) per query | Heap\u002Fpriority queue | O(log n) |\n\n### Caching Strategy Decision Matrix\n\n```\nShould you cache this?\n├── Does the same input always produce the same output?\n│   ├── YES → Cache candidate ✓\n│   └── NO → Can you define a valid TTL?\n│       ├── YES → Cache with TTL ✓\n│       └── NO → Don't cache ✗\n├── Is it called frequently?\n│   ├── \u003C10x\u002Fmin → Probably not worth caching\n│   └── >10x\u002Fmin → Cache ✓\n├── Is the source data expensive to compute\u002Ffetch?\n│   ├── \u003C10ms → Probably not worth caching\n│   └── >10ms → Cache ✓\n└── Does staleness cause problems?\n    ├── Critical (financial, auth) → Short TTL or cache-aside with invalidation\n    ├── Important (user data) → 1-5 min TTL with invalidation\n    └── Tolerant (content, search) → 5-60 min TTL\n\nCACHE LAYERS (use in order):\n1. In-process (Map\u002FLRU) → \u003C1μs, limited by memory, per-instance\n2. Shared cache (Redis\u002FMemcached) → \u003C1ms, shared across instances\n3. CDN\u002Fedge cache → \u003C10ms, geographic distribution\n4. Browser cache → 0ms for user, stale risk\n\nINVALIDATION STRATEGIES:\n- TTL-based: simplest, best for read-heavy + staleness-tolerant\n- Event-based: publish cache-invalidate on write, best for consistency\n- Write-through: update cache on every write, best for write-read patterns\n- Cache-aside: app manages cache explicitly, most flexible\n```\n\n### Connection Pooling\n\n```yaml\n# Sizing formula\npool_size: min(available_cores * 2 + effective_spindle_count, max_connections \u002F num_instances)\n\n# Rules of thumb:\n# - PostgreSQL: connections = cores * 2 + 1 (per pgBouncer docs)\n# - MySQL: keep total connections \u003C 150 for most workloads\n# - HTTP clients: match to concurrent request volume\n# - Redis: usually 5-10 per instance is enough\n\n# Warning signs of pool problems:\n# - \"connection timeout\" errors under load\n# - Response time spikes at regular intervals\n# - Idle connections holding resources\n# - Connection count hitting max_connections\n```\n\n### Async & Concurrency Patterns\n\n```javascript\n\u002F\u002F BAD: Sequential when independent\nconst user = await getUser(id);\nconst orders = await getOrders(id);\nconst prefs = await getPreferences(id);\n\u002F\u002F Total: user_time + orders_time + prefs_time\n\n\u002F\u002F GOOD: Parallel when independent\nconst [user, orders, prefs] = await Promise.all([\n  getUser(id),\n  getOrders(id),\n  getPreferences(id),\n]);\n\u002F\u002F Total: max(user_time, orders_time, prefs_time)\n\n\u002F\u002F GOOD: Controlled concurrency for many items\n\u002F\u002F (npm: p-limit, p-map, or manual semaphore)\nimport pLimit from 'p-limit';\nconst limit = pLimit(10); \u002F\u002F Max 10 concurrent\nconst results = await Promise.all(\n  items.map(item => limit(() => processItem(item)))\n);\n```\n\n```python\n# Python: asyncio for I\u002FO-bound\nimport asyncio\n\nasync def fetch_all(ids):\n    # Parallel\n    tasks = [fetch_one(id) for id in ids]\n    return await asyncio.gather(*tasks)\n\n# Python: ProcessPoolExecutor for CPU-bound\nfrom concurrent.futures import ProcessPoolExecutor\nwith ProcessPoolExecutor(max_workers=4) as pool:\n    results = list(pool.map(cpu_intensive_fn, items))\n```\n\n### N+1 Query Detection & Fix\n\n```\nSYMPTOM: Response time scales linearly with result count\nDETECTION: Enable query logging, count queries per request\n\n# Bad: N+1\nusers = db.query(\"SELECT * FROM users LIMIT 100\")\nfor user in users:\n    orders = db.query(f\"SELECT * FROM orders WHERE user_id = {user.id}\")\n# Result: 1 + 100 = 101 queries\n\n# Fix 1: JOIN\nSELECT u.*, o.* FROM users u\nLEFT JOIN orders o ON o.user_id = u.id\nLIMIT 100\n\n# Fix 2: Batch load (better for large datasets)\nusers = db.query(\"SELECT * FROM users LIMIT 100\")\nuser_ids = [u.id for u in users]\norders = db.query(f\"SELECT * FROM orders WHERE user_id IN ({','.join(user_ids)})\")\n# Result: 2 queries regardless of count\n\n# Fix 3: ORM eager loading\n# Drizzle: .with(users.orders)\n# SQLAlchemy: joinedload(User.orders)\n# Prisma: include: { orders: true }\n```\n\n## Phase 4: Database Performance\n\n### Query Optimization Checklist\n\n```\nFor every slow query:\n□ Run EXPLAIN ANALYZE (not just EXPLAIN)\n□ Check: is it doing a sequential scan on a large table?\n□ Check: is the row estimate accurate? (bad stats = bad plan)\n□ Check: are there implicit type casts preventing index use?\n□ Check: is it sorting more data than needed? (add LIMIT earlier)\n□ Check: is it joining in the right order?\n□ Check: can a covering index eliminate table lookups?\n□ Check: is the query running during peak hours? (schedule if batch)\n```\n\n### EXPLAIN ANALYZE Interpretation\n\n```sql\n-- PostgreSQL EXPLAIN output reading guide:\nEXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;\n\n-- Key metrics to check:\n-- 1. Actual time vs estimated time (large gap = stale stats → ANALYZE)\n-- 2. Rows actual vs estimated (>10x off = bad stats)\n-- 3. Seq Scan on large table (>10K rows) = needs index\n-- 4. Sort with external merge = needs more work_mem or index\n-- 5. Nested Loop with large outer = consider hash\u002Fmerge join\n-- 6. Buffers shared hit vs read (low hit ratio = needs more shared_buffers)\n```\n\n### Index Strategy Guide\n\n```\nWHEN TO ADD AN INDEX:\n✓ WHERE clause column (equality or range)\n✓ JOIN condition column\n✓ ORDER BY column (if query is index-only scan candidate)\n✓ Foreign key column (prevents table lock on parent delete)\n✓ Column in a unique constraint\n\nWHEN NOT TO ADD AN INDEX:\n✗ Table has \u003C1000 rows (seq scan is fine)\n✗ Column has very low cardinality (boolean, status with 3 values)\n✗ Write-heavy table where reads are rare\n✗ You already have 8+ indexes on the table (diminishing returns, write penalty)\n\nINDEX TYPES:\n- B-tree (default): equality, range, sorting, LIKE 'prefix%'\n- Hash: equality only (rarely better than B-tree)\n- GIN: arrays, JSONB, full-text search\n- GiST: geometry, range types, full-text\n- BRIN: large tables with natural ordering (timestamps, sequential IDs)\n\nCOMPOSITE INDEX RULES:\n1. Equality columns first, then range columns\n2. Most selective column first (if all equality)\n3. Index on (a, b) works for WHERE a=1 AND b=2 AND for WHERE a=1 alone\n4. Index on (a, b) does NOT work for WHERE b=2 alone\n```\n\n## Phase 5: Load Testing\n\n### Load Test Design\n\n```yaml\n# load-test-plan.yaml\ntest_name: \"\"\ntarget: \"\"              # URL\u002Fendpoint\ndate: \"\"\n\nscenarios:\n  - name: \"Baseline\"\n    description: \"Normal traffic pattern\"\n    vus: 50               # Virtual users\n    duration: \"5m\"\n    ramp_up: \"30s\"\n    think_time: \"1-3s\"    # Pause between requests\n\n  - name: \"Peak\"\n    description: \"2x normal traffic (expected peak)\"\n    vus: 100\n    duration: \"10m\"\n    ramp_up: \"1m\"\n\n  - name: \"Stress\"\n    description: \"Find the breaking point\"\n    vus_start: 50\n    vus_end: 500\n    step_duration: \"2m\"   # Add users every 2 min\n    step_size: 50\n\n  - name: \"Soak\"\n    description: \"Memory leaks, connection exhaustion\"\n    vus: 50\n    duration: \"2h\"\n\npass_criteria:\n  p95_response_ms: 500\n  error_rate_pct: 0.1\n  throughput_rps: 200\n```\n\n### k6 Load Test Template\n\n```javascript\n\u002F\u002F load-test.js (run: k6 run load-test.js)\nimport http from 'k6\u002Fhttp';\nimport { check, sleep } from 'k6';\nimport { Rate, Trend } from 'k6\u002Fmetrics';\n\nconst errorRate = new Rate('errors');\nconst responseTime = new Trend('response_time');\n\nexport const options = {\n  stages: [\n    { duration: '30s', target: 20 },   \u002F\u002F Ramp up\n    { duration: '3m', target: 20 },    \u002F\u002F Steady\n    { duration: '30s', target: 50 },   \u002F\u002F Peak\n    { duration: '3m', target: 50 },    \u002F\u002F Steady peak\n    { duration: '30s', target: 0 },    \u002F\u002F Ramp down\n  ],\n  thresholds: {\n    http_req_duration: ['p(95)\u003C500'],   \u002F\u002F 95% under 500ms\n    errors: ['rate\u003C0.01'],              \u002F\u002F \u003C1% error rate\n  },\n};\n\nexport default function () {\n  const res = http.get('https:\u002F\u002Fapi.example.com\u002Fendpoint');\n\n  check(res, {\n    'status 200': (r) => r.status === 200,\n    'response \u003C 500ms': (r) => r.timings.duration \u003C 500,\n  });\n\n  errorRate.add(res.status !== 200);\n  responseTime.add(res.timings.duration);\n\n  sleep(Math.random() * 2 + 1); \u002F\u002F 1-3s think time\n}\n```\n\n### Load Test Results Analysis\n\n```\nREADING RESULTS:\n┌──────────────────────────────────────────┐\n│ Metric          │ Healthy │ Warning │ Bad│\n├──────────────────────────────────────────┤\n│ p50\u002Fp95 ratio   │ \u003C2x     │ 2-5x    │>5x│  ← High ratio = tail latency problem\n│ p95\u002Fp99 ratio   │ \u003C2x     │ 2-3x    │>3x│  ← Outliers affecting some users\n│ Error rate      │ \u003C0.1%   │ 0.1-1%  │>1%│  ← Above 1% = user-visible\n│ Throughput drop  │ \u003C5%     │ 5-20%   │>20%│ ← System under stress\n│ CPU at peak     │ \u003C70%    │ 70-85%  │>85%│ ← No headroom\n│ Memory at peak  │ \u003C75%    │ 75-90%  │>90%│ ← Risk of OOM\n│ GC pause time   │ \u003C50ms   │ 50-200ms│>200ms│ ← GC storm\n└──────────────────────────────────────────┘\n\nBOTTLENECK IDENTIFICATION:\n- Throughput plateaus but CPU is low → I\u002FO bound (DB, network, disk)\n- Throughput plateaus and CPU is high → CPU bound (optimize hot path)\n- Response time climbs linearly → Queue building (capacity limit)\n- Response time climbs exponentially → Resource exhaustion (connection pool, memory)\n- Errors spike at specific VU count → Hard limit hit (max connections, file descriptors)\n```\n\n## Phase 6: Frontend Performance\n\n### Core Web Vitals Optimization\n\n```\nMETRIC      │ GOOD    │ NEEDS WORK │ POOR   │ HOW TO FIX\n────────────┼─────────┼────────────┼────────┼────────────────────────\nLCP         │ \u003C2.5s   │ 2.5-4s     │ >4s    │ Optimize largest image\u002Ftext\nFID\u002FINP     │ \u003C100ms  │ 100-300ms  │ >300ms │ Break up long tasks, defer JS\nCLS         │ \u003C0.1    │ 0.1-0.25   │ >0.25  │ Set dimensions, font-display\n\nLCP FIXES (in priority order):\n1. Preload the LCP image: \u003Clink rel=\"preload\" as=\"image\" href=\"...\">\n2. Use responsive images: srcset with correct sizes\n3. Serve WebP\u002FAVIF (30-50% smaller)\n4. Remove render-blocking CSS\u002FJS from \u003Chead>\n5. Use CDN for static assets\n6. Server-side render the above-fold content\n\nINP FIXES:\n1. Break long tasks (>50ms) with requestIdleCallback or setTimeout(0)\n2. Use web workers for CPU-intensive work\n3. Debounce\u002Fthrottle event handlers\n4. Defer non-critical JS: \u003Cscript defer> or dynamic import()\n5. Avoid layout thrashing (batch DOM reads, then batch writes)\n\nCLS FIXES:\n1. Always set width\u002Fheight on \u003Cimg> and \u003Cvideo>\n2. Use aspect-ratio CSS for dynamic content\n3. Reserve space for ads\u002Fembeds\n4. Use font-display: swap with size-adjusted fallback\n5. Never insert content above existing content\n```\n\n### Bundle Optimization\n\n```\nANALYSIS:\n- Webpack: npx webpack-bundle-analyzer stats.json\n- Vite: npx vite-bundle-visualizer\n- Next.js: @next\u002Fbundle-analyzer\n\nREDUCTION STRATEGIES (in order of impact):\n1. Code splitting: dynamic import() for routes and heavy components\n2. Tree shaking: use ESM imports, avoid barrel files (index.ts re-exports)\n3. Replace heavy libraries:\n   - moment.js (330KB) → date-fns (tree-shakeable) or dayjs (2KB)\n   - lodash (530KB) → lodash-es (tree-shakeable) or native JS\n   - chart.js → lightweight alternative for simple charts\n4. Lazy load below-fold components\n5. Externalize large deps to CDN (React, etc.)\n6. Compress: Brotli > gzip (15-20% smaller)\n```\n\n## Phase 7: Infrastructure & Scaling\n\n### Scaling Decision Framework\n\n```\nVERTICAL SCALING (scale up):\n✓ Quick fix, no code changes\n✓ Database servers (often best first move)\n✓ Memory-bound workloads\n✗ Diminishing returns past 8-16 cores\n✗ Single point of failure\n✗ Expensive at high end\n\nHORIZONTAL SCALING (scale out):\n✓ Stateless services (APIs, workers)\n✓ Read-heavy workloads (read replicas)\n✓ Geographic distribution\n✗ Requires stateless design\n✗ Adds complexity (load balancing, session management)\n✗ Not all workloads parallelize\n\nSCALING CHECKLIST:\n□ Can we optimize the code first? (cheapest option)\n□ Can we add caching? (often 10-100x improvement)\n□ Can we add a read replica? (if read-heavy)\n□ Can we queue and process async? (if latency-tolerant)\n□ Can we scale vertically? (if CPU\u002Fmemory bound)\n□ Do we need horizontal scaling? (if all above exhausted)\n```\n\n### Auto-scaling Configuration\n\n```yaml\n# Kubernetes HPA example\napiVersion: autoscaling\u002Fv2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: api-server\nspec:\n  scaleTargetRef:\n    apiVersion: apps\u002Fv1\n    kind: Deployment\n    name: api-server\n  minReplicas: 2\n  maxReplicas: 20\n  metrics:\n    - type: Resource\n      resource:\n        name: cpu\n        target:\n          type: Utilization\n          averageUtilization: 70    # Scale at 70% CPU\n    - type: Resource\n      resource:\n        name: memory\n        target:\n          type: Utilization\n          averageUtilization: 80\n  behavior:\n    scaleUp:\n      stabilizationWindowSeconds: 60    # Wait 1m before scaling up\n      policies:\n        - type: Percent\n          value: 50                      # Max 50% increase per step\n          periodSeconds: 60\n    scaleDown:\n      stabilizationWindowSeconds: 300   # Wait 5m before scaling down\n      policies:\n        - type: Percent\n          value: 25                      # Max 25% decrease per step\n          periodSeconds: 120\n```\n\n## Phase 8: Capacity Planning\n\n### Capacity Model Template\n\n```yaml\n# capacity-model.yaml\nservice: \"\"\nlast_updated: \"\"\n\ncurrent_state:\n  daily_requests: 0\n  peak_rps: 0\n  avg_response_ms: 0\n  instances: 0\n  cpu_peak_pct: 0\n  memory_peak_pct: 0\n  db_connections_peak: 0\n  storage_used_gb: 0\n\ngrowth_model:\n  request_growth_monthly_pct: 0    # e.g., 15%\n  storage_growth_monthly_gb: 0\n  seasonal_peak_multiplier: 0      # e.g., 3x for Black Friday\n\nprojections:\n  # Formula: current * (1 + growth_rate)^months * seasonal_multiplier\n  3_month:\n    daily_requests: 0\n    peak_rps: 0\n    instances_needed: 0\n    storage_gb: 0\n    estimated_cost: \"\"\n  6_month:\n    daily_requests: 0\n    peak_rps: 0\n    instances_needed: 0\n    storage_gb: 0\n    estimated_cost: \"\"\n  12_month:\n    daily_requests: 0\n    peak_rps: 0\n    instances_needed: 0\n    storage_gb: 0\n    estimated_cost: \"\"\n\nheadroom_rules:\n  cpu: \"Scale when sustained >70% for 5m\"\n  memory: \"Scale when >80%\"\n  storage: \"Alert when >75%, expand when >85%\"\n  db_connections: \"Alert when >80% of max\"\n```\n\n### Cost-Performance Tradeoff Analysis\n\n```\nFor every optimization, calculate:\n\nROI = (time_saved_per_month × cost_per_hour) \u002F implementation_cost\n\nEXAMPLE:\n- P95 latency: 800ms → 200ms after optimization\n- Requests\u002Fmonth: 10M\n- Time saved: 600ms × 10M = 1,667 hours of compute\n- Compute cost: $0.05\u002Fhour = $83\u002Fmonth savings\n- Implementation: 16 hours × $150\u002Fhr = $2,400\n- Payback: 29 months ← NOT WORTH IT for cost alone\n\nBUT ALSO CONSIDER:\n- User experience improvement → conversion rate\n- Reduced infrastructure needs → fewer instances\n- Headroom for growth → delayed scaling investment\n- Developer productivity → faster local dev cycles\n```\n\n## Phase 9: Performance in CI\u002FCD\n\n### Automated Performance Gates\n\n```yaml\n# .github\u002Fworkflows\u002Fperf-gate.yml\nname: Performance Gate\non: pull_request\n\njobs:\n  benchmark:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Run benchmarks\n        run: |\n          # Run your benchmark suite\n          npm run benchmark -- --json > bench-results.json\n\n      - name: Compare with baseline\n        run: |\n          # Compare against main branch baseline\n          node scripts\u002Fcompare-benchmarks.js \\\n            --baseline benchmarks\u002Fbaseline.json \\\n            --current bench-results.json \\\n            --threshold 10  # Fail if >10% regression\n\n      - name: Load test (on staging)\n        if: github.base_ref == 'main'\n        run: |\n          k6 run --out json=load-results.json tests\u002Fload-test.js\n          # Check thresholds automatically via k6\n\n      - name: Bundle size check\n        run: |\n          npm run build\n          node scripts\u002Fcheck-bundle-size.js \\\n            --max-size 250KB \\\n            --max-increase 5%\n```\n\n### Performance Regression Detection\n\n```\nAUTOMATED CHECKS (run on every PR):\n□ Unit benchmarks: critical path functions \u003C threshold\n□ Bundle size: total and per-chunk limits\n□ Lighthouse CI: Core Web Vitals pass\n□ Query count: no N+1 regressions (count queries per test)\n□ Memory: no leak patterns in test suite\n\nWEEKLY CHECKS (cron job):\n□ Production p50\u002Fp95\u002Fp99 trends (compare to 4-week average)\n□ Error rate trends\n□ Database slow query log review\n□ Infrastructure cost vs traffic ratio\n□ Cache hit rates\n\nMONTHLY REVIEW:\n□ Capacity model update\n□ Performance budget review\n□ Top 10 slowest endpoints → optimization candidates\n□ Cost-performance analysis\n□ Load test full suite against staging\n```\n\n## Phase 10: Performance Culture\n\n### Performance Review Checklist\n\nScore your system (0-100):\n\n```\nMEASUREMENT (25 points):\n□ (5) Performance budgets defined for all key metrics\n□ (5) Real User Monitoring (RUM) in production\n□ (5) Alerting on p95 degradation\n□ (5) Dashboards visible to team\n□ (5) Regular load testing\n\nPREVENTION (25 points):\n□ (5) Performance gates in CI\u002FCD\n□ (5) Bundle size limits enforced\n□ (5) Query count checks in tests\n□ (5) Code review includes perf review\n□ (5) Capacity planning model maintained\n\nOPTIMIZATION (25 points):\n□ (5) Caching strategy documented\n□ (5) Database indexes reviewed quarterly\n□ (5) No known N+1 queries\n□ (5) Connection pools properly sized\n□ (5) Async patterns used for I\u002FO\n\nOPERATIONS (25 points):\n□ (5) Auto-scaling configured and tested\n□ (5) Slow query logging enabled\n□ (5) Memory leak monitoring\n□ (5) Performance incident runbook exists\n□ (5) Monthly performance review\n```\n\n### Common Anti-Patterns\n\n```\n1. PREMATURE OPTIMIZATION\n   Problem: Optimizing before measuring\n   Fix: Profile first, optimize the measured bottleneck\n\n2. MICRO-BENCHMARKING IN ISOLATION\n   Problem: Function is fast alone but slow in context (cache, contention)\n   Fix: Always benchmark in realistic conditions with realistic data\n\n3. OPTIMIZING THE WRONG LAYER\n   Problem: Tuning app code when the DB is the bottleneck\n   Fix: Use distributed tracing to find the actual bottleneck\n\n4. CACHING EVERYTHING\n   Problem: Cache invalidation bugs, stale data, memory pressure\n   Fix: Cache selectively using the decision matrix (Phase 3)\n\n5. PREMATURE HORIZONTAL SCALING\n   Problem: Adding instances when single instance is underoptimized\n   Fix: Vertical optimization first, scale second\n\n6. IGNORING TAIL LATENCY\n   Problem: p50 is fine but p99 is terrible\n   Fix: Investigate outliers — they're often the most important users\n\n7. LOAD TESTING IN DEV\n   Problem: Dev environment doesn't match production\n   Fix: Load test against staging with production-like data\n\n8. OPTIMIZING COLD PATHS\n   Problem: Spending time on rarely-executed code\n   Fix: Profile in production to find actual hot paths\n```\n\n## Quick Reference: Tool Selection\n\n| Task | Recommended Tool | Alternative |\n|------|-----------------|-------------|\n| HTTP benchmarking | k6 | wrk, ab, hey |\n| CPU profiling (Node) | clinic flame | 0x, --prof |\n| CPU profiling (Python) | py-spy | Scalene, cProfile |\n| CPU profiling (Go) | pprof | go tool trace |\n| CPU profiling (Java) | async-profiler | JFR, VisualVM |\n| Memory profiling | language-specific (see Phase 2) | |\n| CLI benchmarking | hyperfine | time |\n| Bundle analysis | webpack-bundle-analyzer | source-map-explorer |\n| Web performance | Lighthouse | WebPageTest |\n| DB query analysis | EXPLAIN ANALYZE | pgMustard, pganalyze |\n| Distributed tracing | Jaeger, Zipkin | OpenTelemetry |\n| APM | Datadog, New Relic | Grafana + Prometheus |\n| Continuous profiling | Pyroscope | Parca |\n\n## Natural Language Commands\n\n```\n\"Profile this function\"     → CPU profiling with flame graph\n\"Why is this endpoint slow\" → Full investigation brief + profiling\n\"Load test the API\"         → k6 test design and execution\n\"Check for memory leaks\"    → Heap snapshot comparison workflow\n\"Optimize this query\"       → EXPLAIN ANALYZE + index recommendations\n\"Review frontend perf\"      → Core Web Vitals audit + bundle analysis\n\"Plan capacity for 10x\"     → Capacity model with projections\n\"Set up perf monitoring\"    → CI\u002FCD gates + dashboards + alerts\n\"Find the bottleneck\"       → Profiling decision tree walkthrough\n\"Score our performance\"     → Performance review checklist (0-100)\n\"Compare before and after\"  → Benchmark comparison methodology\n\"Reduce bundle size\"        → Bundle analysis + reduction strategies\n```\n",{"name":5,"metadata":24,"description":7},{"openclaw":25},{"os":26},[27,28,29],"linux","darwin","win32","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fa\u002Fafrexai-performance-engineering",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill afrexai-performance-engineering",{"tool":45,"command":46},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill afrexai-performance-engineering",{"tool":48,"command":49},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill afrexai-performance-engineering","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fa\u002Fafrexai-performance-engineering\u002FSKILL.md",true,[],[54,62,69,76,83,90],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":61},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":61},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":61},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":61},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":61},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":61},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]