LeeJuOh avatar

skill-creator-pro

Create, test, and iteratively improve Claude Code skills with the official lean coaching loop, an eval harness for benchmarking with variance analysis, automated description-trigger optimization, and a user-started autonomous output-quality optimizer

version
2.1.0
GitHub stars
52

Install

/plugin install skill-creator-pro@claude-code-zero

Run it inside Claude Code after adding the marketplace with /plugin marketplace add LeeJuOh/claude-code-zero.

Contents

Discovered from source

Skills 2

Autoresearch for Skills

Bundled with skill-creator-pro. This skill reads design guidance from its sibling via ${CLAUDE_SKILL_DIR}/../skill-creator-pro/. The two skills ship together in the skill-creator-pro plugin and cannot be installed separately.

Most skills work about 70% of the time. The other 30% you get garbage. The fix isn't to rewrite the skill from scratch. It's to let an agent run it dozens of times, score every output, and tighten the prompt until that 30% disappears.

This skill adapts Andrej Karpathy's autoresearch methodology to Claude Code skills, enhanced with:

  • Reflection-driven mutation -- reads failed outputs to diagnose WHY they failed, then proposes targeted fixes. The difference between throwing darts blindfolded and throwing them with your eyes open.
  • Per-eval tracking -- tracks each eval separately so improving one at another's expense gets caught.
  • Structured archive -- session-surviving changelog that new sessions read to avoid repeating failed experiments.
  • Stuck detection -- recognizes when incremental mutations hit a wall and escalates strategy.

The Core Job

Take any existing skill, define what "good output" looks like as binary yes/no checks, then run an autonomous loop that:

  1. Generates outputs from the skill using test inputs
  2. Scores every output against the eval criteria
  3. Reflects on failed outputs -- reads the actual failures and diagnoses the root cause
  4. Mutates the skill prompt to fix the diagnosed issue
  5. Keeps mutations that improve the score, discards the rest
  6. Repeats until the score ceiling is hit or the user stops it

Output: An improved SKILL.md + results.json log + structured changelog.md + a live HTML dashboard.


Before Starting: Gather Context

STOP. Do not run any experiments until the fields below are confirmed with the user. Ask for any missing fields before proceeding.

  1. Target skill -- Which skill to optimize? (exact path to SKILL.md)
  2. Test inputs -- 3-5 different prompts/scenarios to test with. Variety matters -- pick inputs that cover different use cases so we don't overfit to one scenario.
  3. Runs per input (R) -- How many times each test input runs in one experiment. Default: 2 (3 inputs x 2 = 6 runs). More runs = more reliable scores but slower and costlier.
  4. Budget cap -- Optional. Max number of experiment cycles before stopping. Default: no cap (runs until you stop it).

Do NOT ask the user for eval criteria yet. Evals come from observing real failures, not from guessing upfront.


Step 1: Read the Skill and Learn Design Principles

Before changing anything, read and understand the target skill completely.

  1. Read the full SKILL.md file
  2. Read any files in references/ that the skill links to
  3. Identify the skill's core job, process steps, and output format
  4. Note any existing quality checks or anti-patterns already in the skill
  5. Read skill design principles to inform your mutations:
    • ${CLAUDE_SKILL_DIR}/../skill-creator-pro/SKILL.md -- the "Skill Writing Guide", "Progressive Disclosure", and "Description Optimization" sections cover gotchas, progressive disclosure, and description-as-trigger
    • If the skill uses platform features (hooks, allowed-tools, frontmatter) and something seems wrong, fetch https://code.claude.com/docs/llms.txt and the relevant page to verify against the latest spec

Do NOT skip this. You need to understand both the skill AND what makes skills work before you can improve it.


Step 2: Discovery Runs

Run the skill AS-IS for one full experiment: every test input, R times each. These outputs become the baseline in Step 5, so they must match what each later experiment runs. Do NOT score anything yet -- just collect outputs and observe.

  1. Create the workspace ${CLAUDE_PLUGIN_DATA}/autoresearch-[skill-name]/ -- never next to the target skill, where it would ship with the skill
  2. Back up the original SKILL.md there as SKILL.md.baseline
  3. Run the skill as described in "How to run the skill" below, saving to exp-0/
  4. Save every output in full -- you'll need these for reflection later. Don't summarize; keep the raw transcript.

While reviewing outputs, identify failure patterns:

  • What goes wrong consistently?
  • What works well that we should protect?
  • Are there formatting issues, missing steps, wrong defaults?
  • What would a user complain about?

The highest-signal content comes from real failure points, not theoretical checklists.

How to run the skill

Every run -- discovery and experiment alike -- goes to a fresh subagent, because this session knows the evals and would quietly write toward them, and a subagent that saw earlier runs would copy them. Give each subagent only the target skill's path, one test input, and the file to save its output to; never the eval criteria or other outputs. Launch all of one experiment's runs (every input x R) in the same turn so they finish together, and save them under exp-[N]/.


Step 3: Propose Evals

Based on the failure patterns you observed in discovery runs, propose 3-6 binary eval criteria to the user.

Format each eval as:

EVAL [number]: [Short name]
Question: [Yes/no question about the output]
Pass condition: [What "yes" looks like -- be specific]
Fail condition: [What triggers a "no"]

Present the proposed evals and explain which observed failures each one targets. The user confirms, adjusts, or adds their own.

Rules for good evals (the assertion schema lives in ${CLAUDE_SKILL_DIR}/../skill-creator-pro/references/schemas.md):

  • Binary only. Yes or no. No scales.
  • Specific enough that two different agents would agree on the verdict.
  • Not so narrow the skill can game the eval without actually improving.
  • 3-6 evals is the sweet spot.

Max score calculation:

max_score = [number of evals] x [number of test inputs] x R

IMPORTANT: Do not proceed to the experiment loop until the user confirms the eval criteria.


Step 4: Set Up Dashboard

Before running experiments, write results.json in the workspace (schema below), render the dashboard, and open it:

python3 ${CLAUDE_SKILL_DIR}/scripts/render_dashboard.py <workspace>/results.json <workspace>/dashboard.html
open <workspace>/dashboard.html

The script inlines the data into the page -- a page that fetches results.json is blocked from file:// -- and the page reloads every 10 seconds while status is "running". It shows the pass-rate progression, a colored bar per experiment, per-eval pass rates with trend arrows, and the experiment table.

Update results.json and re-run the script after every experiment so the dashboard stays current:

{
  "skill_name": "[name]",
  "status": "running",
  "current_experiment": 3,
  "baseline_score": 70.0,
  "best_score": 90.0,
  "consecutive_discards": 0,
  "experiments": [
    {
      "id": 0,
      "score": 14,
      "max_score": 20,
      "pass_rate": 70.0,
      "status": "baseline",
      "description": "original skill -- no changes",
      "reflection": null,
      "per_eval": [
        {"name": "Text legibility", "passed": 4, "total": 5},
        {"name": "Color contrast", "passed": 3, "total": 5}
      ]
    }
  ]
}

When the run finishes, set status to "complete" and render once more.


Step 5: Establish Baseline

Now score the discovery run outputs (from Step 2) against the confirmed evals. This is experiment #0.

  1. Score every output from discovery runs against every eval
  2. Record the baseline score per-eval (not just total) and update results.json
  3. Re-render the dashboard

IMPORTANT: After establishing baseline, confirm the score with the user before proceeding. If baseline is already 90%+, the skill may not need optimization -- ask if they want to continue.


Step 6: Run the Experiment Loop

This is the core autoresearch loop. Once started, run autonomously until stopped.

LOOP:

6.1 Reflect on Failures

This is where auto-optimize diverges from blind mutation. Instead of guessing what might help, you read the evidence.

  1. Collect failed outputs. From the most recent experiment, gather every output that failed at least one eval.

  2. Read the failures. Actually read the failing outputs -- not just the scores. Look for:

    • Common patterns across failures (same section wrong, same format broken, same step skipped)
    • Partial successes (output was 80% right -- what's the missing 20%?)
    • Regression patterns (something that used to pass now fails)
  3. Diagnose the root cause. Map each failure pattern back to a specific gap or ambiguity in the SKILL.md. Ask: "What instruction caused this, or what missing instruction allowed this?"

  4. Form a targeted hypothesis. Not "maybe I should add something about X" but a specific, falsifiable claim:

    Bad: "Adding a color instruction might help" Good: "Eval 3 fails because the skill says 'use appropriate colors' -- the model picks neon green 60% of the time. Replacing with a specific hex palette should fix this."

The hypothesis must be specific enough that after running the experiment, you can say whether it was right or wrong. If you can't articulate what you expect to change and why, you're guessing.

For detailed reflection techniques and examples, read ${CLAUDE_SKILL_DIR}/references/reflection-guide.md.

6.2 Mutate

Based on the reflection, make ONE targeted change to SKILL.md.

For mutation strategies, consult the "Skill Writing Guide", "Writing Patterns", and "Writing Style" sections of ${CLAUDE_SKILL_DIR}/../skill-creator-pro/SKILL.md. Key principle: one change at a time so you know what helped.

Bad mutations:

  • Rewriting the entire skill from scratch
  • Adding 10 new rules at once
  • Making the skill longer without a specific reason
  • Adding vague instructions like "make it better"
  • Adding ALL CAPS directives instead of explaining the reasoning

6.3 Run and Score

Run the mutated skill for one full experiment (every input x R, see "How to run the skill"), saving to exp-[N]/. Score every output against every eval. Record both total score and per-eval scores.

6.4 Keep or Discard

Before deciding, check two things:

Per-eval regression check. Compare each eval's pass count against the current best. If any single eval dropped by 2+ passes while the total score went up, that's the "balloon effect" -- one area improving while another quietly breaks. Flag it in the log and discard unless the overall gain clearly outweighs the regression.

Marginal improvement check. If the total score improved by less than 5% absolute (e.g., 70% to 73%), mark the experiment as "marginal" in the log. Still keep it, but note the uncertainty. If you accumulate 3+ marginal keeps in a row without a clear win, be suspicious -- the score may have drifted up through luck, not real improvement. Consider re-running the current SKILL.md against baseline to verify the cumulative gain is real.

Decision:

  • Score improved (not marginal) and no eval regressed -> KEEP. Log it. This is the new baseline.
  • Score improved but marginal -> KEEP with note. Log as "marginal". Watch for drift.
  • Score improved but an eval regressed badly -> DISCARD. The balloon effect isn't real improvement.
  • Score stayed the same or got worse -> DISCARD. Revert SKILL.md to previous version.

After deciding, update results.json and the structured archive.

6.5 Stuck Detection

Track consecutive discards. When the count hits thresholds, escalate:

3 consecutive discards -- soft reset:

  1. Re-read ALL failing outputs from the last 3 experiments
  2. Look for a pattern you missed -- are the failures all the same root cause, or different?
  3. Re-read the original SKILL.md baseline to check if you've drifted
  4. Try combining elements from two previously successful mutations

5 consecutive discards -- hard reset:

  1. Everything from above, plus:
  2. Re-read the sibling skill-creator-pro/SKILL.md design sections -- there may be a structural pattern you haven't tried
  3. Try the OPPOSITE of your recent approach (if you've been adding instructions, try removing them)
  4. Try a radical structural change (move content to references, add hooks, bundle scripts)
  5. If the skill uses platform features, fetch official docs to check for spec misalignment

8 consecutive discards -- plateau:

  • The skill may have hit its ceiling for this set of evals. Log the plateau, present results to the user, and ask whether to continue with different test inputs, adjusted evals, or stop.

Reset the consecutive discard counter whenever a mutation is kept.

Loop Control

Once the loop starts, keep going without pausing to ask the user -- they started a hands-off run and may be away, so a question just stalls it. Run until:

  • The user manually stops you
  • You hit the budget cap (if set)
  • You hit 95%+ pass rate for 3 consecutive experiments (diminishing returns)
  • You hit 8 consecutive discards (plateau -- present results and ask)

Step 7: Maintain the Structured Archive

The changelog is NOT just a flat log -- it's a structured document that future sessions (or fresh contexts) can read to continue where you left off.

Maintain changelog.md in the workspace with three sections -- Current Understanding (update after every kept mutation), Experiment Log (append after every experiment), and Ideas Backlog (add during reflection, prune after trying). Templates: ${CLAUDE_SKILL_DIR}/references/changelog-template.md.


Step 8: Deliver Results

When the user returns or the loop stops, present:

  1. Score summary: Baseline score -> Final score (percent improvement)
  2. Total experiments run: How many mutations were tried
  3. Keep rate: How many mutations were kept vs discarded
  4. Per-eval progression: How each eval improved from baseline to final
  5. Top 3 changes that helped most (from the changelog)
  6. Remaining failure patterns (what the skill still gets wrong)
  7. The improved SKILL.md (already saved in place)
  8. Workspace path (dashboard.html, results.json, changelog.md, SKILL.md.baseline, exp-*/)

The Test

A good autoresearch run:

  1. Started with a baseline -- never changed anything before measuring
  2. Used binary evals only -- no scales, no vibes
  3. Reflected on failures -- read actual outputs, diagnosed root causes, formed specific hypotheses
  4. Changed one thing at a time -- so you know what helped
  5. Tracked per-eval scores -- caught regressions in individual evals, not just totals
  6. Maintained a structured archive -- future sessions can continue without repeating failed experiments
  7. Detected plateaus -- escalated strategy instead of repeating the same failing approach
  8. Ran autonomously -- didn't stop to ask permission between experiments

If the skill "passes" all evals but the actual output quality hasn't improved -- the evals are bad, not the skill. Go back to Step 3 and write better evals.

Skill Creator Pro

A skill for creating new skills and iteratively improving them.

At a high level, the process of creating a skill goes like this:

  • Decide what you want the skill to do and roughly how it should do it
  • Write a draft of the skill
  • Create a few test prompts and run claude-with-access-to-the-skill on them
  • Help the user evaluate the results both qualitatively and quantitatively
    • While the runs happen in the background, draft some quantitative evals if there aren't any (if there are some, you can either use as is or modify if you feel something needs to change about them). Then explain them to the user (or if they already existed, explain the ones that already exist)
    • Use the ${CLAUDE_SKILL_DIR}/eval-viewer/generate_review.py script to show the user the results for them to look at, and also let them look at the quantitative metrics
  • Rewrite the skill based on feedback from the user's evaluation of the results (and also if there are any glaring flaws that become apparent from the quantitative benchmarks)
  • Repeat until you're satisfied
  • Expand the test set and try again at larger scale

Your job when using this skill is to figure out where the user is in this process and then jump in and help them progress through these stages. So for instance, maybe they're like "I want to make a skill for X". You can help narrow down what they mean, write a draft, write the test cases, figure out how they want to evaluate, run all the prompts, and repeat.

On the other hand, maybe they already have a draft of the skill. In this case you can go straight to the eval/iterate part of the loop.

Of course, you should always be flexible and if the user is like "I don't need to run a bunch of evaluations, just vibe with me", you can do that instead.

Then after the skill is done (but again, the order is flexible), you can also run the skill description improver, which we have a whole separate script for, to optimize the triggering of the skill.

Cool? Cool.

Communicating with the user

The skill creator is liable to be used by people across a wide range of familiarity with coding jargon. If you haven't heard (and how could you, it's only very recently that it started), there's a trend now where the power of Claude is inspiring plumbers to open up their terminals, parents and grandparents to google "how to install npm". On the other hand, the bulk of users are probably fairly computer-literate.

So please pay attention to context cues to understand how to phrase your communication! In the default case, just to give you some idea:

  • "evaluation" and "benchmark" are borderline, but OK
  • for "JSON" and "assertion" you want to see serious cues from the user that they know what those things are before using them without explaining them

It's OK to briefly explain terms if you're in doubt, and feel free to clarify terms with a short definition if you're unsure if the user will get it.


Creating a skill

Capture Intent

First, a gate worth a moment: is a skill even the right primitive for this? Knowledge Claude should carry every session belongs in CLAUDE.md; behavior that should run automatically on an event belongs in a hook (which can also propose edits back to a skill or CLAUDE.md, not only block). A skill fits on-demand expertise for a specialized multi-step task. If the honest answer is one of the first two, point the user there instead — a skill nobody triggers is wasted work.

Start by understanding the user's intent. The current conversation might already contain a workflow the user wants to capture (e.g., they say "turn this into a skill"). If so, extract answers from the conversation history first — the tools used, the sequence of steps, corrections the user made, input/output formats observed. The user may need to fill the gaps, and should confirm before proceeding to the next step.

  1. What should this skill enable Claude to do?
  2. When should this skill trigger? (what user phrases/contexts)
  3. What's the expected output format?
  4. Should we set up test cases to verify the skill works? Skills with objectively verifiable outputs (file transforms, data extraction, code generation, fixed workflow steps) benefit from test cases. Skills with subjective outputs (writing style, art) often don't need them. Suggest the appropriate default based on the skill type, but let the user decide.

Interview and Research

Proactively ask questions about edge cases, input/output formats, example files, success criteria, and dependencies. Wait to write test prompts until you've got this part ironed out.

Check available MCPs - if useful for research (searching docs, finding similar skills, looking up best practices), research in parallel via subagents if available, otherwise inline. Come prepared with context to reduce burden on the user.

Write the SKILL.md

Based on the user interview, fill in these components:

  • name: Skill identifier
  • description: When to trigger, what it does. This is the primary triggering mechanism - include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Note: currently Claude has a tendency to "undertrigger" skills -- to not use them when they'd be useful. To combat this, please make the skill descriptions a little bit "pushy". So for instance, instead of "How to build a simple fast dashboard to display internal Anthropic data.", you might write "How to build a simple fast dashboard to display internal Anthropic data. Make sure to use this skill whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any kind of company data, even if they don't explicitly ask for a 'dashboard.'"
  • compatibility: Required tools, dependencies (optional, rarely needed)
  • the rest of the skill :)

Skill Writing Guide

Anatomy of a Skill
skill-name/
├── SKILL.md (required)
│   ├── YAML frontmatter (name, description required)
│   └── Markdown instructions
└── Bundled Resources (optional)
    ├── scripts/    - Executable code for deterministic/repetitive tasks
    ├── references/ - Docs loaded into context as needed
    └── assets/     - Files used in output (templates, icons, fonts)

Referencing bundled files and writing output. Point at a skill's own bundled files with ${CLAUDE_SKILL_DIR} (e.g. ${CLAUDE_SKILL_DIR}/references/api.md) so paths resolve wherever the plugin is installed. Never write output, config, or a workspace inside the skill folder. In a plugin skill, write it to ${CLAUDE_PLUGIN_DATA} — it survives plugin updates, whereas the plugin's own directory is wiped on update. That variable is substituted only in plugin skills, so a personal or project skill needs a path outside its folder that the user chooses. For the full list of frontmatter fields and string substitutions, fetch skills.md from the official docs on demand (https://code.claude.com/docs/llms.txt → the relevant page) rather than relying on a frozen copy.

Progressive Disclosure

Skills use a three-level loading system:

  1. Metadata (name + description) - Always in context (~100 words)
  2. SKILL.md body - In context whenever skill triggers (<500 lines ideal)
  3. Bundled resources - As needed (unlimited, scripts can execute without loading)

These word counts are approximate and you can feel free to go longer if needed.

Key patterns:

  • Keep SKILL.md under 500 lines; if you're approaching this limit, add an additional layer of hierarchy along with clear pointers about where the model using the skill should go next to follow up.
  • Reference files clearly from SKILL.md with guidance on when to read them
  • For large reference files (>300 lines), include a table of contents

Domain organization: When a skill supports multiple domains/frameworks, organize by variant:

cloud-deploy/
├── SKILL.md (workflow + selection)
└── references/
    ├── aws.md
    ├── gcp.md
    └── azure.md

Claude reads only the relevant reference file.

Principle of Lack of Surprise

This goes without saying, but skills must not contain malware, exploit code, or any content that could compromise system security. A skill's contents should not surprise the user in their intent if described. Don't go along with requests to create misleading skills or skills designed to facilitate unauthorized access, data exfiltration, or other malicious activities. Things like a "roleplay as an XYZ" are OK though.

Writing Patterns

Prefer using the imperative form in instructions.

Defining output formats - You can do it like this:

## Report structure
ALWAYS use this exact template:
# [Title]
## Executive summary
## Key findings
## Recommendations

Examples pattern - It's useful to include examples. You can format them like this (but if "Input" and "Output" are in the examples you might want to deviate a little):

## Commit message format
**Example 1:**
Input: Added user authentication with JWT tokens
Output: feat(auth): implement JWT-based authentication

Writing Style

Try to explain to the model why things are important in lieu of heavy-handed musty MUSTs. Use theory of mind and try to make the skill general and not super-narrow to specific examples. Start by writing a draft and then look at it with fresh eyes and improve it.

Resist over-designing that first draft. It's tempting to anticipate every edge case and bundle scripts and reference files before a single test run — but you don't yet know which parts the model actually needs, and guessing wrong just builds bloat you'll later have to cut. Write the smallest skill that could plausibly work, then let the test cases tell you where to invest. The eval loop below is how you find out, cheaply.

Test Cases

After writing the skill draft, come up with 2-3 realistic test prompts — the kind of thing a real user would actually say. Share them with the user: [you don't have to use this exact language] "Here are a few test cases I'd like to try. Do these look right, or do you want to add more?" Then run them.

Save test cases to evals/evals.json. Don't write assertions yet — just the prompts. You'll draft assertions in the next step while the runs are in progress.

{
  "skill_name": "example-skill",
  "evals": [
    {
      "id": 1,
      "prompt": "User's task prompt",
      "expected_output": "Description of expected result",
      "files": []
    }
  ]
}

See ${CLAUDE_SKILL_DIR}/references/schemas.md for the full schema (including the assertions field, which you'll add later).

If the skill ships in a plugin, also mention claude plugin eval (Claude Code v2.1.269+): it runs each case in an isolated session with and without the plugin and can gate CI. Its case files and evals/evals.json aren't interchangeable, so pick one per suite — this loop for iterating in conversation, claude plugin eval for regression checks.

Running and evaluating test cases

This section is one continuous sequence — don't stop partway through. Do NOT use /skill-test or any other testing skill.

Put results in a workspace under ${CLAUDE_PLUGIN_DATA}/ (it survives plugin updates; the skill's own directory does not). Within the workspace, organize results by iteration (iteration-1/, iteration-2/, etc.) and within that, each test case gets a directory (eval-0/, eval-1/, etc.). Don't create all of this upfront — just create directories as you go.

Step 1: Spawn all runs (with-skill AND baseline) in the same turn

For each test case, spawn two subagents in the same turn — one with the skill, one without. This is important: don't spawn the with-skill runs first and then come back for baselines later. Launch everything at once so it all finishes around the same time.

Create that eval's output directories before you spawn its subagents. Two agents launching into a directory that doesn't exist yet will both try to create it and can race — losing or clobbering each other's outputs. mkdir -p the with_skill/ and baseline paths first, then launch.

With-skill run:

Execute this task:
- Skill path: <path-to-skill>
- Task: <eval prompt>
- Input files: <eval files if any, or "none">
- Save outputs to: <workspace>/iteration-<N>/eval-<ID>/with_skill/outputs/
- Outputs to save: <what the user cares about — e.g., "the .docx file", "the final CSV">

Baseline run (same prompt, but the baseline depends on context):

  • Creating a new skill: no skill at all. Same prompt, no skill path, save to without_skill/outputs/.
  • Improving an existing skill: the old version. Before editing, snapshot the skill (cp -r <skill-path> <workspace>/skill-snapshot/), then point the baseline subagent at the snapshot. Save to old_skill/outputs/. Snapshotting first matters — once you edit in place, the "before" is gone and there's nothing to compare against.

Write an eval_metadata.json for each test case (assertions can be empty for now). Give each eval a descriptive name based on what it's testing — not just "eval-0". Use this name for the directory too. If this iteration uses new or modified eval prompts, create these files for each new eval directory — don't assume they carry over from previous iterations.

{
  "eval_id": 0,
  "eval_name": "descriptive-name-here",
  "prompt": "The user's task prompt",
  "assertions": []
}

Step 2: While runs are in progress, draft assertions

Don't just wait for the runs to finish — you can use this time productively. Draft quantitative assertions for each test case and explain them to the user. If assertions already exist in evals/evals.json, review them and explain what they check.

Good assertions are objectively verifiable and have descriptive names — they should read clearly in the benchmark viewer so someone glancing at the results immediately understands what each one checks. Subjective skills (writing style, design quality) are better evaluated qualitatively — don't force assertions onto things that need human judgment.

Update the eval_metadata.json files and evals/evals.json with the assertions once drafted. Also explain to the user what they'll see in the viewer — both the qualitative outputs and the quantitative benchmark.

Step 3: As runs complete, capture timing data

When each subagent task completes, you receive a notification containing total_tokens and duration_ms. Save this data immediately to timing.json in the run directory:

{
  "total_tokens": 84852,
  "duration_ms": 23332,
  "total_duration_seconds": 23.3
}

This is the only opportunity to capture this data — it comes through the task notification and isn't persisted elsewhere. Process each notification as it arrives rather than trying to batch them.

Step 4: Grade, aggregate, and launch the viewer

Once all runs are done:

  1. Grade each run — spawn a grader subagent (or grade inline) that reads ${CLAUDE_SKILL_DIR}/agents/grader.md and evaluates each assertion against the outputs. Save results to grading.json in each run directory. The grading.json expectations array must use the fields text, passed, and evidence (not name/met/details or other variants) — the viewer depends on these exact field names. For assertions that can be checked programmatically, write and run a script rather than eyeballing it — scripts are faster, more reliable, and can be reused across iterations.

  2. Aggregate into benchmark — run the aggregation script from ${CLAUDE_SKILL_DIR}:

    python -m scripts.aggregate_benchmark <workspace>/iteration-N --skill-name <name>
    

    This produces benchmark.json and benchmark.md with pass_rate, time, and tokens for each configuration, with mean ± stddev and the delta. If generating benchmark.json manually, see ${CLAUDE_SKILL_DIR}/references/schemas.md for the exact schema the viewer expects. Put each with_skill version before its baseline counterpart.

  3. Do an analyst pass — read the benchmark data and surface patterns the aggregate stats might hide. See ${CLAUDE_SKILL_DIR}/agents/analyzer.md (the "Analyzing Benchmark Results" section) for what to look for — things like assertions that always pass regardless of skill (non-discriminating), high-variance evals (possibly flaky), and time/token tradeoffs.

  4. Launch the viewer with both qualitative outputs and quantitative data:

    nohup python ${CLAUDE_SKILL_DIR}/eval-viewer/generate_review.py \
      <workspace>/iteration-N \
      --skill-name "my-skill" \
      --benchmark <workspace>/iteration-N/benchmark.json \
      > /dev/null 2>&1 &
    echo "viewer pid: $!"
    

    For iteration 2+, also pass --previous-workspace <workspace>/iteration-<N-1>.

    Cowork / headless environments: If webbrowser.open() is not available or the environment has no display, use --static <output_path> to write a standalone HTML file instead of starting a server. Feedback will be downloaded as a feedback.json file when the user clicks "Submit All Reviews". After download, copy feedback.json into the workspace directory for the next iteration to pick up.

Note: please use generate_review.py to create the viewer; there's no need to write custom HTML.

  1. Tell the user something like: "I've opened the results in your browser. There are two tabs — 'Outputs' lets you click through each test case and leave feedback, 'Benchmark' shows the quantitative comparison. When you're done, come back here and let me know."

What the user sees in the viewer

The "Outputs" tab shows one test case at a time:

  • Prompt: the task that was given
  • Output: the files the skill produced, rendered inline where possible
  • Previous Output (iteration 2+): collapsed section showing last iteration's output
  • Formal Grades (if grading was run): collapsed section showing assertion pass/fail
  • Feedback: a textbox that auto-saves as they type
  • Previous Feedback (iteration 2+): their comments from last time, shown below the textbox

The "Benchmark" tab shows the stats summary: pass rates, timing, and token usage for each configuration, with per-eval breakdowns and analyst observations.

Navigation is via prev/next buttons or arrow keys. When done, they click "Submit All Reviews" which saves all feedback to feedback.json.

Step 5: Read the feedback

When the user tells you they're done, read feedback.json:

{
  "reviews": [
    {"run_id": "eval-0-with_skill", "feedback": "the chart is missing axis labels", "timestamp": "..."},
    {"run_id": "eval-1-with_skill", "feedback": "", "timestamp": "..."},
    {"run_id": "eval-2-with_skill", "feedback": "perfect, love this", "timestamp": "..."}
  ],
  "status": "complete"
}

Empty feedback means the user thought it was fine. Focus your improvements on the test cases where the user had specific complaints.

Kill the viewer server when you're done with it, using the pid printed at launch (shell variables don't carry over between commands):

kill <viewer-pid> 2>/dev/null

Improving the skill

This is the heart of the loop. You've run the test cases, the user has reviewed the results, and now you need to make the skill better based on their feedback.

How to think about improvements

  1. Generalize from the feedback. The big picture thing that's happening here is that we're trying to create skills that can be used a million times (maybe literally, maybe even more who knows) across many different prompts. Here you and the user are iterating on only a few examples over and over again because it helps move faster. The user knows these examples in and out and it's quick for them to assess new outputs. But if the skill you and the user are codeveloping works only for those examples, it's useless. Rather than put in fiddly overfitty changes, or oppressively constrictive MUSTs, if there's some stubborn issue, you might try branching out and using different metaphors, or recommending different patterns of working. It's relatively cheap to try and maybe you'll land on something great.

  2. Keep the prompt lean. Remove things that aren't pulling their weight. Make sure to read the transcripts, not just the final outputs — if it looks like the skill is making the model waste a bunch of time doing things that are unproductive, you can try getting rid of the parts of the skill that are making it do that and seeing what happens. Bloat isn't neutral — low-signal lines dilute the ones that matter and can lower the pass rate; when an eval keeps failing, try compressing the how-to into one principle-with-example instead of adding another rule.

  3. Explain the why. Try hard to explain the why behind everything you're asking the model to do. Today's LLMs are smart. They have good theory of mind and when given a good harness can go beyond rote instructions and really make things happen. Even if the feedback from the user is terse or frustrated, try to actually understand the task and why the user is writing what they wrote, and what they actually wrote, and then transmit this understanding into the instructions. If you find yourself writing ALWAYS or NEVER in all caps, or using super rigid structures, that's a yellow flag — if possible, reframe and explain the reasoning so that the model understands why the thing you're asking for is important. That's a more humane, powerful, and effective approach.

  4. Look for repeated work across test cases. Read the transcripts from the test runs and notice if the subagents all independently wrote similar helper scripts or took the same multi-step approach to something. If all 3 test cases resulted in the subagent writing a create_docx.py or a build_chart.py, that's a strong signal the skill should bundle that script. Write it once, put it in scripts/, and tell the skill to use it. This saves every future invocation from reinventing the wheel.

This task is pretty important (we are trying to create billions a year in economic value here!) and your thinking time is not the blocker; take your time and really mull things over. I'd suggest writing a draft revision and then looking at it anew and making improvements. Really do your best to get into the head of the user and understand what they want and need.

The iteration loop

After improving the skill:

  1. Apply your improvements to the skill
  2. Rerun all test cases into a new iteration-<N+1>/ directory, including baseline runs. Always bump the number — rerunning into the previous iteration silently overwrites the baseline you needed for comparison. If you're creating a new skill, the baseline is always without_skill (no skill) — that stays the same across iterations. If you're improving an existing skill, use your judgment on what makes sense as the baseline: the original version the user came in with, or the previous iteration.
  3. Launch the reviewer with --previous-workspace pointing at the previous iteration
  4. Wait for the user to review and tell you they're done
  5. Read the new feedback, improve again, repeat

Keep going until:

  • The user says they're happy
  • The feedback is all empty (everything looks good)
  • You're not making meaningful progress

Retire, don't just patch

Skills age. A skill written to work around a model limitation becomes pure overhead once a newer model handles that case natively — and a skill that still fires but no longer earns its context is worse than no skill at all. When you revisit one (especially after a major model update), be willing to trim or retire it, not only extend it. Fewer, sharper skills beat a drawer full of stale ones.

Autonomous optimization (optional)

If the user wants a hands-off pass instead of the manual review loop, the auto-optimize sub-skill runs the skill repeatedly, scores outputs against binary evals, mutates the prompt, and keeps improvements. It works best once a manual iteration already shows a with-skill pass rate around 0.7+; below that, the skill usually needs a structural rethink the manual loop is better at. Only the user can start it: tell them to type /skill-creator-pro:auto-optimize, and don't fold its mechanics in here.


Advanced: Blind comparison

For situations where you want a more rigorous comparison between two versions of a skill (e.g., the user asks "is the new version actually better?"), there's a blind comparison system. Read ${CLAUDE_SKILL_DIR}/agents/comparator.md and ${CLAUDE_SKILL_DIR}/agents/analyzer.md for the details. The basic idea is: give two outputs to an independent agent without telling it which is which, and let it judge quality. Then analyze why the winner won.

This is optional, requires subagents, and most users won't need it. The human review loop is usually sufficient.


Description Optimization

The description field in SKILL.md frontmatter is the primary mechanism that determines whether Claude invokes a skill. After creating or improving a skill, offer to optimize the description for better triggering accuracy.

Step 1: Generate trigger eval queries

Create 20 eval queries — a mix of should-trigger and should-not-trigger. Save as JSON:

[
  {"query": "the user prompt", "should_trigger": true},
  {"query": "another prompt", "should_trigger": false}
]

The queries must be realistic and something a Claude Code or Claude.ai user would actually type. Not abstract requests, but requests that are concrete and specific and have a good amount of detail. For instance, file paths, personal context about the user's job or situation, column names and values, company names, URLs. A little bit of backstory. Some might be in lowercase or contain abbreviations or typos or casual speech. Use a mix of different lengths, and focus on edge cases rather than making them clear-cut (the user will get a chance to sign off on them).

Bad: "Format this data", "Extract text from PDF", "Create a chart"

Good: "ok so my boss just sent me this xlsx file (its in my downloads, called something like 'Q4 sales final FINAL v2.xlsx') and she wants me to add a column that shows the profit margin as a percentage. The revenue is in column C and costs are in column D i think"

For the should-trigger queries (8-10), think about coverage. You want different phrasings of the same intent — some formal, some casual. Include cases where the user doesn't explicitly name the skill or file type but clearly needs it. Throw in some uncommon use cases and cases where this skill competes with another but should win.

For the should-not-trigger queries (8-10), the most valuable ones are the near-misses — queries that share keywords or concepts with the skill but actually need something different. Think adjacent domains, ambiguous phrasing where a naive keyword match would trigger but shouldn't, and cases where the query touches on something the skill does but in a context where another tool is more appropriate.

The key thing to avoid: don't make should-not-trigger queries obviously irrelevant. "Write a fibonacci function" as a negative test for a PDF skill is too easy — it doesn't test anything. The negative cases should be genuinely tricky.

Step 2: Review with user

Present the eval set to the user for review using the HTML template:

  1. Read the template from ${CLAUDE_SKILL_DIR}/assets/eval_review.html
  2. Replace the placeholders:
    • __EVAL_DATA_PLACEHOLDER__ → the JSON array of eval items (no quotes around it — it's a JS variable assignment)
    • __SKILL_NAME_PLACEHOLDER__ → the skill's name
    • __SKILL_DESCRIPTION_PLACEHOLDER__ → the skill's current description
  3. Write to a temp file (e.g., /tmp/eval_review_<skill-name>.html) and open it: open /tmp/eval_review_<skill-name>.html
  4. The user can edit queries, toggle should-trigger, add/remove entries, then click "Export Eval Set"
  5. The file downloads to ~/Downloads/eval_set.json — check the Downloads folder for the most recent version in case there are multiple (e.g., eval_set (1).json)

This step matters — bad eval queries lead to bad descriptions.

Step 3: Run the optimization loop

Tell the user: "This will take some time — I'll run the optimization loop in the background and check on it periodically."

Save the eval set to the workspace, then run in the background from ${CLAUDE_SKILL_DIR}:

python -m scripts.run_loop \
  --eval-set <path-to-trigger-eval.json> \
  --skill-path <path-to-skill> \
  --model <model-id-powering-this-session> \
  --max-iterations 5 \
  --verbose

Use the model ID from your system prompt (the one powering the current session) so the triggering test matches what the user actually experiences.

While it runs, periodically tail the output to give the user updates on which iteration it's on and what the scores look like.

This handles the full optimization loop automatically. It splits the eval set into 60% train and 40% held-out test, evaluates the current description (running each query 3 times to get a reliable trigger rate), then calls Claude to propose improvements based on what failed. It re-evaluates each new description on both train and test, iterating up to 5 times. When it's done, it opens an HTML report in the browser showing the results per iteration and returns JSON with best_description — selected by test score rather than train score to avoid overfitting.

How skill triggering works

Understanding the triggering mechanism helps design better eval queries. Skills appear in Claude's available_skills list with their name + description, and Claude decides whether to consult a skill based on that description. The important thing to know is that Claude only consults skills for tasks it can't easily handle on its own — simple, one-step queries like "read this PDF" may not trigger a skill even if the description matches perfectly, because Claude can handle them directly with basic tools. Complex, multi-step, or specialized queries reliably trigger skills when the description matches.

This means your eval queries should be substantive enough that Claude would actually benefit from consulting a skill. Simple queries like "read file X" are poor test cases — they won't trigger skills regardless of description quality.

Step 4: Apply the result

Take best_description from the JSON output and update the skill's SKILL.md frontmatter. Show the user before/after and report the scores.


Pre-ship platform sanity check

A handful of platform-level traps silently break a skill that otherwise looks perfect — the validator won't always catch them. Give the frontmatter a quick once-over before shipping:

  • Reserved or boolean-looking names. Claude Code skips a skill folder named synced or anthropic-skills; on the API and Claude.ai, a name can't contain claude or anthropic. YAML reads bare on, off, yes, no, true, false as booleans. Any of these breaks loading — rename.
  • Unquoted colons in description. A colon-then-space inside an unquoted description is parsed as a YAML mapping and corrupts the frontmatter. Quote the string or rephrase.
  • Name collisions. A personal or project skill named like a built-in or bundled command (/usage, /code-review) replaces that command but not its aliases, and personal beats project. Plugin skills are namespaced (/plugin:skill), so they never collide. Rename unless replacing the built-in is the point.
  • Description length budget. Descriptions have a maximum character budget; overrun and it gets truncated, which can quietly kill triggering. Don't trust a memorized number — fetch the current limit from skills.md in the official docs.

Package and Present (only if present_files tool is available)

Check whether you have access to the present_files tool. If you don't, skip this step. If you do, package the skill from ${CLAUDE_SKILL_DIR} and present the .skill file to the user:

python -m scripts.package_skill <absolute/path/to/skill-folder>

After packaging, direct the user to the resulting .skill file path so they can install it.


Claude.ai-specific instructions

In Claude.ai there are no subagents, so test runs, benchmarking, description optimization, and packaging change. Read ${CLAUDE_SKILL_DIR}/references/claude-ai.md when you're running there, or when updating an installed skill rather than creating one.


Cowork-Specific Instructions

If you're in Cowork, the main things to know are:

  • You have subagents, so the main workflow (spawn test cases in parallel, run baselines, grade, etc.) all works. (However, if you run into severe problems with timeouts, it's OK to run the test prompts in series rather than parallel.)
  • You don't have a browser or display, so when generating the eval viewer, use --static <output_path> to write a standalone HTML file instead of starting a server. Then proffer a link that the user can click to open the HTML in their browser.
  • For whatever reason, the Cowork setup seems to disincline Claude from generating the eval viewer after running the tests, so just to reiterate: whether you're in Cowork or in Claude Code, after running tests, you should always generate the eval viewer for the human to look at examples before revising the skill yourself and trying to make corrections, using generate_review.py (not writing your own boutique html code). Sorry in advance but I'm gonna go all caps here: GENERATE THE EVAL VIEWER BEFORE evaluating inputs yourself. You want to get them in front of the human ASAP!
  • Feedback works differently: since there's no running server, the viewer's "Submit All Reviews" button will download feedback.json as a file. You can then read it from there (you may have to request access first).
  • Packaging works — package_skill.py just needs Python and a filesystem.
  • Description optimization (run_loop.py / run_eval.py) should work in Cowork just fine since it uses claude -p via subprocess, not a browser, but please save it until you've fully finished making the skill and the user agrees it's in good shape.
  • Updating an existing skill: The user might be asking you to update an existing skill, not create a new one. Follow the update guidance in ${CLAUDE_SKILL_DIR}/references/claude-ai.md.

Reference files

The agents/ directory contains instructions for specialized subagents. Read them when you need to spawn the relevant subagent.

  • ${CLAUDE_SKILL_DIR}/agents/grader.md — How to evaluate assertions against outputs
  • ${CLAUDE_SKILL_DIR}/agents/comparator.md — How to do blind A/B comparison between two outputs
  • ${CLAUDE_SKILL_DIR}/agents/analyzer.md — How to analyze why one version beat another

The references/ directory has additional documentation:

  • ${CLAUDE_SKILL_DIR}/references/schemas.md — JSON structures for evals.json, grading.json, etc.

Platform spec (which frontmatter fields exist, hook syntax, manifest schema) is deliberately not bundled — it changes faster than a frozen copy can track. Fetch the current spec from the official docs on demand: start at https://code.claude.com/docs/llms.txt for the index, then pull the relevant page (skills.md, hooks.md, plugins-reference.md, sub-agents.md).


Repeating one more time the core loop here for emphasis:

  • Figure out what the skill is about
  • Draft or edit the skill
  • Run claude-with-access-to-the-skill on test prompts
  • With the user, evaluate the outputs:
    • Create benchmark.json and run ${CLAUDE_SKILL_DIR}/eval-viewer/generate_review.py to help the user review them
    • Run quantitative evals
  • Repeat until you and the user are satisfied
  • Package the final skill and return it to the user.

Please add steps to your TodoList, if you have such a thing, to make sure you don't forget.

Good luck!

Sponsors

Details

Marketplace
LeeJuOh/claude-code-zero
Source
plugins/skill-creator-pro
Category
Community

More from LeeJuOh/claude-code-zero

All 12