Identifies performance bottlenecks and recommends optimization strategies.
Diagnose and fix performance problems from measurement, never from guessing. This
skill is the reasoning layer; the deterministic scan lives in the /forge:optimize
command and the performance agent.
Measure → find the real bottleneck → fix that one thing → re-measure. Repeat.
Premature optimization wastes effort on code that isn't hot. A profile that shows where time/memory/allocations actually go beats any intuition. Optimize the top item, prove the delta, then re-profile — the bottleneck usually moves.
| Surface | What it does | When |
|---|---|---|
| /forge:optimize (command) | Deterministic 7-dimension static scan (large files, as any, dead exports, deps, dup, console, TODO debt) + optional --fix | Codebase-health sweep, refactor triage |
| performance agent (agents/performance.md) | Bundle analysis, React render profiling, memory-leak hunting, API latency | Deep dive on a specific slow surface |
| This skill | The measure-first method + fix patterns both of the above apply | Any "it's slow" reasoning |
/forge:optimize is a TypeScript-oriented static-quality scan — it does not run a
profiler. For actual runtime numbers you still profile (browser DevTools, cargo flamegraph, node --prof, EXPLAIN ANALYZE). Read reference/patterns.md for the
full per-domain fix catalog; keep this file for triage.
Before touching code, put the symptom in one bucket — the fix set is different for each.
Quick discriminator: if CPU is pegged → CPU-bound; if wall-time ≫ CPU-time → I/O-bound; if it degrades over hours/requests → memory leak.
/api/tasks call; main thread idle during it. → I/O-bound, not render./api/tasks fires one query per task (N+1): 1 list +
240 detail queries.Note how the bottleneck moved after each fix. Stopping after step 3 and "also" adding a Redis cache would have optimized the wrong layer.
npx vite-bundle-visualizer (or source-map-explorer dist-ui/*.js).
Observe one dependency is 60% of the bundle.React.lazy / dynamic import()), or
swap for a lighter lib; tree-shake by importing the used export only.npm test.Deep catalog with concrete code lives in reference/patterns.md:
requestAnimationFrame/forge:optimize grep-excludes any path containing the substring test (grep -v test). A file named contest.ts or a dir like latest/ is silently dropped from
the type-safety / console / dead-code counts. Don't treat its "0 console statements"
as proof — spot-check.*.ts, not *.tsx. In forge-ui (React 19)
the biggest files are .tsx and won't appear in the >300-line list. Re-run the find
with -name "*.tsx" for the UI repo.src/, runs npm outdated,
depcheck. It says nothing about forge-orchestrator (Rust) — there you profile with
cargo flamegraph, size-optimize via the release profile (opt-level=z, LTO,
stripped, already set in that repo's Cargo.toml), not depcheck.--fix writes files. The command runs analysis read-only and presents a plan
first; never let it auto-apply on an unstaged tree you can't git diff to review.commands/optimize.md — the deterministic 7-dimension scan and its --fix flow.agents/performance.md — the profiling/bundle/leak specialist agent.Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer