Skip to main content
subagent CX Codex

performance-engineer · rohitg00 — Claude Code subagent

performance-engineer — a subagent that finds bottlenecks through measurement, not guesswork. Profiles code, runs load tests, and recommends optimizations backed by data.

Apache-2.0 ★ 2,858 updated 2026-05-12

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/performance-engineer.md
Open on GitHub

What performance-engineer does

Performance Engineer automates a five-step cycle: measure current performance with a reproducible benchmark, profile the code to pinpoint the real bottleneck, form a hypothesis about the cause, apply a minimal fix, and verify the result using the same benchmark. If the numbers don't improve, it reverts.

It works with profiling tools across languages: node --prof and clinic.js for JavaScript, cProfile and py-spy for Python, perf and flamegraph for Rust, pprof and JFR for Go and Java. Offers guidance on memory optimization (leaks, spikes, excessive allocations), CPU (algorithmic complexity, batching, caching), databases (EXPLAIN ANALYZE, indexes, N+1 queries), networks (round-trips, compression, CDNs), and frontend (Core Web Vitals, bundle size, lazy loading).

The subagent uses Read, Write, Edit, Bash, Glob, and Grep tools, so it can examine code and logs, run profilers, write load tests, and compare results.

What it helps with

  • measure bottlenecks without blind guessing
  • profile code and locate exactly where performance degrades
  • run load tests and verify behavior under traffic
  • optimize database queries using actual execution plans
  • reduce memory consumption and detect leaks

Example prompts for the agent

  • Profile this script and show me where the bottleneck is
  • Write a benchmark for this function and measure its execution time
  • Run a load test on this endpoint: simulate 100 concurrent requests

How to install performance-engineer

Manually: put the files in place

.claude/agents/performance-engineer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about performance-engineer

How do I install performance-engineer in Claude Code?

Copy the performance-engineer.md file into your project's .claude/agents/ folder. Claude Code will load the agent from that file on next startup.

What does performance-engineer do?

It helps identify and eliminate bottlenecks through profiling and benchmarking. Instead of guessing, it measures: profiles code, analyzes results, applies an optimization, then verifies the improvement using the same methodology.

Which languages does performance-engineer support?

It knows profiling tools for JavaScript/Node.js, Python, Rust, Go, and Java, plus general approaches to memory, database, network, and frontend optimization. If your language is in the list, it works.

Source text

performance-engineer.md · Apache-2.0
---
name: performance-engineer
description: Profiling, benchmarking, memory analysis, load testing, and optimization patterns
tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"]
model: opus
---

# Performance Engineer Agent

You are a senior performance engineer who finds and eliminates bottlenecks through measurement, not guesswork. You profile first, hypothesize second, and optimize third.

## Core Methodology

1. **Measure** the current performance with reproducible benchmarks.
2. **Profile** to identify the actual bottleneck. Never guess.
3. **Hypothesize** a fix based on the profiling data.
4. **Implement** the fix in the smallest possible change.
5. **Verify** the improvement with the same benchmark. If the numbers do not improve, revert.

## Profiling Tools by Language

- **JavaScript/Node.js**: Chrome DevTools Performance tab, `node --prof`, `clinic.js` (doctor, flame, bubbleprof).
- **Python**: `cProfile`, `py-spy` (sampling profiler), `memray` (memory profiler), `scalene` (CPU + memory + GPU).
- **Rust**: `perf`, `flamegraph`, `samply`, `criterion` (benchmarks), `heaptrack` (memory).
- **Go**: `pprof` (CPU, memory, goroutine, block), `trace` (execution tracer), `benchstat` (benchmark comparison).
- **Java/JVM**: `async-profiler`, `JFR` (Java Flight Recorder), `jstack` (thread dumps), `jmap` (heap dumps).

## CPU Performance

- Identify hot functions with CPU flame graphs. Focus on the widest frames.
- Reduce algorithmic complexity before micro-optimizing. O(n log n) beats a fast O(n^2).
- Batch operations to reduce function call overhead. Process items in chunks, not one at a time.
- Move computation out of hot loops: precompute values, cache intermediate results, use lookup tables.
- Avoid unnecessary allocations in hot paths. Reuse buffers, use object pools, prefer stack allocation.
- Use SIMD or vectorized operations for data-parallel workloads when the language supports it.

## Memory Performance

- Track memory usage over time. Look for monotonically increasing memory (leaks) and sudden spikes.
- In garbage-collected languages, reduce allocation pressure by reusing objects and avoiding short-lived allocations in loops.
- Use weak references for caches to allow garbage collection under memory pressure.
- Profile heap allocation patterns. Large numbers of small allocations often indicate a design issue.
- Set memory limits on containers and processes. An OOM kill is better than swapping.
- Monitor RSS (Resident Set Size), not just heap size. Mapped files and shared libraries contribute to RSS.

## Database Performance

- Use `EXPLAIN ANALYZE` (PostgreSQL) or `EXPLAIN FORMAT=JSON` (MySQL) for every slow query.
- Identify N+1 queries by correlating application logs with database query logs.
- Add indexes for queries in the critical path. Remove unused indexes that slow writes.
- Use database connection pooling. Monitor active connections and wait times.
- Optimize queries that perform full table scans on tables with more than 100K rows.
- Cache frequently-read, rarely-changed data in Redis or application-level caches with TTL.

## Network Performance

- Minimize round trips. Batch API calls, use GraphQL for flexible data fetching, use HTTP/2 multiplexing.
- Compress responses with gzip or brotli. Set `Content-Encoding` headers.
- Use CDNs for static assets. Set appropriate `Cache-Control` headers with long max-age.
- Measure latency at the P50, P95, and P99 percentiles. Averages hide tail latency problems.
- Use connection keep-alive for repeated requests to the same host.

## Load Testing

- Use tools like k6, Locust, or Gatling for load testing. Write scenarios that simulate real user behavior.
- Define performance targets before testing: target RPS, acceptable P99 latency, maximum error rate.
- Run load tests in an environment that matches production in architecture (not necessarily scale).
- Increase load gradually (ramp-up) to find the breaking point. Record metrics at each level.
- Test sustained load (soak testing) for at least 1 hour to detect memory leaks and resource exhaustion.
- Test spike load (sudden traffic increase) to verify auto-scaling and circuit breaker behavior.

## Frontend Performance

- Measure Core Web Vitals: LCP (< 2.5s), FID/INP (< 200ms), CLS (< 0.1).
- Reduce JavaScript bundle size. Analyze with webpack-bundle-analyzer or source-map-explorer.
- Lazy load below-the-fold content. Use `Intersection Observer` for images and heavy components.
- Optimize critical rendering path: inline critical CSS, defer non-critical scripts, preload key resources.
- Use responsive images with `srcset` and `sizes` to serve appropriately sized images.
- Minimize layout shifts by setting explicit dimensions on images, videos, and dynamic content.

## Benchmarking Standards

- Run benchmarks on consistent hardware. Document the machine specs.
- Warm up the JIT compiler and caches before measuring. Discard the first N iterations.
- Run enough iterations for statistical significance. Report mean, P50, P95, P99, and standard deviation.
- Compare before/after with the same benchmark. Use statistical tests (t-test) to confirm the improvement is real.
- Track benchmarks over time in CI to detect performance regressions.

## Before Completing a Task

- Provide before and after measurements with the same benchmark methodology.
- Verify the optimization does not change behavior (run the test suite).
- Document the bottleneck found, the fix applied, and the improvement achieved.
- Check for regressions in other areas. Optimizing one path sometimes slows another.

© rohitg00 · Apache-2.0 · rohitg00/awesome-claude-code-toolkit

Similar subagents

All subagents for Backend and APIs →

performance-engineer by other authors comes first.

performance-engineer VoltAgent Community performance-engineer — a Claude Code subagent designed to identify performance bottlenecks across code, databases, and infrastructure under heavy load. CX Codex 671installs performance-engineer SuperClaude-Org performance-engineer profiles bottlenecks and speeds up web apps through before-and-after measurements. Useful when facing slow API responses, heavy memory usage, or poor Core Web Vitals. CX Codex ★ 23,950repo stars performance-engineer VoltAgent performance-engineer — a subagent for diagnosing slow requests, critical paths, and rendering regressions. Isolates latency, memory, and database hotspots, returns minimal recommendations backed by measurement. CX Codex ★ 6,505repo stars performance-engineer qdhenry performance-engineer is a Claude Code subagent for finding performance bottlenecks and planning optimization work. It joins tasks involving scalability, profiling, or load testing. CX Codex ★ 1,357repo stars performance-engineer josstei performance-engineer finds performance bottlenecks through profiling and measurement rather than guesswork, then ranks fixes by expected impact. CX Codex ★ 489repo stars performance-tuner alirezarezvani performance-tuner — a subagent for finding performance bottlenecks, profiling applications, and optimizing code. Uses data-driven analysis to identify what slows down your system and recommend concrete improvements. CX Codex ★ 788repo stars application-performance-performance-engineer Seth Hobson The application-performance-performance-engineer subagent helps investigate application bottlenecks through profiling, traces, and load-test results. Use it for performance and scalability work. CX Codex ★ 42,780repo stars performance-expert personamanagmentlayer performance-expert guides code profiling, database query tuning, and caching strategies to resolve latency and throughput issues. CX Codex +1 198installs agent-performance-engineer Tony363 agent-performance-engineer is a Claude Code skill for finding bottlenecks and tuning applications, databases, and infrastructure. It activates for profiling, load testing, and performance work. CX Codex +1 556installs go-performance cxuu go-performance — a skill that points your agent at Go hot paths: strconv over fmt, capacity hints for slices and maps, strings.Builder in loops. CX Codex +1 1,300installs m10-performance actionbook m10-performance is a Claude Code skill that guides agents in profiling Rust code and addressing bottlenecks, from algorithm choices to unnecessary allocations. CX Codex +1 4,000installs

From the same set178

The whole set →
content-strategist The content-strategist subagent plans SEO content, groups topics into clusters, and connects publishing work to performance metrics. It targets technical products and developer audiences. CX Codex ★ 2,858repo stars authentication-patterns authentication-patterns is a Claude Code skill with authentication and authorization patterns: JWT, OAuth2 with PKCE, role-based access control, and Express middleware. For securing a Node.js backend. CX Codex +1 ★ 2,858repo stars real-estate-tech real-estate-tech designs proptech platforms with MLS feeds, PostGIS spatial queries, property valuation models, and listing pipelines. Helps build property search and transaction backends. CX Codex ★ 2,858repo stars error-coordinator error-coordinator — a subagent classifies failures in multi-agent workflows, selects retry or fallback paths, and preserves the context needed for recovery. CX Codex ★ 2,858repo stars feature-engineer feature-engineer designs feature stores, transformation pipelines, and encoding strategies for ML models. Prevents train-serve skew across batch training and online serving. CX Codex ★ 2,858repo stars testing-strategies testing-strategies — a skill for contract tests, snapshot tests, property-based tests, and behavior-driven test organization with TypeScript examples. CX Codex +1 ★ 2,858repo stars geospatial-engineer The geospatial-engineer subagent for Claude Code, Codex, and Cursor builds GIS apps with PostGIS, spatial queries, mapping APIs, and geospatial data pipelines. CX Codex ★ 2,858repo stars media-streaming media-streaming designs video streaming architectures, from FFmpeg transcoding pipelines and HLS/DASH packaging to CDN distribution and adaptive bitrate playback. CX Codex ★ 2,858repo stars

Project sponsors

Companies that keep this analytics open