SkillAdam Optimize
Use the skilladam_* MCP tools when available. Otherwise invoke the equivalent
skilladam-product commands and parse their JSON output.
Build the task manifest
For a new run, research and construct the task signal in the current host
session before calling SkillAdam. Do not start a nested agent or external task
generator solely for this step.
- Read the complete target
SKILL.md and the user's usage intent.
- Call
skilladam_discover_history exactly once with skill_path, intent,
and the durable output_dir. It automatically scans the current host's known
local history formats, keeps only real user messages, redacts likely secrets
and personal data, deduplicates them, and writes history_discovery.json.
Review each candidate for actual relevance and evaluation feasibility. Turn
a useful real request into a self-contained evaluation case by minimally
normalizing it and, when necessary, embedding a small synthetic artifact that
preserves the requested work. Record metadata.history_transform describing
that normalization; never claim the synthetic artifact came from the user.
Use source local_history and the candidate's exact returned source_ref;
never invent a history reference. A completed search with zero accepted
candidates is valid and must not be relabeled as a history-derived task.
- Reuse concrete tasks the user supplied. Extract tasks from the currently
visible conversation only when they represent actual Skill usage; use source
conversation, redact secrets and personal data, and keep a precise turn
reference.
- When a recognized public benchmark would materially improve coverage, use the
host's normal web/research tools to select relevant cases. Record the direct
source URL and benchmark/license details in metadata. Do not invent provenance
when no suitable source was found.
- Fill the remaining coverage from the Skill itself. Produce exactly
task_count distinct tasks, covering at least two concise lowercase capability
slugs and at least one boundary, adversarial, or regression case. Prefer
realistic end-to-end requests over shallow paraphrases.
- Give every task a stable
task_id, self-contained prompt, capability,
difficulty, source, source_ref, and explicit evaluation. Allowed
sources are local_history, conversation, user_provided,
public_benchmark, and skill_generated, in that priority order when the
source yields a genuinely useful task. Public benchmark references must be
direct HTTP(S) URLs.
- Use deterministic
programmatic or reference evaluation only when the task
has one uniquely correct answer, such as a number, fixed string, explicit JSON
structure, or exact set of fields. Open-ended natural-language tasks that
allow semantically equivalent answers must use a rubric_judge rubric with
weighted observable dimensions; never score the complete response with
exact or normalized_exact. This includes generated messages, reviews,
rewrites, summaries, recommendations, and analyses. Use hybrid only for
complementary components. Every
evaluation, including each hybrid component, must include concise
failure_feedback with the actionable correction or evidence to use after a
failure. Never omit an evaluation or ask SkillAdam to infer one. Correct a
rejected manifest instead of weakening the requested count or evaluation goal.
Pass {"schema_version":"1","tasks":[...]} in task_manifest. Task text must
not depend on files, tools, credentials, or context unavailable to the rollout
model.
Start or resume
- Obtain the source
SKILL.md, a durable workspace-local output directory,
and the user's usage intent. Use a path such as run/skilladam-optimize under
the current workspace; never use a host temporary or session-state directory.
- For a new run, call
skilladam_prepare with the source skill_path, intent,
durable output_dir, completed task_manifest, and compact: true; omit
provider fields so SkillAdam reuses the platform's authenticated CLI. Pass provider configuration only for
an explicit fixture or OpenAI-compatible override. Use
skilladam_prepare_for_review instead only when the user explicitly requested
confirmation or hunk selection before apply. Do not use the asynchronous
skilladam_start* tools: the Claude adapter intentionally does not expose
them because a non-interactive turn may stop polling before a worker reaches
a terminal state.
- In default mode, call
skilladam_prepare again with the same output_dir and
compact: true while the workflow state is ready or validating, until the
existing stopping policy returns completed. Each call resumes the durable
checkpoint. If a call fails, report the exact error; do not shrink
task_count or weaken evaluation settings as a workaround.
Review a proposal
- Read
proposal.hunks from the structured result. Preserve every hunk_id.
- Determine whether the user explicitly requested hunk review or confirmation
before changes are applied. A general request to optimize, improve, patch, or
modify the Skill does not opt in to review.
- By default,
skilladam_prepare auto-accepts every proposed hunk before the
call returns. Do not issue a second selection, omit or reject hunks, pause for
confirmation, or override the gate based on your own assessment.
- Only after an explicit review opt-in, use
skilladam_prepare_for_review,
present every hunk's target, header, and operations in original order, and
wait at awaiting_review. Prefer a native
structured selection UI that can map decisions back to exact hunk IDs;
otherwise ask the user for accepted IDs, accept all, or reject all.
- In review mode, never treat silence, timeout, disconnect, resume, or an
unrelated positive comment as acceptance. An empty selection rejects all.
- Submit exactly the selected IDs with a new, stable idempotency key. Do not use
review results from a different proposal or infer a partial selection.
Validate and iterate
- Trust only
candidate_validation whose digest matches the selected candidate.
Never reuse validation for the full proposal after a partial selection. Each
iteration's current Skill rollout and selected candidate validation must keep
the exact ordered mini-batch IDs recorded in the session.
- Report the gate decision and stop reason concisely. The service writes the
source Skill only when the gate accepts the selected candidate. After the gate,
the service updates EIT/Momentum from ordered trajectory feedback, the patch,
candidate feedback, and the decision, then updates the adaptive edit budget.
- Continue synchronous
skilladam_prepare calls through ready and
validating until the workflow reaches completed; the same tool resumes
both states, so do not call skilladam_continue.
- If the source changed during review, preserve the external edit and report the
conflict; do not overwrite it.
- On
completed, report final quality only from final_validation whose scope
is heldout_terminal. baseline_validation and candidate_validation are
optimization mini-batch evidence and must never be described as final or
held-out. If terminal evidence is unavailable, report that exact condition;
do not substitute another metric. Never feed final held-out evidence into
patch generation, hunk selection, an iteration gate, or Momentum.
- Use the compact response's
iterations entries for per-iteration results.
Do not request a full status response merely to reconstruct the final report.
Never edit, replace, or patch the source Skill with host file tools or shell
commands during an optimization session. This remains forbidden when a proposal
looks weak, the gate rejects it, or the iteration limit is reached. Only
SkillAdam may write a selected candidate after frozen validation passes the gate;
otherwise leave the source unchanged and report the session result.
The host owns task research and manifest construction only. Do not reimplement
manifest validation, evaluation execution, patch application, gate logic,
Momentum, edit budgets, checkpoints, or stopping policy in the host adapter.
Claude Code structured review
When the user explicitly requested confirmation or selective hunk review:
- After
skilladam_prepare_for_review reaches awaiting_review, present every
hunk in original order. For each hunk, show its stable hunk_id, target path,
header, and complete operations inside a fenced diff block. Do not summarize
or omit the diff before asking for a decision.
- Use Claude Code's
AskUserQuestion tool to collect an explicit accept/reject
decision for each displayed hunk. Keep the stable hunk_id in each question
and batch questions only when required by the host tool's current limit.
- Map the answers back to exact hunk IDs and call
skilladam_submit_selection once with the final accepted set. Cancellation,
silence, timeout, or an incomplete answer leaves the session at
awaiting_review and must never trigger default acceptance.
1---2name: skilladam-optimize-33description: Optimize an existing SKILL.md from a usage-intent description with SkillAdam. Use when a user asks to test, improve, patch, review, validate, or iteratively optimize an Agent Skill, with optional selective hunk review.4---56# SkillAdam Optimize78Use the `skilladam_*` MCP tools when available. Otherwise invoke the equivalent9`skilladam-product` commands and parse their JSON output.1011## Build the task manifest1213For a new run, research and construct the task signal in the current host14session before calling SkillAdam. Do not start a nested agent or external task15generator solely for this step.16171. Read the complete target `SKILL.md` and the user's usage intent.182. Call `skilladam_discover_history` exactly once with `skill_path`, `intent`,19 and the durable `output_dir`. It automatically scans the current host's known20 local history formats, keeps only real user messages, redacts likely secrets21 and personal data, deduplicates them, and writes `history_discovery.json`.22 Review each candidate for actual relevance and evaluation feasibility. Turn23 a useful real request into a self-contained evaluation case by minimally24 normalizing it and, when necessary, embedding a small synthetic artifact that25 preserves the requested work. Record `metadata.history_transform` describing26 that normalization; never claim the synthetic artifact came from the user.27 Use source `local_history` and the candidate's exact returned `source_ref`;28 never invent a history reference. A completed search with zero accepted29 candidates is valid and must not be relabeled as a history-derived task.303. Reuse concrete tasks the user supplied. Extract tasks from the currently31 visible conversation only when they represent actual Skill usage; use source32 `conversation`, redact secrets and personal data, and keep a precise turn33 reference.344. When a recognized public benchmark would materially improve coverage, use the35 host's normal web/research tools to select relevant cases. Record the direct36 source URL and benchmark/license details in metadata. Do not invent provenance37 when no suitable source was found.385. Fill the remaining coverage from the Skill itself. Produce exactly39 `task_count` distinct tasks, covering at least two concise lowercase capability40 slugs and at least one `boundary`, `adversarial`, or `regression` case. Prefer41 realistic end-to-end requests over shallow paraphrases.426. Give every task a stable `task_id`, self-contained `prompt`, `capability`,43 `difficulty`, `source`, `source_ref`, and explicit `evaluation`. Allowed44 sources are `local_history`, `conversation`, `user_provided`,45 `public_benchmark`, and `skill_generated`, in that priority order when the46 source yields a genuinely useful task. Public benchmark references must be47 direct HTTP(S) URLs.487. Use deterministic `programmatic` or `reference` evaluation only when the task49 has one uniquely correct answer, such as a number, fixed string, explicit JSON50 structure, or exact set of fields. Open-ended natural-language tasks that51 allow semantically equivalent answers must use a `rubric_judge` rubric with52 weighted observable dimensions; never score the complete response with53 `exact` or `normalized_exact`. This includes generated messages, reviews,54 rewrites, summaries, recommendations, and analyses. Use `hybrid` only for55 complementary components. Every56 evaluation, including each hybrid component, must include concise57 `failure_feedback` with the actionable correction or evidence to use after a58 failure. Never omit an evaluation or ask SkillAdam to infer one. Correct a59 rejected manifest instead of weakening the requested count or evaluation goal.6061Pass `{"schema_version":"1","tasks":[...]}` in `task_manifest`. Task text must62not depend on files, tools, credentials, or context unavailable to the rollout63model.6465## Start or resume66671. Obtain the source `SKILL.md`, a durable workspace-local output directory,68 and the user's usage intent. Use a path such as `run/skilladam-optimize` under69 the current workspace; never use a host temporary or session-state directory.702. For a new run, call `skilladam_prepare` with the source `skill_path`, `intent`,71 durable `output_dir`, completed `task_manifest`, and `compact: true`; omit72 provider fields so SkillAdam reuses the platform's authenticated CLI. Pass provider configuration only for73 an explicit fixture or OpenAI-compatible override. Use74 `skilladam_prepare_for_review` instead only when the user explicitly requested75 confirmation or hunk selection before apply. Do not use the asynchronous76 `skilladam_start*` tools: the Claude adapter intentionally does not expose77 them because a non-interactive turn may stop polling before a worker reaches78 a terminal state.793. In default mode, call `skilladam_prepare` again with the same `output_dir` and80 `compact: true` while the workflow state is `ready` or `validating`, until the81 existing stopping policy returns `completed`. Each call resumes the durable82 checkpoint. If a call fails, report the exact error; do not shrink83 `task_count` or weaken evaluation settings as a workaround.8485## Review a proposal86871. Read `proposal.hunks` from the structured result. Preserve every `hunk_id`.882. Determine whether the user explicitly requested hunk review or confirmation89 before changes are applied. A general request to optimize, improve, patch, or90 modify the Skill does not opt in to review.913. By default, `skilladam_prepare` auto-accepts every proposed hunk before the92 call returns. Do not issue a second selection, omit or reject hunks, pause for93 confirmation, or override the gate based on your own assessment.944. Only after an explicit review opt-in, use `skilladam_prepare_for_review`,95 present every hunk's target, header, and operations in original order, and96 wait at `awaiting_review`. Prefer a native97 structured selection UI that can map decisions back to exact hunk IDs;98 otherwise ask the user for accepted IDs, accept all, or reject all.995. In review mode, never treat silence, timeout, disconnect, resume, or an100 unrelated positive comment as acceptance. An empty selection rejects all.1016. Submit exactly the selected IDs with a new, stable idempotency key. Do not use102 review results from a different proposal or infer a partial selection.103104## Validate and iterate1051061. Trust only `candidate_validation` whose digest matches the selected candidate.107 Never reuse validation for the full proposal after a partial selection. Each108 iteration's current Skill rollout and selected candidate validation must keep109 the exact ordered mini-batch IDs recorded in the session.1102. Report the gate decision and stop reason concisely. The service writes the111 source Skill only when the gate accepts the selected candidate. After the gate,112 the service updates EIT/Momentum from ordered trajectory feedback, the patch,113 candidate feedback, and the decision, then updates the adaptive edit budget.1143. Continue synchronous `skilladam_prepare` calls through `ready` and115 `validating` until the workflow reaches `completed`; the same tool resumes116 both states, so do not call `skilladam_continue`.1174. If the source changed during review, preserve the external edit and report the118 conflict; do not overwrite it.1195. On `completed`, report final quality only from `final_validation` whose scope120 is `heldout_terminal`. `baseline_validation` and `candidate_validation` are121 optimization mini-batch evidence and must never be described as final or122 held-out. If terminal evidence is unavailable, report that exact condition;123 do not substitute another metric. Never feed final held-out evidence into124 patch generation, hunk selection, an iteration gate, or Momentum.1256. Use the compact response's `iterations` entries for per-iteration results.126 Do not request a full status response merely to reconstruct the final report.127128Never edit, replace, or patch the source Skill with host file tools or shell129commands during an optimization session. This remains forbidden when a proposal130looks weak, the gate rejects it, or the iteration limit is reached. Only131SkillAdam may write a selected candidate after frozen validation passes the gate;132otherwise leave the source unchanged and report the session result.133134The host owns task research and manifest construction only. Do not reimplement135manifest validation, evaluation execution, patch application, gate logic,136Momentum, edit budgets, checkpoints, or stopping policy in the host adapter.137138## Claude Code structured review139140When the user explicitly requested confirmation or selective hunk review:1411421. After `skilladam_prepare_for_review` reaches `awaiting_review`, present every143 hunk in original order. For each hunk, show its stable `hunk_id`, target path,144 header, and complete operations inside a fenced `diff` block. Do not summarize145 or omit the diff before asking for a decision.1462. Use Claude Code's `AskUserQuestion` tool to collect an explicit accept/reject147 decision for each displayed hunk. Keep the stable `hunk_id` in each question148 and batch questions only when required by the host tool's current limit.1493. Map the answers back to exact hunk IDs and call150 `skilladam_submit_selection` once with the final accepted set. Cancellation,151 silence, timeout, or an incomplete answer leaves the session at152 `awaiting_review` and must never trigger default acceptance.