awb-optimize
Skill2 starsChanged 6 months agoMITView on GitHub
WHAT: make code measurably faster (or lighter) with a disciplined loop — set a baseline, measure to find the real bottleneck, fix the top one, re-measure, and record a before/after table — so a change is kept only when a number says it helped. USE WHEN: a concrete performance goal on real code ("this is too slow", "optimize X", "cut the p95 latency / memory", "speed up the import"), where you can measure before and after. DO NOT TRIGGER: "tidy this up / simplify" with no speed goal (that is a review/simplify skill); a correctness bug (that is a debug skill); micro-tuning with no measurable target or baseline.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- awb-config-guardSkill
- awb-cookSkill
- awb-dead-code-auditSkill
- awb-debugSkill
- awb-external-refSkill
- awb-handoverSkill
- awb-install-and-verifySkill
- awb-lessons-captureSkill
- awb-output-guardSkill
- awb-plan-then-codeSkill
- awb-researchSkill
- awb-reviewSkill
- awb-session-closeSkill
- awb-stress-testSkill
- awb-tddSkill
- awb-uninstallSkill
- awb-using-skillsSkill
- awb-verify-docsSkill
- prompt-refinerSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
If you can't state the goal as a number ("p95 under 200 ms", "peak RSS under 400 MB"), stop and define that first — optimization without a …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Optimize (measure-driven)
Announce on activation: "Using awb-optimize — baseline first, then measure → fix → verify."
If you can't state the goal as a number ("p95 under 200 ms", "peak RSS under 400 MB"), stop and define that first — optimization without a metric is guessing.
Scope
- Does: drive a measure → fix-one → re-measure loop and force a before/after record.
- Does NOT: ship a profiler (use
cProfile/perf/timeit/ your bench harness), guarantee a speedup, or pick the target for you. The thresholds here are per-app, per-workload heuristics.
Process
- HARD GATE: baseline before any change. Record the current number on representative data, with the exact command. No baseline → you can't tell improvement from noise. Run it 2–3×; if it swings wildly, your measurement is too noisy to act on — fix that first.
- Measure where the time goes. Profile and rank the hotspots by actual cost. Intuition about "the slow part" is wrong often enough to waste the effort.
- Fix the single biggest one. One change per loop, so the next measurement attributes the delta.
- Re-measure, keep or revert. Same command. If it didn't beat the baseline past the noise,
revert it (
git checkout) — a change that doesn't move the number is just complexity. If it helped, that's the new baseline; loop. Record a before/after table on every shipped win, so it's legible and reversible:
Metric Before After How measured p95 latency 480 ms 190 ms python -m bench api --n 1000
See docs/patterns/optimization-loop.md for the
underlying pattern.
Banned behaviors
- No fix without a baseline — you can't prove it helped.
- No "while I'm here" rewrite — optimizing isn't a licence to refactor untouched code.
- No micro-optimization the profiler didn't point to — it trades readability for noise.
- No keeping a change that didn't beat the noise — revert it.
- No code-read passed off as a measurement — reading the source can predict where the time goes, but it cannot produce a latency or memory number. If you have no baseline run, label every figure predicted (not measured) and say which run would confirm it — never present an estimate as a result.
Honesty / limits
This skill ships no measurement engine and guarantees no speedup — it enforces discipline around whatever profiler you use. Numbers are only as good as the input: optimizing against unrepresentative data can make production slower. "It feels faster" is not a metric — and neither is a number you reasoned out from reading the code: a static read predicts, only a run measures.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

