Catalog
affaan-m/benchmark-optimization-loop

affaan-m

benchmark-optimization-loop

Use when the user asks to make something faster, try many variants, run recursive optimization, benchmark latency/throughput/cost, or choose the best implementation by repeated measured tests.

New~574Updated Jul 14, 2026

Benchmark Optimization Loop

Use this skill to convert "make it 20x faster" or "try 50 recursive optimizations" into a bounded measured loop that can actually improve a system.

Required Baseline

Do not optimize until these exist:

  • the operation being optimized;
  • the correctness gate that must stay green;
  • the metric: wall time, p95 latency, rows/sec, cost/run, memory, error rate;
  • the current baseline;
  • the search budget: max variants, max time, max spend, max data impact.

If the user asks for an unrealistic target, keep the ambition but make the loop bounded and measurable.

Loop

  1. Measure the baseline.
  2. Identify bottlenecks from evidence.
  3. Generate variants that test one hypothesis each.
  4. Run variants with the same input shape.
  5. Reject variants that fail correctness, safety, or reproducibility.
  6. Promote the fastest safe variant.
  7. Codify the winning path in a script, command, test, config, or doc.
  8. Rerun the baseline and winner to confirm the delta.

Variant Table

Track variants like this:

Variant | Hypothesis | Command | Time | Correct? | Notes
baseline | current path | npm run job | 120s | yes | stable
batch-500 | fewer round trips | npm run job -- --batch 500 | 42s | yes | winner
parallel-8 | more workers | npm run job -- --workers 8 | 31s | no | rate limited

For recursive or hyperparameter work:

  • persist every run to a ledger;
  • compare against the prior accepted winner, not only the previous run;
  • keep a holdout or replay check;
  • stop when improvement is within noise, correctness fails, cost exceeds the budget, or the search starts changing more variables than it can explain.

Use phrases like "best measured safe variant" instead of "global optimum" unless the search space was actually exhaustive.

Promotion Gate

A variant cannot become the new default until:

  • correctness tests pass;
  • the performance delta is repeated or explained;
  • rollback is obvious;
  • the change is encoded in source control or a durable runbook;
  • the final summary includes exact commands and measurements.
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

81/100

Grade

B

Good

Safety

85

Quality

79

Clarity

85

Completeness

73

Summary

This skill guides agents through a structured benchmarking and optimization loop for performance improvement. It provides a framework to identify bottlenecks, generate measured variants, and systematically promote the fastest implementation while maintaining correctness and safety gates.

Detected Capabilities

Read (baseline measurement data)Write (variant results, ledgers, winning configurations)Edit (updating configs, runbooks, scripts)Bash (running benchmarks and variants)Grep (analyzing logs)Glob (finding test/config files)

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

optimize performancebenchmark variantsreduce latencytest hyperparametersimprove throughputfind best configmeasure optimizationbatch size tuning

Use Cases

  • Optimize slow database queries by testing index strategies, batch sizes, and query rewrites while measuring latency improvements
  • Reduce API response times through parallelization, caching, or connection pooling variants with latency tracking
  • Find optimal hyperparameters for machine learning models by testing learning rates, batch sizes, and architectures with validation accuracy gates
  • Cut deployment costs by comparing cloud instance types, container configurations, and autoscaling policies with budget constraints
  • Improve throughput in batch processing jobs by testing worker counts, batch sizes, and concurrency settings while tracking rows/second

Quality Notes

  • Clear structure with numbered loop steps and explicit promotion gates—agent has no ambiguity about how to proceed
  • Practical variant table example helps visualize expected outputs and success tracking
  • Recursive search section includes guardrails: ledger persistence, comparison against prior winner, holdout/replay checks, stopping conditions—prevents runaway optimization
  • Emphasizes evidence-based decisions ('identify bottlenecks from evidence', 'delta is repeated or explained')—good epistemology for optimization work
  • Promotion gate requirements are strong: correctness tests, delta verification, rollback clarity, source control durance—prevents premature promotion of false positives
  • Cautious language ('best measured safe variant' vs 'global optimum')—appropriately hedges claims about search completeness
  • Missing: concrete examples of what 'correctness gate' and 'same input shape' mean in practice (e.g., regression test format, data set size requirements)
  • Missing: guidance on handling cases where no variant improves over baseline (decision tree for when to stop searching)
  • Missing: trade-off guidance for multi-metric optimization (when is 10% latency improvement worth 5% more memory?)
  • Could benefit from brief section on statistical significance—when is performance delta real vs noise?
Model: claude-haiku-4-5-20251001Analyzed: Jul 14, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v1.1

    Content updated

    ✦ AISKILL.md body unchanged; safety grade moved A to B.

    2026-07-14

    Latest
  2. v1.0

    2026-05-25

    View This VersionInitial version

Use affaan-m/benchmark-optimization-loop in your dev environment

Command Palette

Search for a command to run...

affaan-m/benchmark-optimization-loop | SkillRepo