From fable5-methodology
Make code measurably faster or leaner without breaking it: define a target, measure a baseline, profile to find the actual bottleneck, apply optimizations in order of leverage, and re-verify correctness.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fable5-methodology:performance-optimizationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Optimization without measurement is guessing with extra steps. Intuition about bottlenecks is
Optimization without measurement is guessing with extra steps. Intuition about bottlenecks is wrong often enough that acting on it unmeasured wastes the time it was meant to save. The number rules everything: define it, baseline it, move it, prove it.
/search under 300 ms at 50 rps", "import of the
1M-row file under 2 min", "RSS under 512 MB". No target = no definition of done = optimization
that never ends. If the user gave none, propose one and get a nod.Measure the current number, three runs (warm), record median and spread in your notes. Every later claim of improvement is relative to this recorded baseline — "feels faster" is not a result.
Use the stack's profiler, not code reading:
cargo flamegraph / perf; --release always — debug-build numbers are fiction.node --prof or 0x/clinic flame; console.time brackets for coarse cuts.py-spy record (no code change) or cProfile + snakeviz.EXPLAIN (ANALYZE, BUFFERS) on the real query with real data volume.Read the profile for the top consumer. Rule: no optimization is applied to code the profile didn't indict. If the profile surprises you (it usually does), that surprise just saved you a week of optimizing the wrong thing.
Try each level; only descend when the level above is exhausted for the indicted hotspot:
--release.For EACH optimization: apply it alone → re-run the metric → re-run the correctness suite. Keep a running table in your notes:
| Change | p95 before | p95 after | Tests |
|---|---|---|---|
Add index on orders(user_id, created_at) | 1400 ms | 310 ms | green |
| Batch the price lookups | 310 ms | 180 ms | green |
A change that doesn't move the number gets REVERTED, even if it "should" help — dead optimizations are complexity with no dividend. A change that breaks a test is a bug, not a trade-off, unless the user explicitly accepts the trade.
When the target from Step 1 is met: stop. Further optimization is scope creep with a performance costume. Report the table, the final number vs. target, and any identified-but- unneeded next levers ("materialized view would take it to ~80 ms if ever needed").
"The dashboard takes 8 s to load; get it under 2 s."
The target metric from Step 1 is met and demonstrated by recorded before/after measurements on the realistic workload; every applied change is in the table with its own measured delta; the full correctness suite is green after the final state; ineffective changes were reverted; and no code the profiler didn't indict was "optimized".
npx claudepluginhub unpaidattention/fable5-methodology --plugin fable5-methodologyProfiles and optimizes performance with a mandatory baseline-first gate. Use when something is slow or you need to hit a latency/throughput target.
Systematic performance profiling and optimization. Use when performance issues are reported or suspected. Measure first, optimize second. Applies Pareto principle — find the 20% of code causing 80% of slowness, fix that, not the rest.
Enforces a three-step optimization protocol: measure baseline, identify binding constraint, check premature optimization. For making code faster, cheaper, or smaller.