afrexai-performance-engineering
Complete performance engineering system â profiling, optimization, load testing, capacity planning, and performance culture
Install / Use
npx skills add LeoYeAI/openclaw-master-skills --skill afrexai-performance-engineeringInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Our assessment of afrexai-performance-engineering
afrexai-performance-engineering scores 90/100 on our quality scale, 1220th of 2,780 Automation skills we index (top 44%).
Its SKILL.md is 28 KB long, well organised into 98 sections with 32 code examples: a thorough specification that gives an agent plenty to work with.
With 2,149 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- Our last check on 2026-10-30 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 98/100, with no cautions. These come from repository metadata, not a code audit â read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-30. Automated pattern scan on 2026-09-30. It catches known dangerous patterns, not every risk â read a skill before letting an agent act on it.
afrexai-performance-engineering compared with similar skills
All 4 of these similar skills score higher than afrexai-performance-engineering; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| afrexai-performance-engineering (this skill)by LeoYeAI | 90 | 2.1k | 4mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 9d ago | CLAUDE.md |
| rufloby ruvnet | 100 | 81.9k | today | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
| Claude-Code-Game-Studiosby Donchitos | 100 | 39.7k | 7d ago | CLAUDE.md |
Frequently asked questions
- How do I install afrexai-performance-engineering?
- Run
npx skills add LeoYeAI/openclaw-master-skills --skill afrexai-performance-engineering. The install tabs above show the steps for each supported agent. - Which AI agents does afrexai-performance-engineering work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is afrexai-performance-engineering safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 98/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is afrexai-performance-engineering still maintained?
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHubname: afrexai-performance-engineering description: Complete performance engineering system â profiling, optimization, load testing, capacity planning, and performance culture. Use when diagnosing slow applications, optimizing code/queries/infrastructure, load testing before launch, planning capacity, or building performance into CI/CD. Covers Node.js, Python, Go, Java, databases, APIs, and frontend. metadata: openclaw: os: [linux, darwin, win32]
Performance Engineering System
From "it's slow" to "here's why and here's the fix" â a complete methodology for measuring, diagnosing, optimizing, and preventing performance problems.
Phase 1: Performance Investigation Brief
Before touching anything, define the problem.
# performance-brief.yaml
investigation:
reported_by: ""
reported_date: ""
system: "" # service/app name
environment: "" # production, staging, dev
problem_statement:
symptom: "" # "API response time increased 3x"
impact: "" # "15% of users seeing timeouts"
since_when: "" # "After deploy v2.14 on Feb 20"
affected_scope: "" # "All endpoints" | "Only /search" | "Users in EU"
baselines:
target_p50: "" # e.g., "200ms"
target_p95: "" # e.g., "500ms"
target_p99: "" # e.g., "1000ms"
current_p50: ""
current_p95: ""
current_p99: ""
throughput_target: "" # e.g., "1000 rps"
error_rate_target: "" # e.g., "<0.1%"
constraints:
budget: "" # time/money for optimization
risk_tolerance: "" # "Can we change the schema?" "Can we add caching?"
deadline: "" # "Must fix before Black Friday"
hypothesis:
primary: "" # "N+1 queries in the new recommendation engine"
secondary: "" # "Connection pool exhaustion under load"
evidence: "" # "Slow query log shows 200+ queries per request"
Performance Budget Framework
Set budgets BEFORE building, not after complaints:
| Metric | Web App | API | Mobile | Batch Job | |--------|---------|-----|--------|-----------| | P50 response | <200ms | <100ms | <300ms | N/A | | P95 response | <500ms | <250ms | <800ms | N/A | | P99 response | <1s | <500ms | <1.5s | N/A | | Error rate | <0.1% | <0.01% | <0.5% | <0.001% | | Time to Interactive | <3s | N/A | <2s | N/A | | Memory per request | <50MB | <20MB | <100MB | <1GB | | CPU per request | <100ms | <50ms | <200ms | N/A | | Throughput | 100+ rps | 500+ rps | N/A | items/min |
Phase 2: Measurement & Profiling
The Golden Rule
Never optimize without measuring first. Never measure without a hypothesis.
Profiling Decision Tree
Is it slow?
âââ YES â Where is time spent?
â âââ CPU-bound â Profile CPU (flame graph)
â â âââ Hot function found â Optimize algorithm/data structure
â â âââ Spread evenly â Architecture problem (too many layers)
â âââ I/O-bound â Profile I/O
â â âââ Database â Query analysis (Phase 4)
â â âââ Network â Connection profiling
â â âââ Disk â I/O scheduler + buffering
â â âââ External API â Caching + async + circuit breaker
â âââ Memory-bound â Profile allocations
â â âââ GC pressure â Reduce allocations, pool objects
â â âââ Memory leak â Heap snapshot comparison
â â âââ Cache thrashing â Resize or eviction policy
â âââ Concurrency-bound â Profile locks/contention
â âââ Lock contention â Reduce critical section, lock-free structures
â âââ Thread starvation â Pool sizing
â âââ Deadlock â Lock ordering analysis
âââ NO â Define "fast enough" (see budgets above)
CPU Profiling by Language
Node.js
# Built-in profiler (V8)
node --prof app.js
node --prof-process isolate-*.log > profile.txt
# Inspector-based (connect Chrome DevTools)
node --inspect app.js
# Open chrome://inspect â Profiler â Start
# Clinic.js (best overall Node.js profiler)
npx clinic doctor -- node app.js
npx clinic flame -- node app.js # Flame graph
npx clinic bubbleprof -- node app.js # Async bottlenecks
# 0x (flame graphs)
npx 0x app.js
Python
# cProfile (built-in)
import cProfile
import pstats
profiler = cProfile.Profile()
profiler.enable()
# ... code to profile ...
profiler.disable()
stats = pstats.Stats(profiler)
stats.sort_stats('cumulative')
stats.print_stats(20) # Top 20
# Line profiler (pip install line-profiler)
# Add @profile decorator, then:
# kernprof -l -v script.py
# py-spy (sampling profiler, no code changes)
# pip install py-spy
# py-spy top --pid <PID>
# py-spy record -o profile.svg --pid <PID> # Flame graph
# Scalene (CPU + memory + GPU)
# pip install scalene
# scalene script.py
Go
// Built-in pprof
import (
"net/http"
_ "net/http/pprof"
"runtime/pprof"
)
// HTTP server (add to existing server)
// Access: http://localhost:6060/debug/pprof/
go func() { http.ListenAndServe(":6060", nil) }()
// CLI analysis
// go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
// go tool pprof -http=:8080 profile.out # Web UI
Java
# async-profiler (best for JVM)
# https://github.com/async-profiler/async-profiler
./asprof -d 30 -f profile.html <PID>
# JFR (built-in since JDK 11)
java -XX:StartFlightRecording=duration=60s,filename=rec.jfr MyApp
jfr print --events CPULoad rec.jfr
# jstack (thread dump)
jstack <PID> > threads.txt
Memory Profiling
Leak Detection Pattern (any language)
1. Take heap snapshot at T0
2. Run suspected operation N times
3. Force GC
4. Take heap snapshot at T1
5. Compare: objects that grew = potential leak
6. Check: are they reachable? From where? (retention path)
Node.js Memory
// Heap snapshot
const v8 = require('v8');
const fs = require('fs');
function takeSnapshot(label) {
const snapshotStream = v8.writeHeapSnapshot();
console.log(`Heap snapshot written to ${snapshotStream}`);
}
// Process memory monitoring
setInterval(() => {
const mem = process.memoryUsage();
console.log({
rss_mb: (mem.rss / 1048576).toFixed(1),
heap_used_mb: (mem.heapUsed / 1048576).toFixed(1),
heap_total_mb: (mem.heapTotal / 1048576).toFixed(1),
external_mb: (mem.external / 1048576).toFixed(1),
});
}, 10000);
Python Memory
# tracemalloc (built-in)
import tracemalloc
tracemalloc.start()
# ... code ...
snapshot = tracemalloc.take_snapshot()
top = snapshot.statistics('lineno')
for stat in top[:10]:
print(stat)
# objgraph (pip install objgraph)
import objgraph
objgraph.show_most_common_types(limit=20)
objgraph.show_growth(limit=10) # Call twice to see what's growing
Flame Graph Interpretation
Reading a flame graph:
âââââââââââââââââââââââââââââââââââââââââââââââ
â main() â â Entry point (bottom)
ââââââââââââââââââââââââŽâââââââââââââââââââââââĪ
â processData() â renderOutput() â â Width = time spent
ââââââââââââŽââââââââââââĪ â
â parseCSV â validate â â â Tall = deep call stack
ââââââââââââĪ â â
â readline â â â â Top = where CPU burns
ââââââââââââīââââââââââââīâââââââââââââââââââââââ
WHAT TO LOOK FOR:
1. Wide plateaus at top â CPU-intensive leaf function (optimize this!)
2. Many thin towers â excessive function calls (batch or reduce)
3. Recursive patterns â potential stack overflow risk
4. Unexpected width â function taking more time than expected
5. GC/runtime frames â memory pressure
ACTION RULES:
- Plateau >20% width â must investigate
- Plateau >40% width â almost certainly the bottleneck
- If top 3 functions = 80% of time â focused optimization will work
- If evenly distributed â architectural change needed
Phase 3: Common Optimization Patterns
Algorithm & Data Structure Optimizations
| Problem | Bad O() | Fix | Good O() | |---------|---------|-----|----------| | Search unsorted array | O(n) | Sort + binary search, or use Set/Map | O(log n) or O(1) | | Nested loop matching | O(nÂē) | Hash map lookup | O(n) | | Repeated string concat | O(nÂē) | StringBuilder/join array | O(n) | | Sorting already-sorted data | O(n log n) | Check if sorted first | O(n) | | Finding duplicates | O(nÂē) | Set-based detection | O(n) | | Frequent min/max of changing data | O(n) per query | Heap/priority queue | O(log n) |
Caching Strategy Decision Matrix
Should you cache this?
âââ Does the same input always produce the same output?
â âââ YES â Cache candidate â
â âââ NO â Can you define a valid TTL?
â âââ YES â Cache with TTL â
â âââ NO â Don't cache â
âââ Is it called frequently?
â âââ <10x/min â Probably not worth caching
â âââ >10x/min â Cache â
âââ Is the source data expensive to compute/fetch?
â âââ <10ms â Probably not worth caching
â âââ >10ms â Cache â
âââ Does staleness cause problems?
âââ Critical (financial, auth) â Short TTL or cache-aside with invalidation
âââ Important (user data) â 1-5 min TTL with invalidation
âââ Tolerant (content, search) â 5-60 min TTL
CACHE LAYERS (use in order):
1. In-process (Map/LRU) â <1Ξs, limited by memory, per-instance
2. Shared cache (Redis/Memcached) â <1ms, shared across instances
3. CDN/edge cache â <10ms, geographic distribution
4. Browser cache â 0ms for user, stale risk
INVALIDATION STRATEGIES:
- TTL-based: simplest, best for read-heavy + staleness-tolerant
- Event-based: publish cache-invalidate on write, best for consistency
- Write-through: update cache on every write, best for write-read patterns
- Cache-aside: app manages cache explicitly, most flexible
Connection Pooling
# Sizing formula
pool_size: min(available_cores * 2 + effective_spindle_count, max_connections / num_instances)
# Rules of thumb:
# - PostgreSQL: connections = cores * 2 + 1 (per pgBouncer docs)
# - MySQL: keep total connections < 150 for most workloads
# - HTTP clients: match to concurrent request volume
# - Redis: usually 5-10 per instance is enough
# Warning signs of pool problems:
# - "connection timeout" errors under load
# - Response time spikes at regular intervals
# - Idle connections holding resources
# - Connection count hitting max_connections
Async & Concurrency Patterns
// BAD: Sequential when independent
const user = await getUser(id);
const orders = await getOrders(id);
const prefs = await getPreferences(id);
// Total: user_time + orders_time + prefs_time
// GOOD: Parallel when independent
const [user, orders, prefs] = await Promise.all([
getUser(id),
getOrders(id),
getPreferences(id),
]);
// Total: max(user_time, orders_time, prefs_time)
// GOOD: Controlled concurrency for many items
// (npm: p-limit, p-map, or manual semaphore)
import pLimit from 'p-limit';
const limit = pLimit(10); // Max 10 concurrent
const results = await Promise.all(
items.map(item => limit(() => processItem(item)))
);
# Python: asyncio for I/O-bound
import asyncio
async def fetch_all(ids):
# Parallel
tasks = [fetch_one(id) for id in ids]
return await asyncio.gather(*tasks)
# Python: ProcessPoolExecutor for CPU-bound
from concurrent.futures import ProcessPoolExecutor
with ProcessPoolExecutor(max_workers=4) as pool:
results = list(pool.map(cpu_intensive_fn, items))
N+1 Query Detection & Fix
SYMPTOM: Response time scales linearly with result count
DETECTION: Enable query logging, count queries per request
# Bad: N+1
users = db.query("SELECT * FROM users LIMIT 100")
for user in users:
orders = db.query(f"SELECT * FROM orders WHERE user_id = {user.id}")
# Result: 1 + 100 = 101 queries
# Fix 1: JOIN
SELECT u.*, o.* FROM users u
LEFT JOIN orders o ON o.user_id = u.id
LIMIT 100
# Fix 2: Batch load (better for large datasets)
users = db.query("SELECT * FROM users LIMIT 100")
user_ids = [u.id for u in users]
orders = db.query(f"SELECT * FROM orders WHERE user_id IN ({','.join(user_ids)})")
#
Truncated for display â read the full file on GitHub.
Related Skills
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu â one CLI, zero API fees.
ruflo
81.9kð The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Claude-Code-Game-Studios
39.7kTurn Claude Code into a full game dev studio â 49 AI agents, 72 workflow skills, and a complete coordination system mirroring real studio hierarchy.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit â see the Safety scan above for what the skill file itself contains.
