benchmark-optimization-loop

benchmark-optimization-loop is a skill for Claude Code, Codex from pekral/cursor-rules. It costs 52 tokens per session (1,579 once invoked), scanned A, original, MIT.

A measured process for making Laravel and PHP software faster. Laravel is a PHP web framework; the process compares candidate changes with a recorded baseline and keeps only changes that preserve correctness.

In plain words
What is it for?
Use it for slow queries, repeated database queries known as N+1 problems, caching choices, queue throughput, or vague goals such as reducing response-time percentiles.
Why use it?
It replaces guesses about performance with before-and-after measurements, while rejecting speed improvements that change the result.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for slow queries, repeated database queries known as N+1 problems, caching choices, queue throughput, or vague goals such as reducing response-time percentiles.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pekral/cursor-rules/benchmark-optimization-loop
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add pekral/cursor-rules --skill benchmark-optimization-loop
Clone the repo
git clone --depth 1 https://github.com/pekral/cursor-rules

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for benchmark-optimization-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/pekral/cursor-rules/benchmark-optimization-loop/github.svg)](https://agentmods.dev/skills/pekral/cursor-rules/benchmark-optimization-loop)
Your own site
<a href="https://agentmods.dev/skills/pekral/cursor-rules/benchmark-optimization-loop"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/benchmark-optimization-loop/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for benchmark-optimization-loop

Your own site · 80×15
<a href="https://agentmods.dev/skills/pekral/cursor-rules/benchmark-optimization-loop"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/benchmark-optimization-loop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,579 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.01579
Opus 5.5 $0.00021 $0.00632
Sonnet 5.5 $0.00010 $0.00316
Haiku 4.5 $0.00005 $0.00158

Measured 1mo ago against content hash f0879660edac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

benchmark-optimization-loop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/benchmark-optimization-loop/SKILL.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.mdc for 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.

  1. Operation — the exact thing optimized (route, Action, job, query).
  2. Correctness gate — the tests that must stay green (per @rules/code-testing/general.mdc). Identical output for identical input.
  3. Metric — pick one primary: wall time, p95 latency, rows/sec, queries/request, cost/run, memory, queue throughput.
  4. Baseline value — measure the current code via @skills/benchmark/SKILL.md. Record the number and its variance.
  5. 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).

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 100 lines · 52 tokens per session scan A f0879660edac

Subscribe to this mod's changes

benchmark-optimization-loop is a skill published in the GitHub repository pekral/cursor-rules (11 stars, last pushed 13d ago), licensed MIT. It adds 52 tokens to every session and 1,579 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

create-powergrid-plugin

Create a complete PowerGrid plugin from scratch, including PHP class, Column macro, Blade view, Alpine.js component, and registration.

Power-Components/livewire-powergrid · 31 tokens

sentry-php-sdk

Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for PHP applications. Supports plain PHP, Laravel, and Symfony.

getsentry/sentry-for-ai · 71 tokens

owl-admin-devtools-generator

A development guide for Owl Admin, a Laravel-based administration system, covering its code generator, API templates, relationships, and visual pages.

slowlyo/owl-admin · 82 tokens

laravel

Use when building or extending a Laravel 11/12 app — Eloquent models, migrations and relationships, routing with controllers and Form Requests, queues and background jobs, framework-native security (validation, mass-assignment, policies, signed URLs, rate limiting), and Pest/PHPUnit feature tests. NOT pure PHP…

ericrisco/rsc-harness · 76 tokens

Laravel Dusk Testing

Expert-level Laravel Dusk browser testing skill for PHP/Laravel applications. Covers Chrome-based E2E testing, browser assertions, Page Objects, component testing, authentication helpers, and database integration.

PramodDutta/qaskills · 44 tokens

php-expert

Expert-level PHP development with PHP 8+, Laravel, Composer, and modern best practices. Use when the user mentions Laravel, Composer, Symfony, PHPUnit, or PSR standards, or when the task involves PHP 8+ Features, Object-Oriented PHP, Modern PHP, or Constructor Property Promotion.

personamanagmentlayer/pcl · 64 tokens