/mays:skill-optimizerfrom mays
Optimizes existing skills that work but are inconsistent via an autonomous mutation-and-scoring loop with binary evals, keeping improvements and discarding regressions.
Ships in mays. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Take a skill that works but is inconsistent and push it from ~70% to ~95% reliability through an autonomous experiment loop.
This is NOT for creating skills from scratch. Use skill-creator for that. This picks up after the skill exists and mostly works, but fails too often. This finds out why and fixes it.
measure baseline → analyze failures → hypothesize one change → mutate → re-measure → keep or revert → repeat
One change at a time. If the score goes up, keep it. If not, revert. That's it.
Do not run experiments until all fields are confirmed with the user.
Before the user confirms, state the cost: roughly (budget cap + 1) × runs × inputs isolated claude -p calls, plus grading calls. At the defaults that is 150-250 full skill executions. Let the user shrink the run count or cap if that's more than the skill is worth.
Reserve one of the test inputs as held-out: never score it during the loop, never let it inform a mutation. It's the overfitting check in Step 6. Gather at least 4 inputs total so the loop still covers 3+ use cases, and count only loop inputs in the cost formula.
Every eval must be a binary yes/no question. No scales. No vibes.
For code/technical skills, prefer objective evals that don't require self-grading:
| Eval type | Example | Reliability |
|---|---|---|
| Execution | Does the code run without errors? | High — actually run it |
| Lint/typecheck | Zero lint warnings? Zero type errors? | High — run the tool |
| Test pass | Do the generated tests pass? | High — run them |
| Structural | Does output contain required sections? | Medium — grep/parse |
| Absence | Zero TODOs or placeholder comments? | Medium — grep |
| Subjective | Is the code well-organized? | Low — self-grading bias |
Prefer evals in the top half of this table. Every eval you can check by running a command is worth three you check by reading the output.
If you must use subjective evals, acknowledge the bias: the same model grading its own output will systematically over-rate it. Mitigate two ways: make criteria as specific as possible, and grade with a separate claude -p call that sees only the eval question and the output — never the skill text or the experiment history.
See the Writing Good Evals section below for detailed guidance.
Read the full SKILL.md and any referenced files. Understand the core job, process steps, output format, and existing quality checks before changing anything.
While reading, mark two kinds of instruction as removal candidates:
Create the workspace outside the skill's repo — in the session scratchpad or a temp directory — so experiment artifacts never end up committed:
optimizer-[skill-name]/
├── optimized.md # working copy — all mutations happen here
├── baseline.md # original skill, untouched (revert target)
├── previous.md # last KEPT version (revert target for the current experiment)
├── inputs/ # test inputs as files, one per input — experiments must be reproducible
│ ├── input1.txt
│ └── heldout.txt # never scored during the loop
├── results.tsv # aggregate score log, one row per experiment
├── scores/ # per-experiment matrix: one row per (input, run), one column per eval, 0/1 cells
│ └── exp0.tsv
├── changelog.md # mutation log (the most valuable artifact)
└── outputs/ # saved outputs from each experiment
├── exp0-run1.txt
├── exp0-run2.txt
└── ...
The scores/ matrices are what make failure analysis possible: "which evals fail most, on which inputs" is a column/row sum, not a re-read of every output. Fill them in as you grade.
Copy the original SKILL.md to optimized.md, baseline.md, and previous.md. NEVER edit the original.
Initialize results.tsv:
experiment score max_score pass_rate status description
Run the skill as-is before changing anything.
Use claude -p for each run to get isolated execution with no memory between runs. Inject the skill via --append-system-prompt — that approximates how a triggered skill lands in context, while the task stays in the user turn:
cd optimizer-[skill-name] # the Step 2 workspace, outside any repo
claude -p "$(cat inputs/input1.txt)" \
--append-system-prompt "$(cat optimized.md)" \
--model <same model every experiment> \
--safe-mode --tools "" --setting-sources project \
--no-session-persistence \
> outputs/exp0-run1.txt 2>&1 </dev/null
A plain claude -p is not isolated. It loads the user's CLAUDE.md, auto-memory, MCP servers, and user settings. If that CLAUDE.md restates the skill's rules, every run sees them, and a no-skill arm is not a no-skill arm. A live Skill tool can also load the installed skill instead of optimized.md. --safe-mode drops CLAUDE.md, memory, skills, plugins, and MCP servers. --setting-sources project drops user settings, which can add tools such as the advisor. --tools "" removes the Skill tool. --bare ignores a subscription login. Before Experiment 0, ask one instance whether it sees any CLAUDE.md or tools.
With no tools, an instance cannot read the skill's references/. Append each reference file to the --append-system-prompt payload after the skill. Give grader calls the same flags.
Pin --model for the whole optimization run. A model change mid-loop makes every score before it incomparable to every score after it.
Runs are independent — launch them in parallel (background them, collect as they finish) rather than waiting on each one serially.
Run [N] times across the test inputs. Score every output against every eval.
For execution-based evals, actually run the generated code:
# Save generated code to temp file, execute it, check exit code
node outputs/exp0-run1.js 2>&1
echo "Exit code: $?"
Without claude -p, you run the skill sequentially in the same context window. This means:
Log to results.tsv:
0 14 20 70.0% baseline original skill — no changes
Confirm baseline with user before proceeding. If already 90%+, ask if optimization is worth pursuing.
Once the user confirms, run autonomously.
1. Analyze failures. Read the actual failing outputs. Which evals fail most? What pattern causes the failure — missing instruction, ambiguous wording, wrong priority?
2. Hypothesize one change. Pick ONE thing to change. Not five.
Good mutations:
Bad mutations:
3. Edit optimized.md with the one change.
4. Run the skill [N] times with the same test inputs.
5. Score every output against every eval. Record the 0/1 matrix in scores/exp[N].tsv. Grade subjective evals blind: the grader call sees the eval question and the output, never which experiment produced it — a grader that knows "this is the improved version" finds improvement.
6. Keep or revert. Small deltas are noise: on 5 runs, a single flipped eval is within run-to-run variance. If the delta is within ±1 eval of the previous score, re-run the experiment once and use the combined tally before deciding.
optimized.md over previous.md. This is the new baseline.optimized.md over previous.md, or the next revert erases it.previous.md over optimized.md.7. Log to results.tsv and changelog.md.
8. Repeat from step 1 of the loop.
Stop when ANY of these hit:
Do not run indefinitely. The budget cap exists to prevent runaway API costs. If you hit the cap and haven't reached 95%, deliver what you have and let the user decide whether to continue.
If the last 3 experiments were all reverted:
After each experiment (kept or reverted), append to changelog.md:
## Experiment [N] — [KEEP/REVERT]
**Score:** [X]/[max] ([percent]%)
**Change:** [One sentence describing what was changed]
**Hypothesis:** [Why this was expected to help]
**Result:** [Which evals improved/declined]
**Remaining failures:** [What still fails, if anything]
The changelog is the most valuable output. It's a research log that any future agent (or smarter model) can pick up and continue from. Write it for someone who hasn't seen the skill before.
Held-out check first. Run the final optimized.md on the held-out input [N] times and score it. If its pass rate roughly matches the loop's final rate, the improvement generalizes. If it collapses, you overfit — report both numbers and flag which kept mutations look input-specific; don't quietly present the loop score as the result.
Then present:
optimized.md — the improved skill (original is untouched)changelog.md and results.tsv for referenceDo NOT overwrite the original SKILL.md. The user reviews the diff and applies changes manually.
A good optimization run:
If the skill passes all evals but output quality hasn't actually improved — the evals are bad. Go back and write better evals.
| Mistake | Fix |
|---|---|
| Too many evals (7+) | Skill games the evals instead of improving. Use 3-6. |
| All subjective evals | Self-grading bias inflates scores. Add execution-based evals. |
| No budget cap | Runaway API costs. Always set a cap. |
| Multiple changes per experiment | Can't attribute improvement. One change at a time. |
| Never reverting | If nothing gets reverted, your evals might be too easy. |
| Treating ±1 as signal | On 5 runs, one flipped eval is noise. Re-run before keep/revert. |
| Skipping baseline | You can't measure improvement without a starting point. |
| Overfitting to test inputs | Use varied inputs and a held-out input. If loop score is 95% but held-out collapses, the mutations are input-specific — remove the most targeted ones and re-measure. |
| Grader sees experiment context | A grader that knows which version it's grading finds improvement. Grade blind: eval question + output only. |
Every eval must be a yes/no question. Not a scale. Not a vibe check. Binary. Scales compound variability and give unreliable signal.
Code/technical skills:
Text/copy skills:
Document skills:
Before finalizing any eval:
EVAL [N]: [Short name]
Question: [Yes/no question]
Pass: [What "yes" looks like — one sentence]
Fail: [What triggers "no" — one sentence]
Check method: [How to verify — execute, grep, parse, or read]
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub stevenmays/dotfiles --plugin mays14 skills in this plugin
/adversarial-reviewTwo-family adversarial review of a plan or a diff — one fresh Claude subagent and one external run (GPT through Codex, or Grok through Cursor) on identical briefs, launched concurrently, then triaged into verified blockers, concerns, and rejected findings. Use before approving a plan, before shipping a change, or whenever a workflow asks for an adversarial review./claims-verificationCheck the factual claims a plan makes about existing code against the repo — extract atomic claims, have a fresh subagent answer neutral questions without seeing the plan, then score each claim. Use after a plan is drafted and before adversarial review, or whenever a workflow asks to verify a plan's claims./claude-subagentsDispatch planning, review, implementation, or a scoped question to a fresh Claude subagent with the Agent tool — which subagent type and model to pick, what the prompt must carry, and how to check what comes back. Use whenever a workflow hands work to a Claude subagent, including the Claude half of adversarial-review./codex-image-generatorDefault image generation path. Generate or edit raster images (hero images, illustrations, textures, product shots, mockups, transparent cutouts) through the Codex CLI's built-in image_gen tool, run in a subagent. Use whenever the user asks for an image, picture, illustration, or visual asset and does not name a provider. Not for SVG, icons, or diagrams that belong in code./deslopClean up AI slop in existing code — measure complexity with real tools, delete dead and redundant code, refactor the worst hotspots first, and prove behavior is unchanged. Use when the user asks to clean up slop, deslop, reduce complexity, untangle spaghetti, simplify a god function, or make AI-generated code maintainable. Not a review skill — extreme-code-quality-review covers review; this one changes the code./external-subagentsRun a planning, research, review, or implementation task on a second model family as a background subagent that cannot hang the session — GPT through the Codex CLI, or the newest Grok through the Cursor CLI where Codex is missing. A wrapper kills stalled runs and salvages partial output. Use whenever a workflow sends work to Codex, Cursor, GPT, Grok, a second model, or a non-Claude subagent, including the external half of adversarial-review. Not for images.Other plugins' skills for the same job