| name | performance-forensics |
| description | Read-only measured performance diagnosis for latency, CPU, throughput, I/O, contention, traces, or hillclimbing. Improvement is a Ground or Verify method inside a caller-owned mutation lifecycle. Use memory-profiler for leaks, OOM, or heap fragmentation. |
| license | Complete terms in LICENSE |
Performance Forensics
Use this skill for empirical performance diagnosis and optimization. Performance
engineering requires measurement artifacts instead of speculative code
inspection.
For memory leaks, out-of-memory errors, and heap fragmentation, use
memory-profiler.
Modes of Operation
Select the mode that matches the task trigger:
Diagnosis Workflow (Read-Only Default)
Diagnosis tasks are read-only by default. Do not mutate production code during
diagnosis unless requested.
- Capture evidence. Obtain a CPU profile, trace, or execution log using a
realistic workload.
- Reduce artifacts. Query the profile to identify the dominant bottleneck
or hot call tree.
- Confirm the mechanism. Verify the bottleneck on the running target before
proposing changes.
- Attribute to source. Map the hotspot to the exact file, symbol, and line
number.
- Report findings. Provide the diagnosis, source location, and artifact
paths.
Optimization Workflow
When authorized to mutate code, follow this measurement loop:
- Ground the workload. Define a representative workload matching real input
distributions.
- Establish baseline. Capture baseline metrics and profile artifacts. Save
the artifact path.
- Formulate single hypothesis. Pick a targeted strategy from the eight
strategy families in references/perf-issue.md.
- Apply isolated change. Modify only the code related to the selected
hypothesis.
- Measure post-fix result. Run the identical workload. Compare the new
artifact against baseline.
- Evaluate outcome. Keep confirmed improvements. Restore only experiment
changes owned by this run after regressions or neutral results. Flag
inconclusive measurements.
- Iterate or stop. For sustained optimization, follow the stop rules in
references/hillclimb.md.
Reporting Contract
For diagnosis, return the workload, baseline artifact, source attribution, and
status. For authorized optimization, also return:
- Workload description and parameters.
- Post-fix measurement number and artifact path.
- Net delta percentage or throughput difference.
- Status classification: improvement, regression, or inconclusive.
Attribution
Adapted from upstream pstack performance and forensics playbooks. See
LICENSE.