MCPInstall

skill-optimizer

Self-evolving skill optimization via SkillOpt-paper-grounded text-space optimizer.

Installs
152
Last 24h
+8
Trending rank
#9833
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/garrytan/gbrain --skill skill-optimizer
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads skill-optimizer automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Skill Optimizer

Self-evolving skill optimization. Treats SKILL.md as the trainable parameters of a frozen agent. Validation-gated, budget-capped, atomic-versioned.

Based on SkillOpt (arXiv 2605.23904, Microsoft Research, May 2026).

When to invoke this skill

The user wants to:

  • Improve an existing skill's execution quality against a benchmark
  • Bootstrap a benchmark file for a new skill
  • Re-tune a skill after switching target models

Iron Law

  • Validation gating is MANDATORY. Every candidate must clear median-of-3
    • epsilon=0.05 margin against the sel-set before SKILL.md gets rewritten.
  • Frontmatter mutation is FORBIDDEN. The optimizer only edits the body. Routing surface (triggers:, brain_first:) stays invariant.
  • Bundled skills require explicit opt-in AND an independent held-out set. Skills shipping with gbrain cannot be auto-mutated. To rewrite one in place the user passes BOTH --allow-mutate-bundled AND --held-out <path> with at least 5 benchmark-disjoint tasks; without the held-out set the run hard-refuses (exit 2). Drop --allow-mutate-bundled (or pass --no-mutate, the default for the dream-cycle phase) to write proposed.md for review instead — no held-out needed for review-only output.
  • Bootstrap output requires human review. Both --bootstrap-from-skill and --bootstrap-from-routing write a sentinel; you must review + STRENGTHEN the generated judges, delete the sentinel, and re-run with --bootstrap-reviewed before optimization can use the file.

The pipeline

gbrain skillopt <skill-name> [flags]
  │
  ├── Pre-flight gates
  │     ├── working tree clean (or --force)
  │     ├── benchmark valid + D_sel >= 5 (D17)
  │     ├── cost preflight (D3) — refuses over --max-cost-usd
  │     └── per-skill DB lock (D14)
  │
  ├── Baseline eval on D_sel (sets best_sel_score)
  │
  ├── for epoch in 1..N:
  │     for step in 1..steps_per_epoch:
  │       ├── forward pass: rollouts on D_train batch
  │       ├── backward pass: reflect × 2 (failures + successes per D7)
  │       ├── rank + clip via LR cosine schedule
  │       ├── apply edits (body-only per D5, tagged result per D9)
  │       ├── validation gate: median-of-3 + epsilon=0.05 (D12)
  │       └── if accept: commit via D8 history-intent-first
  │     │
  │     └── slow update (D6) if no improvement this epoch
  │
  └── Final test eval on D_test → run receipt

Where your skills live

Plugin-bundled skills ship as a read-only snapshot; you cannot write a benchmark or optimization artifacts next to them. Run skillopt against your own writable skills directory: pass --skills-dir <path> (gbrain skillopt X --skills-dir ~/my-project/skills), or run from a workspace that contains a skills/ tree and the CLI auto-detects it. Every skills/X/... path below refers to that writable directory (your own authored skills, skillify-scaffolded skills, or a brain-resident skillpack), not the plugin snapshot.

Starting a benchmark from the skill itself (the common case)

The user will NOT hand-write a benchmark, and you shouldn't start from a blank file either. When the user says "make skill X better" and skills/X/skillopt-benchmark.jsonl doesn't exist, generate a starter from the SKILL.md directly:

  1. Generate the starter. Run:
    gbrain skillopt X --bootstrap-from-skill
    
    One LLM call reads skills/X/SKILL.md, infers what the skill produces and what "good" looks like, and writes ~15 tasks (each with rule judges) to skills/X/skillopt-benchmark.jsonl plus a # BOOTSTRAP_PENDING_REVIEW sentinel. No routing-eval.jsonl is needed. Tune the count with --bootstrap-tasks N (max 50).
  2. Review AND STRENGTHEN the judges. This is YOUR job and it is load-bearing. The generated rule checks are weak drafts — the model tends to emit generic contains, loose max_chars, or invented headings. Read each task, fix soft checks, add the must-haves the skill actually requires (real section names, real length ceilings, min_citations where sources are expected, tool_called/tool_not_called for tools the skill genuinely uses). A thin benchmark optimizes for a thin definition of quality — do not rubber-stamp.
  3. Delete the sentinel line (# BOOTSTRAP_PENDING_REVIEW, the last line).
  4. Run the optimizer with --split 1:1:1:
    gbrain skillopt X --bootstrap-reviewed --split 1:1:1
    
    The 1:1:1 split is REQUIRED for a 15-task starter — the default 4:1:5 makes the validation set floor(15/10)=1, below the D_sel >= 5 floor, and the optimizer refuses with d_sel_too_small. (4:1:5 needs ~50 tasks.) Add --dry-run first to preview cost.

Benchmark line shape (what the generator writes, one per line):

{"task_id":"x-001","task":"<user prompt>","judge":{"kind":"rule","checks":[{"op":"max_chars","arg":1800},{"op":"contains","arg":"agenda"}]}}

Rule-check vocabulary you'll strengthen with: contains, regex, section_present, max_chars, min_citations, tool_called, tool_not_called. Rule judges are deterministic and free, but shallow for skills whose quality is sequencing, privacy, refusal boundaries, or file placement — for those, hand-add richer checks (or an llm judge) during review.

Fallback — author freehand. If the generated starter is poor (rare, but possible for very behavior-shaped skills), discard it and write the JSONL yourself: read the SKILL.md, write ~15 realistic tasks covering the boring middle, attach >=2 rule checks each, save to skills/X/skillopt-benchmark.jsonl, run with --split 1:1:1. The full walkthrough lives at https://github.com/garrytan/gbrain/blob/master/docs/tutorials/improving-skills-with-skillopt.md.

Decision tree

SituationAction
Skill has no benchmarkgbrain skillopt foo --bootstrap-from-skill → review + strengthen the judges → delete sentinel → gbrain skillopt foo --bootstrap-reviewed --split 1:1:1 (see section above)
Skill has a routing-eval.jsonl and you want a head startgbrain skillopt foo --bootstrap-from-routing → review the generated tasks → --bootstrap-reviewed (routing tasks test dispatch; tighten them into quality tasks before trusting)
Iterating on an existing skillgbrain skillopt foo --benchmark skills/foo/skillopt-benchmark.jsonl
Costly run, want previewAdd --dry-run
Bundled skill (skills/ in gbrain repo)Default writes proposed.md; to commit in place add --allow-mutate-bundled AND --held-out <path> (>=5 benchmark-disjoint tasks) — else it hard-refuses. Plugin installs cannot mutate bundled skills in place (the snapshot is read-only): copy the SKILL.md into your own skills dir to iterate, or stick with the default proposed.md review flow
Want to review changes before applyingAdd --no-mutate (writes proposed.md, no held-out needed)
Guard against benchmark overfittingAdd --held-out <path> — a candidate that beats the benchmark but regresses on the held-out set is refused
Mid-run crashgbrain skillopt foo --resume <run-id>

Output Format

When invoked, this skill produces:

  • Updated skills/<name>/SKILL.md (when mutation is allowed)
  • skills/<name>/skillopt/best.md — pointer copy of current best
  • skills/<name>/skillopt/versions/vNNNN_eN_sN.md — per-step snapshots
  • skills/<name>/skillopt/history.json — append-only run record
  • skills/<name>/skillopt/rejected.json — bounded LRU of rejected edits
  • ~/.gbrain/audit/skillopt-YYYY-Www.jsonl — ISO-week-rotated audit trail

When it fails

Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:

  • Hard refusals: dirty_tree (commit or stash skill edits first), d_sel_too_small (add benchmark tasks), a bundled skill without --allow-mutate-bundled plus --held-out (exit 2). Fix the input; never force past them.
  • The cost preflight refuses over --max-cost-usd, or no_pricing under a user cap: preview with --dry-run, then ask the user before raising the cap.
  • skill_candidate_invalid: the candidate changed protected frontmatter or produced an empty body; discard it and report.

Anti-Patterns

  • Don't bypass the validation gate. The median-of-3 + epsilon=0.05 is load-bearing; without it, the optimizer accepts noise as improvement.
  • Don't optimize bundled skills without --allow-mutate-bundled AND --held-out. They ship with gbrain and are load-bearing for downstream agents. In-place mutation requires both flags (held-out >=5 benchmark-disjoint tasks); without the held-out set the run hard-refuses and points you at proposed.md.
  • Don't use bootstrap output without strengthening it. Both --bootstrap-from-skill and --bootstrap-from-routing have the optimizer model invent success criteria — generic and weak by default. Review and tighten the judges before SkillOpt optimizes against them, or it trains the skill toward benchmark artifacts instead of real quality.
  • Don't skip --split 1:1:1 on a ~15-task starter. The default 4:1:5 split drops the validation set below the D_sel >= 5 floor and the run aborts with d_sel_too_small.

Contract

runSkillOpt(opts) returns:

{
  outcome: 'accepted' | 'no_improvement' | 'aborted' | 'errored',
  receipt: {
    run_id, skill_sha8, benchmark_sha8, models, cost,
    baseline_sel_score, best_sel_score,   // real measured baseline (no longer hardcoded 0)
    baseline_test_score, test_score,      // final held-out test-split eval
  },
  finalText: string,
  mutatedSkillFile: boolean,
  proposedPath?: string
}

Related skills

  • skillify — scaffolds a new skill (use BEFORE skillopt)
  • skillpack-check — audits skill conformance (item 13 surfaces skillopt status)
  • conventions/quality.md — output quality standards skillopt enforces via judges

FAQ

What does the skill-optimizer skill do?

Self-evolving skill optimization via SkillOpt-paper-grounded text-space optimizer.

How do I install skill-optimizer?

Run npx skills add https://github.com/garrytan/gbrain --skill skill-optimizer in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/skill-optimizer/ (personal) or .claude/skills/skill-optimizer/ (project).

Which AI agents can use skill-optimizer?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is skill-optimizer safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains skill-optimizer?

It is published by garrytan in garrytan/gbrain. It has 152 recorded installs.

More from garrytan/gbrain

View all →

brain-ops

garrytan/gbrain

Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking. Read this before any brain interaction.

402 installs

query

garrytan/gbrain

Answer questions using the brain's knowledge with 3-layer search, synthesis, and citation propagation. Use when the user asks a question, wants a lookup, or needs information from the brain.

325 installs

maintain

garrytan/gbrain

Brain health checks: back-link enforcement, citation audit, filing validation, stale info detection, orphan pages, and benchmarks. Use when asked to check brain health, run maintenance, or audit quality.

Security323 installs

idea-ingest

garrytan/gbrain

Ingest links, articles, tweets, and ideas into the brain. Fetch content, save to brain with analysis, credit the author (people page only when they pass the notability gate), and cross-link. Use when the user shares a link or says "read this", "save this", "think about this".

314 installs

enrich

garrytan/gbrain

Enrich brain pages with tiered enrichment protocol. Creates and updates person/company pages with compiled truth, timeline, and cross-links. Use when a new entity is mentioned or an existing page needs updating.

292 installs

meeting-ingestion

garrytan/gbrain

Ingest meeting transcripts from ANY meeting recorder into brain pages with attendee enrichment, entity propagation, and timeline merge. One unified pipeline: normalize the source into a standard transcript record, split multi-meeting recordings, resolve speakers by evidence, create the page, pass every surprising claim through the consistency check (transcript + brain + plausibility), enrich every entity, then run the verification checklist — substance AND sequence. A meeting is NOT fully ingested until the enrich skill has processed every entity AND the verification checklist passes, including the sequence verify (PASS or explicit user waive).

Popular education & science skills

View category →

teach

mattpocock/skills

Teach the user a new skill or concept, within this workspace.

Education & Science874K installs

scaffold-exercises

mattpocock/skills

Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.

Education & Science488.2K installs

paper-context-resolver

lllllllama/rigorpilot-skills

Rigor Paper Context helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacing README guidance by default.

Education & Science478.3K installs

caveman-learn

juliusbrussee/caveman

Act on a Caveman learn report - review the ranked token sinks, apply cost-lowering fixes with per-edit consent, and report what those fixes returned. Use when asked to lower an agent's token cost, what caveman has saved, to trim a heavy CLAUDE.md, or to offload re-pasted context into cavemem.

Education & Science107.9K installs

gsap-plugins

greensock/gsap-skills

Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.

Education & Science67.9K installs

teach-impeccable

pbakaus/impeccable

DEPRECATED: Use /impeccable teach instead. This command has been folded into the impeccable skill.