engineering / Build & debug
performance-engineer
Measure, diagnose, and improve software performance on a specific critical path.
Put it to work.
Ask your agent to use performance-engineer, or let it load the skill when your task matches the description.
Use the performance-engineer skill <performance-target-or-critical-path>Invocation syntax varies by agent. Use the skill name in your prompt, or your agent’s supported slash command.
About this skill
Measure, diagnose, and improve software performance on a specific critical path. The skill keeps performance work evidence-backed: baseline first, smallest useful change, repeatable after measurement, and behavior checks.
Use it for startup time, page load, API latency, p95/p99, database query count, frontend rendering, memory/CPU, import or bundle cost, batch jobs, file processing, and algorithmic hotspots.
Flow
flowchart LR
A[Target path] --> B[Baseline]
B --> C[Critical path]
C --> D[Hypothesis]
D --> E[Small patch]
E --> F[Correctness checks]
F --> G[Re-measure]
G --> H[Report]Install
Via the smeltery skills CLI flow:
npx skills@latest add smeltery/skillsOr copy just this skill:
mkdir -p ~/.claude/skills/performance-engineer
curl -fsSL https://raw.githubusercontent.com/smeltery/skills/main/skills/engineering/performance-engineer/SKILL.md \
-o ~/.claude/skills/performance-engineer/SKILL.mdUsage
/performance-engineer Reduce p95 latency on GET /api/search
/performance-engineer Speed up CLI startup time
/performance-engineer Find why this React table drops framesRequirements
- A specific path or workload to measure.
- Local test/build tools for the target repository.
- Profilers, logs, browser tooling, or benchmark commands appropriate to the stack.
Files
SKILL.md— canonical skill definition consumed by the agent.
Read the full SKILL.md
Performance Engineer
Do not optimize vague code. Optimize a measured critical path.
Start by identifying what the user or system is waiting for, capture a before number, attribute the cost to a cause, make the smallest useful change, then verify the after number and behavior.
Keep the loop bounded by the user's target, available tooling, correctness, and explicit stop conditions. Do not run open-ended optimization passes.
Workflow
- Define the target:
- Name the path: startup, first useful render, search, checkout, API response, import completion, background job throughput, file processing, or another concrete wait.
- Pick the metric: wall time, p95/p99 latency, TTFB, interaction latency, frame time, query count, CPU, RSS, allocations, bundle size, or throughput.
- Separate cold, warm, dev, production, small input, large input, and realistic input.
- Establish the baseline:
- Look for existing benchmarks, profiler traces, logs, performance tests, or telemetry first.
- If none exist, create a lightweight repeatable measurement before editing.
- Run multiple samples when timing is noisy. Prefer median plus p95 or min/median/max over a single best run.
- Map the critical path:
- Trace what happens before the target is reached.
- Identify hot-path work versus work that can happen later, once, in parallel, or not at all.
- Inspect imports, initialization, render paths, request handlers, DB/API loops, cache boundaries, and large data transformations.
- Include deployment/runtime settings when they can dominate the metric: worker counts, connection pools, queue depth, container limits, autoscaling, storage, network, GPU/runtime settings, and build mode.
- Classify the waste:
- Too early: heavy work happens before it is needed.
- Too often: repeated work can be reused, memoized, indexed, or batched.
- Too much: more data, modules, DOM, records, or files are loaded than needed.
- Too serial: independent work runs sequentially.
- Wrong shape: the data structure or query shape forces repeated scans.
- N+1: each item triggers one DB/API request.
- Render churn: UI recomputes or rerenders without a user-visible need.
- Cache hazard: cache scope, keys, invalidation, or permissions are unsafe.
- Rank by impact and risk:
- Prefer high-impact, low-risk changes first: lazy loading, batching, obvious indexing, duplicate-work removal, parallel independent calls, and narrower data selection.
- Treat rewrites, cross-cutting caches, and semantic algorithm changes as higher risk and require stronger tests.
- Scanner output and hunches are leads, not proof.
- Patch conservatively:
- Preserve behavior, public APIs, output ordering, permissions, pagination, timezone handling, error behavior, and side effects unless the user explicitly asks otherwise.
- Keep edits localized to the measured path and its helpers.
- Add comments only where a performance choice would otherwise look accidental.
- Verify:
- Run focused correctness tests first, then the broadest relevant local quality gate available.
- Repeat the same measurement under comparable conditions.
- Report before, after, improvement formula, tests, and residual risk.
- Stop deliberately:
- Stop when the target is met, further samples are inconsistent, gains are too small for the added risk, or the remaining bottleneck needs a product, architecture, infrastructure, permission, or budget decision outside scope.
- Preserve negative results in the handoff so future runs do not repeat the same experiment.
Common Moves
- Move heavy imports, initialization, config loading, network setup, or native bindings behind the branch or command that needs them.
- Replace repeated linear lookups with maps, sets, indexes, grouping, or precomputation when key equality is stable.
- Batch DB/API calls while preserving tenant filters, permissions, soft deletes, sorting, pagination, and error handling.
- Parallelize independent operations while keeping dependency order explicit.
- Select fewer fields, paginate, stream, virtualize, chunk work, or stop after enough results are found.
- Reduce render churn with stable props, memoized derived data, narrower state, virtualization, and moving expensive computation out of render.
- Add caches only when invalidation, user scope, permission boundaries, and memory bounds are clear.
Guardrails
- Never claim a performance win without before/after evidence.
- Do not trade correctness, security, accessibility, observability, or maintainability for a small speedup.
- Do not add broad caches around user-specific or permission-sensitive data unless the cache key and invalidation are proven.
- Do not deduplicate records by display names or unstable labels.
- Do not casually change ordering, pagination, timezone handling, floating-point behavior, or mutation side effects.
- If measurement cannot be run, explain what blocked it and provide the exact command or method that should be used.
Output
For analysis-only requests, return findings ranked by likely impact:
- Target and baseline, if available.
- Top bottlenecks with file references.
- Evidence for each bottleneck.
- Recommended fix.
- Expected impact and risk.
- How to verify.
For implementation requests, return:
- What changed.
- Before/after metrics, if measured.
- Tests and checks run.
- Residual risk or missing measurement.
When reporting measurements, include the workload, environment, sample count, warm-up policy, baseline, optimized value, absolute delta, percentage change, evidence source, and trade-off. For lower-is-better metrics:
reduction % = (baseline - optimized) / baseline * 100For higher-is-better metrics:
increase % = (optimized - baseline) / baseline * 100