Metric Mode
Optimize page load time:
/optimize --metric "lighthouse_perf" --higher-is-better \
--measure "npx lighthouse http://localhost:3000 --output=json --output-path=lh.json" \
--extract "jq '.categories.performance.score * 100' lh.json" \
--files "src/**/*.tsx,src/**/*.css" \
--target 95 --budget 120
Optimize bundle size:
/optimize --metric "bundle_bytes" --lower-is-better \
--measure "bun run build 2>&1 && du -sb dist/ | cut -f1" \
--files "src/**/*.ts" \
--constraints "all tests must pass"
ML training (Karpathy-style):
/optimize --metric "val_bpb" --lower-is-better \
--measure "uv run train.py > run.log 2>&1 && grep '^val_bpb:' run.log | cut -d' ' -f2" \
--files "train.py" \
--locked "prepare.py" \
--budget 300
Eval Mode
Optimize a skill's Extract workflow:
/optimize --target "~/.claude/skills/ExtractWisdom" --max-experiments 15
Optimize a standalone prompt:
/optimize --target "prompts/summarize-article.md" --runs 5
Optimize with custom criteria:
/optimize --target "~/.claude/skills/Research/Workflows/QuickResearch.md" \
--criteria "Does the output contain specific facts with sources?" \
"Is the output structured with clear sections?" \
"Does the output avoid generic filler?" \
--inputs "research quantum computing breakthroughs 2025" \
"quick research on supply chain security" \
"find recent developments in AI agents"