Performance Optimizer
Measure first, optimize second, verify always.
Grok Build Mode
- Use Plan Mode before broad rewrites or caching changes.
- Use subagents for parallel investigation:
backend: endpoints, CPU, IO, concurrency.
database: query shape, indexes, N+1, transactions.
frontend: bundle, render loops, hydration, assets.
infra: deploy, network, cache, limits.
- Arena-style optimization: compare approaches by measured impact, risk, and complexity.
- Human-in-the-loop: get approval before changing data model, cache semantics, or infra settings.
Workflow
- Define the metric and baseline.
- Reproduce or inspect evidence.
- Find the bottleneck with the least invasive tool available.
- Propose 2-3 fixes with tradeoffs.
- Implement the smallest fix.
- Re-measure or run a focused benchmark/test.
- Document the before/after.
Rules
- Do not optimize without a metric.
- Avoid caching correctness bugs.
- Prefer algorithm/query fixes over hardware assumptions.
- Keep performance tests stable and bounded.
- Watch for memory and bundle-size regressions.
Example Prompts
Use performance-optimizer. Investigate this p99 regression with subagents for backend, database, frontend, and infra. No edits until evidence is summarized.
Find the smallest measurable frontend performance win and verify it with a before/after check.
1---2name: performance-optimizer3description: Use for slow endpoints, p95/p99 latency, database query issues, frontend bundle/render performance, memory leaks, caching, profiling, or performance regressions.4---56# Performance Optimizer78Measure first, optimize second, verify always.910## Grok Build Mode1112- Use Plan Mode before broad rewrites or caching changes.13- Use subagents for parallel investigation:14 - `backend`: endpoints, CPU, IO, concurrency.15 - `database`: query shape, indexes, N+1, transactions.16 - `frontend`: bundle, render loops, hydration, assets.17 - `infra`: deploy, network, cache, limits.18- Arena-style optimization: compare approaches by measured impact, risk, and complexity.19- Human-in-the-loop: get approval before changing data model, cache semantics, or infra settings.2021## Workflow22231. Define the metric and baseline.242. Reproduce or inspect evidence.253. Find the bottleneck with the least invasive tool available.264. Propose 2-3 fixes with tradeoffs.275. Implement the smallest fix.286. Re-measure or run a focused benchmark/test.297. Document the before/after.3031## Rules3233- Do not optimize without a metric.34- Avoid caching correctness bugs.35- Prefer algorithm/query fixes over hardware assumptions.36- Keep performance tests stable and bounded.37- Watch for memory and bundle-size regressions.3839## Example Prompts4041```text42Use performance-optimizer. Investigate this p99 regression with subagents for backend, database, frontend, and infra. No edits until evidence is summarized.43```4445```text46Find the smallest measurable frontend performance win and verify it with a before/after check.47```