with one click
performance-audit
Systematic performance audit with profiling and benchmarks
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Systematic performance audit with profiling and benchmarks
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | performance-audit |
| description | Systematic performance audit with profiling and benchmarks |
| allowed-tools | Read, Write, Bash, Glob, Grep |
Structured workflow for conducting a systematic performance audit of the application. Identifies bottlenecks, measures baselines, and produces actionable recommendations.
Run profiling tools to identify hot paths and allocation sites.
Go:
# CPU profile
go test -bench=. -cpuprofile=cpu.prof -benchtime=30s ./...
go tool pprof -http=:8080 cpu.prof
# Memory profile
go test -bench=. -memprofile=mem.prof -benchmem ./...
go tool pprof -http=:8080 mem.prof
# Goroutine profile (for concurrency issues)
curl http://localhost:8080/debug/pprof/goroutine?debug=2
Node.js:
# CPU profile
node --cpu-prof --cpu-prof-dir=./profiles app.js
# Then: chrome://inspect -> Open dedicated DevTools for Node
# Memory
node --heap-prof --heap-prof-dir=./profiles app.js
Frontend (Chrome DevTools):
Capture:
From profiling data, identify:
| Category | What to Find |
|---|---|
| CPU hot paths | Functions consuming >5% of total CPU |
| Memory allocations | Functions with >1000 allocs/op or >1MB/op |
| GC pressure | Allocation rate causing frequent GC pauses |
| Contention | Lock contention in concurrent code |
| I/O bottlenecks | Functions blocked on network/disk I/O |
For each finding, document:
Use HTTP load testing tools to measure endpoint performance:
# Quick benchmark with hey
hey -n 10000 -c 50 -H "Authorization: Bearer $TOKEN" \
http://localhost:8080/api/v1/users
# Detailed benchmark with wrk
wrk -t4 -c100 -d30s -s scripts/post-user.lua \
http://localhost:8080/api/v1/users
# Multi-tenant load simulation with k6
k6 run --vus 100 --duration 60s scripts/multi-tenant-load.js
Record for each endpoint:
Compare against performance budgets from .claude/rules/performance.md:
| Endpoint Type | p50 Target | p99 Target |
|---|---|---|
| Simple CRUD read | <10ms | <100ms |
| Simple CRUD write | <20ms | <250ms |
| List with pagination | <50ms | <500ms |
Identify slow queries and missing indexes:
-- Find slow queries (if pg_stat_statements enabled)
SELECT query, calls, mean_exec_time, total_exec_time
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 20;
-- Analyze specific queries
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT ...;
Check for:
For each slow query:
Search the codebase for N+1 patterns:
# Look for database queries inside loops
# Go: QueryRow/Query inside for/range loops
# TypeScript: await inside for/map loops
Search for tables missing foreign key indexes:
-- Find foreign keys without indexes
SELECT
tc.table_name, kcu.column_name
FROM information_schema.table_constraints tc
JOIN information_schema.key_column_usage kcu
ON tc.constraint_name = kcu.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY'
AND NOT EXISTS (
SELECT 1 FROM pg_indexes
WHERE tablename = tc.table_name
AND indexdef LIKE '%' || kcu.column_name || '%'
);
Test for noisy neighbor effects:
Test scenarios:
Document:
Produce a comprehensive performance report:
## Performance Audit Report
### Date: YYYY-MM-DD
### Scope: [What was audited]
### Environment: [Hardware, software versions, data volumes]
### Executive Summary
[2-3 sentence overview of findings and key recommendations]
### Critical Findings (Fix immediately)
| Finding | Current | Target | Impact | Effort |
|---------|---------|--------|--------|--------|
| ... | ... | ... | High/Medium/Low | Small/Medium/Large |
### Performance Baselines
| Endpoint | p50 | p95 | p99 | Throughput | Status |
|----------|-----|-----|-----|-----------|--------|
| GET /users | Xms | Xms | Xms | X/s | OK/WARN/FAIL |
### Database Analysis
| Query | Avg Time | Calls/min | Fix |
|-------|----------|-----------|-----|
| ... | Xms | N | Add index on X |
### Tenant Isolation
| Metric | Baseline | Under Load | Degradation |
|--------|----------|-----------|-------------|
| Tenant A p99 | Xms | Xms | X% |
### Recommendations (Prioritized)
1. [Highest impact, lowest effort first]
2. ...
### Benchmark Regression Tests Added
[List of new benchmark tests to prevent regressions]
Write the report to docs/spec/.llm/plans/performance-audit-YYYY-MM-DD.md.
Create Architecture Decision Record
Design API contracts with OpenAPI specifications
Assess architecture decisions tradeoffs and edge cases
Design database schemas with migrations and repository interfaces
Break requests into parallel tasks for team execution
Audit dependencies for vulnerabilities and plan upgrades