Skill Tuning — Optimize a Skill Against a Reward Signal
Author prose is a guess until a reward measures it. This skill turns skill
improvement into a measurable optimization loop: you pick a skill, define a task
that scores an agent following it, and let the loop propose edits that provably
raise the score on held-out items. It is the empirical counterpart to
skill-builder (which scaffolds a skill from scratch) and to docs-alignment
(which checks prose consistency). Neither of those measures whether the skill
actually makes an agent succeed. This one does.
Trial of record: the framework was validated end-to-end by tuning the
build-with-quality skill's DEBUGGING-PROTOCOL.md against a Rust
stub-and-restore task. That run is the worked example throughout; build-with-
quality was only the trial subject — the capability generalizes to any skill.
When To Use
- You have a skill whose effect you can score: there is (or you can build) a
bounded task where an agent reads the skill, acts, and a deterministic checker
returns a number (tests pass-rate, eval-rubric score, structural assertions).
- You want edits justified by a measured uplift on items the optimizer never saw,
not by intuition.
- You want to compare optimization strategies (single strong optimizer vs a
multi-model mesh) on the same evidence.
When NOT to use:
- Authoring a brand-new skill →
skill-builder.
- Checking prose/cross-link consistency only →
docs-alignment.
- A skill whose value cannot be reduced to any measurable task (pure stylistic
guidance with no success criterion). Without a reward there is no gradient — do
not force one; a saturated 0%/100% task teaches nothing.
The Loop (SkillOpt)
┌─────────── one step (epoch × batch) ───────────┐
seed skill S₀ → │ rollout → reflect → aggregate → select → update │ → candidate
└────────────────────────┬───────────────────────┘
▼
evaluate (gate) on val
accept_new_best / keep incumbent
▼
held-out test eval (baseline vs best)
- rollout — run the target agent on a minibatch of training items, each
with the current skill in context. Capture every trajectory.
- reflect — an analyst model reads each trajectory and proposes edits
(failure edits fix what broke; success edits codify what worked).
- aggregate/merge — dedupe overlapping edits across the batch, rank by
support count, keep the strongest within an edit budget.
- select/update — apply the merged patch to produce a candidate skill.
- evaluate (gate) — score the candidate on a validation split; accept it as
the new best only if it beats the incumbent.
- held-out test — finally, score S₀ and the best skill on a test split the
optimizer never touched. That delta is the only number that matters.
Two Optimizer Arms
Run either or both on the same rollout evidence for a fair comparison:
- Arm A — single strong optimizer. One model (e.g. Opus) plays analyst +
merger inside the SkillOpt trainer. Edits are applied in patch mode
(anchored insert/replace). Conservative: preserves the seed's structure,
grafts in islands. Limitation: patch mode cannot restructure — if the seed's
framing is wrong for the regime, the right ideas land in the wrong place.
- Arm B — mesh. A coordinator self-allocates an Opus/Sonnet split across
roles (e.g. Opus = skill-author, Sonnet = failure-analyst + red-team) and
produces a full rewrite. Escapes the seed's structure; coherent and
regime-native, at higher coordination cost.
Honesty note: if the spawn path doesn't expose a per-worker
model
parameter, the "split" is role-effort inside the coordinator turn, not separate
model processes — document that in allocation.md rather than overclaiming.
The trial found both arms converge on the same content insight; they differ in
form (graft vs rewrite). Use the held-out comparator to pick the winner, then
promote its insight surgically into the real skill — do not paste either
candidate wholesale.
Procedure
- Pick the skill and the reward task. Choose a skill file as
S₀. Build a
task where an agent following it produces an artifact a checker can score.
Split items into train / val / test (the optimizer sees train+val only;
test is the held-out ruler).
- Calibrate to a gradient regime. A task the agent already aces (or always
fails) yields no signal. Add a difficulty lever until the seed scores in the
~30–80% band. Trial lever: restrict the target to
Read,Edit (no Bash),
removing brute-force verification and forcing reason-from-code. This is what
created headroom — the seed assumed a runnable loop that no longer existed.
- Baseline. Score
S₀ on test (with replication — see below).
- Run an arm. Arm A: launch the SkillOpt trainer with a config (see
Harness). Arm B: hand the mesh coordinator a no-leakage evidence packet
(seed + the same rollout trajectories, no reference solution, no test items)
and have it self-allocate and write
best_skill.md + allocation.md.
- Compare on held-out, noise-robustly. Run
replicate_eval.py over
S₀ / armA / armB on the test split with reps ≥ 3. Report hard_acc and
soft_acc.
- Bank findings (RuVector
project-state / patterns) — method, deltas,
and every gotcha hit (these are the reusable IP).
- Promote surgically. Land only the winning insight into the live skill,
scoped to where it actually generalizes. Resist smearing a corner-case insight
across the whole skill.
Depth on demand
The worked trial's Hard-Won Lessons (read before every run), the live
harness asset table and run commands (/home/devuser/workspace/skillopt-lab,
verified present 2026-09-09), the four-file contract for plugging in a new
skill/task, and the output artefact list all live in
references/worked-trial-and-harness.md.
Related Skills
skill-builder — author a new skill (use before tuning a fresh one); it
links back here for measuring whether wording changes actually work.
build-with-quality — the trial subject; its EDD layer ("executed evidence
required; narrative evidence auto-rejected") is the same discipline this loop
enforces empirically.
docs-alignment — prose/cross-link consistency (orthogonal to reward).
License
MIT
1---2name: skill-tuning3description: Empirically optimize any existing Claude skill against a measurable reward signal using a closed SkillOpt loop (rollout → reflect → aggregate → select → evaluate) plus a noise-robust held-out A/B comparator. Use when you want a skill's prose tuned by evidence rather than eyeballed — e.g. raising an agent's success rate on a bounded, scoreable task — or to compare a single-optimizer arm against a mesh arm. Complements skill-builder (which authors skills); this one tunes them.4license: MIT5---67# Skill Tuning — Optimize a Skill Against a Reward Signal89Author prose is a guess until a reward measures it. This skill turns skill10improvement into a measurable optimization loop: you pick a skill, define a task11that scores an agent following it, and let the loop propose edits that provably12raise the score on **held-out** items. It is the empirical counterpart to13`skill-builder` (which scaffolds a skill from scratch) and to `docs-alignment`14(which checks prose consistency). Neither of those measures whether the skill15actually makes an agent *succeed*. This one does.1617> **Trial of record:** the framework was validated end-to-end by tuning the18> `build-with-quality` skill's `DEBUGGING-PROTOCOL.md` against a Rust19> stub-and-restore task. That run is the worked example throughout; build-with-20> quality was only the *trial subject* — the capability generalizes to any skill.2122## When To Use2324- You have a skill whose effect you can **score**: there is (or you can build) a25 bounded task where an agent reads the skill, acts, and a deterministic checker26 returns a number (tests pass-rate, eval-rubric score, structural assertions).27- You want edits justified by a measured uplift on items the optimizer never saw,28 not by intuition.29- You want to compare optimization strategies (single strong optimizer vs a30 multi-model mesh) on the same evidence.3132**When NOT to use:**3334- Authoring a brand-new skill → `skill-builder`.35- Checking prose/cross-link consistency only → `docs-alignment`.36- A skill whose value cannot be reduced to any measurable task (pure stylistic37 guidance with no success criterion). Without a reward there is no gradient — do38 not force one; a saturated 0%/100% task teaches nothing.3940## The Loop (SkillOpt)4142```43 ┌─────────── one step (epoch × batch) ───────────┐44seed skill S₀ → │ rollout → reflect → aggregate → select → update │ → candidate45 └────────────────────────┬───────────────────────┘46 ▼47 evaluate (gate) on val48 accept_new_best / keep incumbent49 ▼50 held-out test eval (baseline vs best)51```5253- **rollout** — run the *target* agent on a minibatch of training items, each54 with the current skill in context. Capture every trajectory.55- **reflect** — an *analyst* model reads each trajectory and proposes edits56 (failure edits fix what broke; success edits codify what worked).57- **aggregate/merge** — dedupe overlapping edits across the batch, rank by58 support count, keep the strongest within an edit budget.59- **select/update** — apply the merged patch to produce a candidate skill.60- **evaluate (gate)** — score the candidate on a validation split; accept it as61 the new best only if it beats the incumbent.62- **held-out test** — finally, score S₀ and the best skill on a *test* split the63 optimizer never touched. That delta is the only number that matters.6465## Two Optimizer Arms6667Run either or both on the **same** rollout evidence for a fair comparison:6869- **Arm A — single strong optimizer.** One model (e.g. Opus) plays analyst +70 merger inside the SkillOpt trainer. Edits are applied in **patch mode**71 (anchored insert/replace). Conservative: preserves the seed's structure,72 grafts in islands. *Limitation: patch mode cannot restructure — if the seed's73 framing is wrong for the regime, the right ideas land in the wrong place.*74- **Arm B — mesh.** A coordinator self-allocates an Opus/Sonnet split across75 roles (e.g. Opus = skill-author, Sonnet = failure-analyst + red-team) and76 produces a **full rewrite**. Escapes the seed's structure; coherent and77 regime-native, at higher coordination cost.78 *Honesty note:* if the spawn path doesn't expose a per-worker `model`79 parameter, the "split" is role-effort inside the coordinator turn, not separate80 model processes — document that in `allocation.md` rather than overclaiming.8182The trial found both arms converge on the same *content* insight; they differ in83*form* (graft vs rewrite). Use the held-out comparator to pick the winner, then84promote its insight **surgically** into the real skill — do not paste either85candidate wholesale.8687## Procedure88891. **Pick the skill and the reward task.** Choose a skill file as `S₀`. Build a90 task where an agent following it produces an artifact a checker can score.91 Split items into `train` / `val` / `test` (the optimizer sees train+val only;92 test is the held-out ruler).932. **Calibrate to a gradient regime.** A task the agent already aces (or always94 fails) yields no signal. Add a difficulty lever until the seed scores in the95 ~30–80% band. *Trial lever:* restrict the target to `Read,Edit` (no `Bash`),96 removing brute-force verification and forcing reason-from-code. This is what97 created headroom — the seed assumed a runnable loop that no longer existed.983. **Baseline.** Score `S₀` on test (with replication — see below).994. **Run an arm.** Arm A: launch the SkillOpt trainer with a config (see100 *Harness*). Arm B: hand the mesh coordinator a no-leakage evidence packet101 (seed + the *same* rollout trajectories, no reference solution, no test items)102 and have it self-allocate and write `best_skill.md` + `allocation.md`.1035. **Compare on held-out, noise-robustly.** Run `replicate_eval.py` over104 `S₀ / armA / armB` on the test split with `reps ≥ 3`. Report `hard_acc` and105 `soft_acc`.1066. **Bank findings** (RuVector `project-state` / `patterns`) — method, deltas,107 and every gotcha hit (these are the reusable IP).1087. **Promote surgically.** Land only the winning insight into the live skill,109 scoped to where it actually generalizes. Resist smearing a corner-case insight110 across the whole skill.111112## Depth on demand113114The worked trial's Hard-Won Lessons (read before every run), the live115harness asset table and run commands (`/home/devuser/workspace/skillopt-lab`,116verified present 2026-09-09), the four-file contract for plugging in a new117skill/task, and the output artefact list all live in118[references/worked-trial-and-harness.md](references/worked-trial-and-harness.md).119120## Related Skills121122- `skill-builder` — author a new skill (use *before* tuning a fresh one); it123 links back here for measuring whether wording changes actually work.124- `build-with-quality` — the trial subject; its EDD layer ("executed evidence125 required; narrative evidence auto-rejected") is the same discipline this loop126 enforces empirically.127- `docs-alignment` — prose/cross-link consistency (orthogonal to reward).128129## License130131MIT