skill-optimizer

skill-optimizer is a skill for Claude Code from garrytan/gbrain. It costs 19 tokens per session (3,154 once invoked), scanned A, original, MIT.

A tool that improves an existing agent skill by testing alternative instructions against a benchmark. It changes only the skill's main text and requires validation before accepting a revision.

In plain words
What is it for?
Use it to tune a skill for a new model, improve its performance on a benchmark, or create a benchmark for a skill that has not been measured yet.
Why use it?
It helps improve a skill systematically while limiting changes that make its results worse or alter how the skill is selected.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter. Also seen: built for gbrain.

Part of the gbrain plugin — 46 skills, 2 plugins shipped together

Good fit Use it to tune a skill for a new model, improve its performance on a benchmark, or create a benchmark for a skill that has not been measured yet.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/garrytan/gbrain/skill-optimizer
About the project

GBrain is a memory and retrieval layer for AI agents that searches, connects, and synthesizes information from stored sources. It is used to give coding agents and autonomous agents access to knowledge beyond their current code, including shared company information with access controls. The catalogue add-ons help agents operate GBrain and connect it to agent workflows.

garrytan/gbrain · 33,897 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add garrytan/gbrain --skill skill-optimizer
Clone the repo
git clone --depth 1 https://github.com/garrytan/gbrain

Made for: Claude Code.

Or install gbrain, the plugin that ships this one along with the rest of its 46 skills, 2 plugins.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for skill-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/garrytan/gbrain/skill-optimizer/github.svg)](https://agentmods.dev/skills/garrytan/gbrain/skill-optimizer)
Your own site
<a href="https://agentmods.dev/skills/garrytan/gbrain/skill-optimizer"><img src="https://agentmods.dev/badge/skills/garrytan/gbrain/skill-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for skill-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/garrytan/gbrain/skill-optimizer"><img src="https://agentmods.dev/badge/skills/garrytan/gbrain/skill-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,154 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Snyk pass 7 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.03154
Opus 5.5 $0.00008 $0.01262
Sonnet 5.5 $0.00004 $0.00631
Haiku 4.5 $0.00002 $0.00315

Measured 3d ago against content hash dcd793cb9c96, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

skill-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugin/skills/skill-optimizer/SKILL.md · 224 lines

How it starts

The opening of the file, as written. The whole thing — 224 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

  • GUARD gating is MANDATORY. Promotion needs median-of-3 per-task gains minus 2x losses > 0.05, no mastered case (>=0.9) down >0.1, every [pinned] line verbatim and every [iff <condition>] scope kept.
  • Safety regressions are never adopted. A candidate that drops a confirm-before-send/spend/delete, untrusted-input, keep-secrets-out or owner-only rule, or adds the opposite, is refused (safety_regression).
  • 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)
  │
  ├── default: one rewrite of the body from a D_train forward pass + prior
  │     opt-memory.jsonl, accepted only through the GUARD + safety gates
  ├── Stage 2 (library `efficientStage2`, E1 eval): compress the promoted
  │     champion, never the seed; kept only if sel >= A* and shorter
  ├── --loop (deprecated, removed on or after 2026-12-03): 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)
  │       ├── GUARD + safety gates (D12 median-of-3)
  │       └── if accept: commit via D8 history-intent-first
  │     │
  │     └── slow update (D6) if no improvement this epoch
  │
  └── Final test eval on D_test → run receipt + opt-memory.jsonl rows

Read the full file on GitHub · 224 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago Changed · +12 lines dcd793cb9c96
  2. 1mo ago Changed 841f86883cbb
  3. 1mo ago Changed · +3 lines ad0a7f0d8cfc
  4. 1mo ago Changed d24665ee0e45
  5. 1mo ago Changed · +1 lines 1eeb4d46b475
  6. 2mo ago Changed · +8 lines bc5b4c705872
  7. 3mo ago First seen · 200 lines · 19 tokens per session scan A cbff060823ad

Subscribe to this mod's changes

skill-optimizer is a skill published in the GitHub repository garrytan/gbrain (33,897 stars, last pushed today), licensed MIT. It adds 19 tokens to every session and 3,154 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

skill-optimizer compared with skills from other repositories

skill-optimizer next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
skill-optimizergarrytan/gbrainSkill34ktodayMITA19Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill82ktodayMITA200Claude Code, Codex
imagegenopenai/codexSkill137ktodayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill102ktodayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill396ktodayMITA36Claude Code
free-llm-apismnfst/awesome-free-llm-apisSkill15ktodayCC0-1.0A113Claude Code, Codex
systematic-debuggingobra/superpowersSkill333k7d agoMITA21Claude Code