benchmark-optimization-loop
Skill10 starsChanged 4 months agoMITView on GitHub
Use when a goal is vague speed (\"make it faster\", \"reduce p95\", \"cut query time\") and you need a bounded, measured loop that promotes only verified, correctness-preserving wins instead of guessed micro-tweaks.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- MortuisVMain/ai-agent-superpowerstheir own version, first seen Sep 15, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
- thanvish21/hcc-bundletheir own version, first seen Jul 25, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- templetongroup/radiant★ 113same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- MortuisVMain/ai-agent-superpowers★ 0same name
- thanvish21/hcc-bundle★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository62 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- analyze-problemSkill
- api-reviewSkill
- article-writingSkill
- assignment-compliance-checkSkill
- automation-audit-opsSkill
- autonomous-loopsSkill
- benchmarkSkill
- blueprintSkill
- class-refactoringSkill
- cleanup-local-branchesSkill
- codebase-simplification-auditSkill
- code-review-bugsnagSkill
- code-review-githubSkill
- code-review-jiraSkill
- code-reviewSkill
- composer-updateSkill
- create-issues-from-textSkill
- create-issueSkill
- create-missing-tests-in-prSkill
- create-testSkill
- design-systemSkill
- docker-patternsSkill
- e2e-testingSkill
- frontend-a11ySkill
- frontend-design-directionSkill
- frontend-patternsSkill
- frontend-slidesSkill
- git-workflowSkill
- laravel-authorization-reviewSkill
- laravel-securitySkill
- laravel-telescopeSkill
- latency-critical-systemsSkill
- merge-github-prSkill
- mysql-patternsSkill
- mysql-problem-solverSkill
- penetration-testerSkill
- postgres-patternsSkill
- prepare-issue-contextSkill
- process-code-reviewSkill
- product-capabilitySkill
- production-auditSkill
- pr-staged-merge-planSkill
- pr-summarySkill
- record-project-memorySkill
- redis-patternsSkill
- refactor-entry-point-to-actionSkill
- refresh-claude-mdSkill
- resolve-issueSkill
- rewrite-tests-pestSkill
- security-bounty-hunterSkill
- security-reviewSkill
- security-threat-analysisSkill
- seoSkill
- skill-creatorSkill
- slack-messagingSkill
- smartest-project-additionSkill
- test-driven-developmentSkill
- tester-cookbookSkill
- test-like-humanSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
No baseline, no budget, no promotion.
- Distinctive: line 19
Never trade correctness for speed: a faster variant that changes output is rejected, not promoted.
- Very specific: line 28
Do not use for first-time correctness (use @skills/test-driven-development/SKILL.md) or pure latency architecture without a comparison loop …
- Distinctive: line 33
Before touching any code, write down all five.
- Distinctive: line 48
Run per iteration. The current winner starts as the baseline.
- Distinctive: line 56
Reject: if the correctness gate fails, the delta is within the noise threshold, or it regresses any tracked metric.
- Distinctive: line 61
Always compare against the current accepted winner, not merely the previous run — a lucky run must not become the bar.
- Distinctive: line 65
Keep a running ledger. Never discard rejected rows.
- Distinctive: line 91
When you stop, the current winner is the result.
- Distinctive: line 96
Every promotion passed the full promotion gate.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Benchmark Optimization Loop (Laravel/PHP)
Turn "make it faster" into a recursive, measured loop. Every promoted change beats a recorded baseline on a real measurement and keeps correctness green. No baseline, no budget, no promotion.
Constraints
- Apply
@rules/sql/optimalize.mdcfor any query change (N+1, eager loading, index usage, batching). - Apply
@rules/code-testing/general.mdc— the correctness gate is the project test suite. - Measure, never guess. Every win is a real readback, not a label or intuition.
- Never trade correctness for speed: a faster variant that changes output is rejected, not promoted.
- Defer all measurement mechanics (how to run, warm-up, repetitions, noise) to
@skills/benchmark/SKILL.md. This skill owns the loop and the gate, not the stopwatch.
Use when
- The goal is unquantified speed: "make it faster", "it's slow", "reduce p95".
- You are eliminating an N+1, tuning a query, choosing a cache strategy, or raising queue throughput.
- Multiple candidate fixes exist and you must pick the one that actually wins.
- A "faster" claim was made without a before/after number.
Do not use for first-time correctness (use @skills/test-driven-development/SKILL.md)
or pure latency architecture without a comparison loop (@skills/latency-critical-systems/SKILL.md).
Required baseline
Before touching any code, write down all five. If any is missing, stop and define it.
- Operation — the exact thing optimized (route, Action, job, query).
- Correctness gate — the tests that must stay green (per
@rules/code-testing/general.mdc). Identical output for identical input. - Metric — pick one primary: wall time, p95 latency, rows/sec, queries/request, cost/run, memory, queue throughput.
- Baseline value — measure the current code via
@skills/benchmark/SKILL.md. Record the number and its variance. - Budget — the stopping line, set up front:
- target (e.g. "p95 < 200 ms" or "≤ 5 queries/request"), AND
- cost cap (time/effort/iterations you will spend), AND
- noise threshold (smallest delta that counts as real, from the baseline variance).
A baseline without variance is not a baseline — you cannot tell a win from noise.
Loop
Run per iteration. The current winner starts as the baseline.
- Measure — get a fresh number for the current winner via
@skills/benchmark/SKILL.md(identical inputs, warm-up, repeated runs). - Identify bottleneck — from data, not hunch. Use
@skills/laravel-telescope/SKILL.mdfor per-request query/timing breakdown,EXPLAIN(@rules/sql/optimalize.mdc) for query plans,@skills/mysql-problem-solver/SKILL.mdfor schema/index issues, Horizon for queue lag. The bottleneck is usually one segment. - One hypothesis → one variant — change exactly one thing. State the hypothesis ("eager-load
with('items')removes the N+1"). One variable per variant or you cannot attribute the delta.- Laravel examples: eager-load to kill an N+1; add a covering index; replace per-row loop with
whereIn/upsert;Cache::remember()a stable read; raisemaxProcesses/chunk size for queue throughput.
- Laravel examples: eager-load to kill an N+1; add a covering index; replace per-row loop with
- Test with identical inputs — same dataset, same warm-up, same repetition count as the baseline. Different inputs invalidate the comparison.
- Reject or promote vs the current winner:
- Reject if the correctness gate fails, the delta is within the noise threshold, or it regresses any tracked metric.
- Promote to new current winner only if it beats the current winner by more than the noise threshold AND keeps every gate green.
- Codify — fold the promoted variant into the code; commit with the exact command and before/after numbers in the message.
- Confirm — re-measure the promoted code from a clean state to prove the win is reproducible, not a fluke.
Always compare against the current accepted winner, not merely the previous run — a lucky run must not become the bar.
Variant table
Keep a running ledger. Never discard rejected rows; they prevent re-testing dead ends.
| # | Hypothesis | Change | Metric (primary) | vs winner | Correctness | Decision | Note |
| 0 | baseline | none | 412 ms p95 | — | green | winner | variance ±18 ms |
| 1 | N+1 on items | with('items') | 96 ms p95 | -316 ms | green | promote | 51→2 queries |
| 2 | cache list 30 s | Cache::remember | 88 ms p95 | -8 ms | green | reject | within noise; adds staleness |
| 3 | covering index | add (user_id,created_at) | 71 ms p95 | -25 ms | green | promote | EXPLAIN: ref, no filesort |
Promotion gate
A variant becomes the new default only when all hold:
- Correctness preserved — full gate green; identical output for identical input (
@rules/code-testing/general.mdc). - Real win — beats the current winner beyond the noise threshold, confirmed by a clean re-measure.
- Reproducible — same result on a repeat run, not a single lucky sample.
- Rollback path — isolated in a commit/branch that can be reverted without collateral; risky changes (destructive migration, customer-facing) need an explicit approval gate.
- Documented — committed with the exact benchmark command, dataset, and before/after numbers.
Stop the recursion when any holds
- The budget target is met (good enough — do not gold-plate).
- The cost cap (iterations/time/effort) is reached.
- The last few variants show diminishing returns — deltas shrinking toward the noise threshold.
- The bottleneck has moved to something out of scope (provider API, network, hardware).
When you stop, the current winner is the result. Record why you stopped.
Done when
- Baseline (operation, gate, metric, value+variance, budget) was recorded before any change.
- Each variant tested one hypothesis with identical inputs and is logged in the variant table.
- Every promotion passed the full promotion gate; rejected variants stayed logged.
- The final winner's improvement is confirmed by a clean re-measurement, not a label.
- The correctness gate is green and a rollback path exists for every promoted change.
- A stopping criterion was hit and the reason is recorded.
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.

