SkillOpt: Train Agent Skills Like Neural Networks — Without Touching Model Weights
SkillOpt: Train Agent Skills Like Neural Networks — Without Touching Model Weights
AI agents today either use hand-crafted skills (slow to iterate), one-shot generated prompts (unreliable), or loosely controlled self-revision (no quality guarantees). None of these behave like a real optimizer — and none reliably improve over their starting point under feedback.
Microsoft SkillOpt changes this completely. It treats the skill document itself — a plain Markdown file — as the trainable state of a frozen agent, and optimizes it with the same discipline that makes weight-space deep learning reproducible. Rollouts, backward passes, gradient clipping, validation gates, learning rate schedulers — SkillOpt maps them all onto natural-language skill editing.
With 7,400+ GitHub stars in just over a month, SkillOpt is already integrated by gbrain, gbrain-evals, and darwin-skill. Across 52 evaluated (model, benchmark, harness) cells, it is best or tied-best on all of them — lifting GPT-5.5's average no-skill accuracy by +23.5 points in direct chat, +24.8 inside the Codex agentic loop, and +19.1 inside Claude Code.
It's open-source under MIT, Python 3.10+, and installs via pip. The deployed artifact is a compact best_skill.md (300–2,000 tokens) that adds zero inference-time overhead.
Why It's Trending
Four forces are driving SkillOpt's explosive growth:
-
The agent skill bottleneck is real. Everyone building AI agents (Claude Code, Codex, Copilot, OpenHands) needs high-quality skill prompts. Hand-crafting them is slow; one-shot generation is inconsistent. SkillOpt's optimization loop is the first systematic solution.
-
Zero inference-time overhead. Unlike RAG, fine-tuning, or tool-calling pipelines, SkillOpt's optimized skill is a plain text file. At deployment, it costs nothing — no extra model calls, no latency, no infrastructure.
-
Benchmarks don't lie. 52/52 best-or-tied across 6 benchmarks, 7 target models, and 3 execution harnesses. The paper shows SkillOpt improving performance on every single configuration tested, with gains that transfer across model scales and between Codex and Claude Code.
-
The SkillOpt-Sleep companion (June 2026 preview) brings the same discipline to your daily coding sessions — a nightly "sleep cycle" that mines your own Claude Code / Codex transcripts, replays recurring tasks, and consolidates validated skills offline.
Architecture
The training loop mirrors deep learning at every stage:
-
Skill Document (the trainable state): A Markdown file (300–2,000 tokens) that acts as the agent's system prompt. This is the only thing that changes during training — the underlying LLM weights stay frozen.
-
Frozen Target Model: The LLM that executes tasks using the current skill. SkillOpt supports OpenAI, Azure OpenAI, Claude, Qwen (local vLLM), and MiniMax — all as drop-in backends.
-
Optimizer Model: A separate, typically more capable model (GPT-5.5 by default) that analyzes failed trajectories and produces bounded add/delete/replace edits on the skill document. It never executes tasks — it only improves the skill.
The Training Loop
| Phase | Deep Learning Analogy | What Happens |
|---|---|---|
| 1. Rollout | Forward pass | Target model executes tasks using current skill → trajectories + scores |
| 2. Reflect | Backward pass | Optimizer analyzes failures → generates edit patches |
| 3. Aggregate | Gradient accumulation | Semantically similar patches merged to avoid redundant edits |
| 4. Select | Gradient clipping | Top-K edits selected by learning_rate parameter; scheduler decays over epochs (cosine, linear, or constant) |
| 5. Update | Parameter update | Bounded add/delete/replace edits applied to the skill document |
| 6. Gate | Validation check | Updated skill tested on held-out selection split; accepted only if score improves |
Epoch Boundary mechanisms prevent catastrophic forgetting:
-
Slow Update (Momentum): At epoch end, both the previous and current skills are rolled out on the same samples. Items are categorized as improved/regressed/persistent failure/stable success, and high-level guidance is injected into the skill document.
-
Meta Skill (Optimizer Memory): Cross-epoch strategy notes accumulated across the entire training run, provided as context during future reflection steps.
Prerequisites
- Python 3.10 or later
- An API key for at least one supported backend (Azure OpenAI, OpenAI, Anthropic Claude, or local Qwen via vLLM)
- At least 4GB RAM (16GB recommended for ALFWorld benchmarks)
Installation
Clone the repo and install:
git clone https://github.com/microsoft/SkillOpt.git
cd SkillOpt
pip install -e .
Optional extras:
# For Claude support
pip install -e ".[claude]"
# For local Qwen inference
pip install -e ".[qwen]"
# For the monitoring WebUI dashboard
pip install -e ".[webui]"
# ALFWorld benchmark
pip install -e ".[alfworld]"
Set up your API credentials:
cp .env.example .env
# Edit .env with your API keys
Configuration
SkillOpt uses YAML configs that inherit from a shared base. Here's the key configuration for a SearchQA experiment (configs/searchqa/default.yaml):
model:
backend: azure_openai
optimizer: gpt-5.5
target: gpt-5.5
train:
num_epochs: 4
batch_size: 40
optimizer:
learning_rate: 4 # max edits per step
lr_scheduler: cosine # learning rate decay schedule
use_slow_update: true # epoch boundary momentum
use_meta_skill: true # cross-epoch optimizer memory
evaluation:
use_gate: true # accept only if score improves
Running Your First Experiment
SkillOpt ships with 6 built-in benchmarks. Let's run the fastest one — SearchQA:
python scripts/train.py --config configs/searchqa/default.yaml
You'll see output like this:
[Step 1/8] Rollout: 20 items, 4 workers...
[Step 1/8] Score: 0.65 → Reflect...
[Step 1/8] 6 edit patches generated
[Step 1/8] Selected 4 edits (lr=8, cosine → 7.7)
[Step 1/8] Gate: val score 0.68 > 0.65 ✓ ACCEPT
[Step 2/8] ...
Training outputs are saved to outputs/<benchmark>/<run_id>/:
outputs/searchqa/2026-06-01_10-30-00/
├── steps/
│ ├── step_0001/
│ ├── step_0002/
│ └── ...
├── slow_update/
│ └── epoch_02/
├── meta_skill/
│ └── epoch_02/
├── skills/
│ └── step_0001.md
├── best_skill.md
└── history.json
After training completes, evaluate the best skill on the test split:
python scripts/eval_only.py \
--config configs/searchqa/default.yaml \
--skill outputs/searchqa/<run_id>/skills/best_skill.md
WebUI Dashboard
Prefer a visual interface? Launch the monitoring dashboard:
pip install -e ".[webui]"
python -m skillopt_webui.app
Then open http://localhost:7860 in your browser.
Adding a New Benchmark
Extending SkillOpt to your own task is straightforward (~200 lines):
- Data Loader — implement a
SplitDataLoadersubclass that loads train/val/test items - Rollout Helper — runs the target model on items under the current skill and scores predictions
- EnvAdapter — wires the loader + rollout into SkillOpt's lifecycle
- YAML Config — references your env name and training parameters
The skillopt/envs/_template/ directory provides a complete starting point.
Adding a New Model Backend
SkillOpt's pluggable backend system lets you add any LLM provider:
- Create
skillopt/model/your_backend.pyextendingModelBackend - Implement
_init_client()andasync generate() - Register in
skillopt/model/common.py+backend_config.py
See skillopt/model/qwen.py or skillopt/model/minimax.py for clean templates.
SkillOpt-Sleep: Nightly Self-Evolution
The June 2026 preview of SkillOpt-Sleep brings the same optimization discipline to your daily workflow:
- Mines transcripts from Claude Code, Codex, or Copilot sessions
- Identifies recurring tasks and replays them offline
- Consolidates validated skill improvements behind a held-out validation gate
- Staged proposals for your review each morning
Install for your agent:
| Platform | Install |
|---|---|
| Claude Code | /plugin marketplace add ./plugins/claude-code → /skillopt-sleep |
| Codex | bash plugins/codex/install.sh → skillopt-sleep skill |
| Copilot | Register plugins/copilot/mcp_server.py as an MCP server |
Results on the SearchQA benchmark show +3.1 to +4.5 percentage point lifts from experience replay alone, with gains rising monotonically with how much relevant past is recalled.
Verification Checklist
python -c "import skillopt; print('Ready!')"succeeds- Training logs show score improvements across steps and epochs
best_skill.mdis created in the output directory- The optimized skill improves held-out test scores vs. the initial seed
- Evaluate across at least 2 different target models to verify transfer
Resources
- GitHub: github.com/microsoft/SkillOpt
- Paper: arxiv.org/abs/2605.23904
- Project Page: microsoft.github.io/SkillOpt/
- Documentation: microsoft.github.io/SkillOpt/docs/guideline.html
- Demo Video: youtube.com/watch?v=JUBMDTCiM0M
- PyPI: pypi.org/project/skillopt
- gbrain Integration: github.com/garrytan/gbrain
- License: MIT