Metric-Driven File Optimization Loop
Run an edit-measure-keep loop on one file: noise-aware baselines, cheat-proof evals, safe git reverts, and a ranked results log.
Before & after
Same prompt, same agent — the only difference is the skill.
I can help you optimize your homepage copy to increase email signups. To set this up, I'd need to understand your current performance baseline. How many visitors do you get daily, and what's your current signup conversion rate? Also, what aspect of the copy are you most interested in optimizing—the headline, the value prop, the CTA? I could manually rewrite variations and test them, but it might be more efficient to set up an automated optimization loop. Do you have analytics set up to measure conversions per variant? Once you clarify, I could start iterating on the copy.
AUTORESEARCH AGENT: HOMEPAGE COPY OPTIMIZATION SETUP Target file: /app/copy/homepage.md Baseline: • Current headline: Ship marketing campaigns faster • Current CTA: Start free trial • Current conversion: 3.2% (signups / visitors) Measurement: Google Analytics event signup_click / page_view Optimization metric: Conversion rate (higher = better) Iteration limit: 20 attempts, stop if no improvement > 0.1% in last 5 attempts ===== EXPERIMENT LOOP ===== ROUND 1 Baseline metric: 3.2% Iteration: Edit headline • Previous: Ship marketing campaigns faster • New: Get campaign ideas that actually convert • Reasoning: Benefit-focused, specificity Commit: git add -A && git commit -m "Experiment: benefit-focused headline" Evaluate: Run script → A/B test deployed → 2,000 visitors served → Signups: 68 (3.4% conversion) → Delta: +0.2pp Result: PASS (+0.2pp improvement) → Keep change (don't reset) ROUND 2 Baseline metric: 3.4% (new) Iteration: Edit subheading • Previous: Less time on setup, more on strategy • New: 100+ marketers generate campaigns daily. Yours could be next. • Reasoning: Social proof + urgency Commit: git add -A && git commit -m "Experiment: social proof subheading" Evaluate: → Signups: 71 (3.55% conversion) → Delta: +0.15pp Result: PASS (+0.15pp) → Keep change ROUND 3 Baseline metric: 3.55% Iteration: Edit CTA copy • Previous: Start free trial • New: See it work (free, 5 minutes) • Reasoning: Reduce friction (show time commitment) Evaluate: → Signups: 69 (3.45% conversion) → Delta: -0.1pp Result: FAIL (worse) → Reset via git reset --hard HEAD~1 → Discard change → Back to 3.55% baseline ROUND 4 (Agent learns from failure) Iteration: Edit CTA + subheading together • CTA: Try free (shorter, past failure informed this) • Subheading: Join teams cutting campaign setup time by 70% Evaluate: → Signups: 76 (3.8% conversion) → Delta: +0.25pp (bigger win!) Result: PASS (+0.25pp) → Keep ===== METRICS AFTER 4 ROUNDS ===== Baseline: 3.2% Final: 3.8% Total improvement: +0.6pp (+18.75% relative lift) Cumulative conversions gained (extrapolated): 200 extra signups/month at 10K monthly visitors ===== AUTOMATION ===== Git-tracked experiments: • Each round = 1 commit • Commit message = hypothesis • Metric = part of commit message (for tracking) git log --oneline: • Experiment: social proof subheading (+0.15pp) • Experiment: benefit-focused headline (+0.2pp) • Baseline: homepage copy 3.2% baseline Failure handling: • If eval script errors → abort round, log error, retry next round • If metric goes negative (error rate) → git reset --hard, alert ===== WHAT'S BEING OPTIMIZED ===== Each round edits ONE section (or 1–2 related elements): 1. Headline 2. Subheading 3. CTA (copy) 4. Value proposition 5. Social proof 6. FAQ Agent reasons about each: Social proof helped before, try it on CTA? ===== DEPLOYMENT ===== • Experimental changes deployed to production immediately • Each variant shown to 5% traffic (95% gets baseline) • After 2,000 visitors (statistical significance), promote winner or revert • All wins persist (don't reset to baseline each round)
About this skill
Your optimization loop keeps "winning" with 2% speedups that vanish on rerun. The agent quietly edits the test file to raise the score. Then a git reset --hard wipes an hour of unrelated work. This skill runs edit-evaluate-keep-or-revert loops the way a careful performance engineer would: one file changes, one number decides, and nothing is kept unless it clearly beats measurement noise.
What it does
- Writes an experiment spec before the first edit: target, metric and direction, correctness gates, locked eval files, noise threshold, and stop rules
- Measures baseline noise with repeated runs and accepts a candidate only if it beats the best result by more than that noise
- Blocks metric gaming by verifying the eval, tests, and golden outputs are untouched before every scoring run
- Reverts only the target file on a dedicated branch, and keeps an untracked results log that survives every revert
- Changes strategy after repeated failures, re-confirms close wins, and re-measures the final champion against the baseline
- Handles prompt and content optimization with held-out sets and noise-aware LLM-judge scoring
What you get
An experiment spec and a measured baseline. Then an iteration log with each hypothesis and its keep or discard decision, and a final report with the confirmed delta, the rejected idea themes, and the next experiments to try.
Best for
Developers using Claude Code who want to speed up a function, shrink a bundle, tune a training script, or iterate on a prompt against a benchmark. Especially useful if earlier loops accepted noise, gamed the metric, or damaged the repo.
SKILL.md preview
---
name: metric-driven-file-optimization-loop
description: Runs an autonomous loop on one target file. Each round edits the file, evaluates it against a single scalar metric, and keeps or reverts the change. The loop uses a locked evaluation harness, correctness gates, noise-aware acceptance thresholds, and git-safe reverts. Use when the user says "optimize this file until it's faster", "run an autoresearch loop on my prompt", "keep trying changes and keep whatever improves the benchmark", "shrink this bundle overnight", "set up an experiment loop for train.py", "my optimization loop keeps accepting noise", or "the agent cheated by editing the tests".
---
… (sign up to view the full skill)More development skills
View all Development skills →Performance Bottleneck Profiling: Node, Python, Go
Classifies a slowdown, gives exact profiler commands, reads the output, and proves the fix with same-conditions p95/p99 numbers.
Feature Scaffolding with Working Tests
Turn a short feature spec into code, runnable tests, and integration wiring that match your existing project.
Feature Flag Rollouts and Kill Switches
Design staged flag rollouts, verify rollback paths, and audit flag debt with explicit defaults, gates, and retirement plans.
Microcontroller Firmware and RTOS Engineering
Build and debug MCU firmware with bounded ISR/RTOS timing, safe DMA ownership, and measured power budgets.