PromptScan: pass
Performance check
Claude Code slash command (.claude/commands/perf-check.md). Measures a given command three times, profiles it with the stack's native profiler, and reports ranked hotspots with evidence-backed recommendations.
Add a trust badge to your README
[](https://waxmark.app/items/perf-check/scan)
---
description: Baseline, profile, and report hotspots for a slow command, test, endpoint, or script
argument-hint: <command to measure, quoted> [what "fast enough" means, e.g. "<2s">
allowed-tools: Read, Grep, Glob, Bash
---
Performance check. Command under test: $0
Target, if given: $1
Project stack hints:
!`ls package.json pyproject.toml Cargo.toml go.mod pom.xml build.gradle 2>/dev/null || true`
Procedure - measure, change nothing, report:
1. Confirm the command runs and produces the expected result once. If it needs a fixture or input, construct a repeatable one and state it.
2. Baseline: run it 3 times with timing (`/usr/bin/time -v`, `hyperfine` if installed, or the runner's own timing flags). Report min / median / max. If spread exceeds 20%, run 3 more and report again.
3. Profile with the stack's native tool, chosen from the hints above:
- Node: `node --cpu-prof` (then summarize the .cpuprofile top frames), `--heap-prof` if memory is the complaint.
- Python: `python -m cProfile -o /tmp/prof.out ...` then `python -c "import pstats; pstats.Stats('/tmp/prof.out').sort_stats('cumulative').print_stats(25)"`; `py-spy` if installed.
- Go: `go test -bench . -cpuprofile cpu.out` and `go tool pprof -top cpu.out`.
- Rust: `cargo build --release` first; `cargo flamegraph` or `perf` if available; `criterion` benches if present.
- JVM: JFR (`-XX:StartFlightRecording`) or `async-profiler` if installed.
- SQL inside the path: capture the slow query and run the engine's EXPLAIN ANALYZE.
- Test suites and builds: the runner's duration reporter (`--durations=20`, `--reporter verbose`, `turbo --summarize`).
4. Read the profile top-down. List the top 5 frames in project code with self or inclusive time share and a one-phrase cause: algorithmic, I/O wait, allocation, lock, N+1, repeated work.
5. Rank recommendations by expected gain over risk, each with a number from the profile behind it. Typical order: avoid the work (cache, early exit), batch I/O, fix the algorithm, reduce allocations, parallelize.
6. Do not apply fixes. Offer to apply the top one and re-measure if the user wants.
Output:
## Perf check: `$0`
Baseline: min/median/max = a/b/c (n=3) | Target: <value or none>
### Hotspots
| # | Location | Share | Cause |
### Recommendations
1. <fix> - expected <X% or Y ms> - risk <low/med/high> - evidence: <frame or query>
### Not investigated
Profile artifacts: <paths>