SWEClaude CodeAgent SkillsDeveloper ToolingShippedSeptember 2026

skill-optimizer: Pick the Right Claude Code Skill

A Claude Code plugin that searches your local skills, plugin marketplaces and 12 GitHub skill collections, picks the best skill for your task in a cheap Haiku subagent, asks before installing anything, does the task, and reports the tokens each phase used.

Solo build

12
GitHub skill collections searched
~520k → ~1k
tokens of skill data read vs returned
10.6k
tokens of search context kept out of the main session

01 / The problem

Why this was worth building

There are now thousands of Claude Code skills spread across official repos, community collections and plugin marketplaces. The right one for a task often exists, but finding it means knowing where to look, and pulling every catalog into the main session burns context you need for the actual work.

Installing a random SKILL.md from GitHub is also a trust problem. A skill is instructions your agent will follow, so it can carry download-and-run commands, credential reads or hooks just as easily as good advice.

02 / The build

How it works, and why it works that way

All discovery happens in one bundled script call: local skills, every registered marketplace ranked by install count, and 12 well-known GitHub collections, with each repo's file list cached for 24 hours. It prints a short ranked shortlist instead of raw catalogs.

Picking runs in a Haiku subagent, so the search results never enter the main session's context. It scores candidates on a weighted rubric (task fit ×4, depth ×2, trust ×2, friction, cost). Your best local skill is the baseline, and a remote skill has to beat it by at least five points to be recommended.

Nothing gets installed, enabled or run from the internet without approval. Remote picks are checked first for download-and-run commands, credential access, hooks and instructions to skip confirmations. You can install, use it once without installing, or stay with your local skill.

Architecture

pipeline
flow
/skill-optimizer <task>
  │
  ├─▶ main session            starts the selector, nothing else
  │      ▼
  ├─▶ selector subagent       Haiku
  │      ├── discover.sh       local + marketplaces + 12 GitHub collections
  │      ├── score             fit×4 · depth×2 · trust×2 · friction · cost
  │      └── safety check      remote picks only
  │      ▼
  ├─▶ approval                install · use once · stay local
  ├─▶ task                    done with the winning skill
  └─▶ usage.sh                per-phase tokens from the session log

03 / Outcome

What shipped

A typical run reads about 520k tokens of catalogs and skill files and hands back about 1k. In the example run (an Excel budget with the xlsx skill from anthropics/skills), the subagent kept about 10.6k tokens of search context out of the main session, an estimated 95.6k tokens not re-read over the rest of the run.

Every run ends with an exact per-phase token report, read from Claude Code's own session log, so the cost of the search is visible instead of assumed.

04 / Lessons

What I'd carry forward

A skill installed mid-session can't be called by name until Claude Code restarts. Rather than asking for a restart, skill-optimizer reads the new SKILL.md and follows it directly, so the task still gets done.

Skills built into Claude Code have no file on disk, so a search that only looks at the filesystem misses them. The main session now passes its own list of plausible skills to the selector.

Full technical breakdown (5 items)
  • One-call discovery across local skills, plugin marketplaces and 12 GitHub skill collections
  • Selection in a Haiku subagent so search results stay out of the main context
  • Weighted scoring rubric where remote skills must beat the best local skill by 5 points
  • Safety check on remote picks for download-and-run commands, credential access and hooks
  • Exact per-phase token report parsed from the Claude Code session log

Code sample

selector.md
markdown
| Criterion | Weight | What earns a high score |
|---|---|---|
| Task fit | 4 | Directly covers this deliverable and its requirements |
| Depth    | 2 | A concrete workflow with checks and examples |
| Trust    | 2 | local or official > 10k+ star collection > unknown |
| Friction | 1 | enabled > disabled > available; no API keys |
| Cost     | 1 | Focused and reasonably sized |

Rules:
- The best local or session skill is the **baseline**.
  A remote skill has to beat it by **at least 5 points**.
- If nothing scores at least 3 on task fit, the pick is `none`.

Built with

Claude CodeBashGitHub CLISubagentsMarkdown