opencodeplugginprogram
Measure the per-step token cost of agent skills.
Your skills are quietly taxing every single step. 29 skills = ~3,074 tokens burned before the model even sees your code. English · 简体中文 · Changelog · Security · Full reference Every agent skill with a description is injected into the system prompt on every single step. On a real machine with 29 skills that was ~3,074 tokens — before the model read a single line of code. Duplicates silently shadow each other. Long descriptions never get trimmed. Broken references go unnoticed.
Summary extracted from the README.
Runs 100% locally. No telemetry, no account, no uploads — your skills, prompts and files never leave your machine. See Privacy.
The hidden tax
Every agent skill with a description is injected into the system prompt on every single step. On a real machine with 29 skills that was ~3,074 tokens — before the model read a single line of code. Duplicates silently shadow each other. Long descriptions never get trimmed. Broken references go unnoticed.
skills-doctor measures the exact cost, shows which definition actually wins, and gives you a concrete plan to cut it:
current: ~3,124 tokens/step (30 advertised) budget: 1,200
Recommended: trim 26 + hide 2 → 1,184 tokens/step (−1,940)
Over 100 steps that saves ~194,000 tokens.
One command. Runs 100% locally. No account, no telemetry, nothing leaves your machine.
| Find | token budget, shadowed duplicates, flat/dir collisions, long descriptions, oversized bodies, broken references, invalid frontmatter, stale skills |
| Fix | archive shadowed definitions (reversible), hide redundant skills before unique ones, keep the routing sentence in the plan |
| Update | sync skills from HTTP catalogs with a lockfile, drift detection and --prune |
| Report | a short note in the OpenCode chat, plus the terminal and JSON |
| Run it | CLI · OpenCode plugin (1.x/2.x/Desktop) · MCP server · DeepSeek Harness skill |
Privacy: local-only, no data collection
skills-doctor runs entirely on your machine. There is no telemetry, no analytics, no account, no API key, and nothing is uploaded — not your skills, prompts, conversations or files.
| Reads | only skill definitions (SKILL.md plus the references/, scripts/, assets/ files they point at), agent config (opencode.json(c), .skills-doctor.json, DSH patch, MCP configs) and the lockfile |
| Never reads | conversation history, session transcripts, source code, documents, credentials, API keys or environment secrets |
| Uploads | nothing: there is no server component and no remote endpoint besides the two optional calls below |
| Network | only when you ask for it. update fetches the HTTP catalogs you configure; upgrade / the daily update check reads the npm registry for the latest version number (cached 24 h — disable with "checkUpdates": "off", SKILLS_DOCTOR_UPDATE_CHECK=0 or --no-update-check) |
| Writes | only what you asked for: .skills-doctor-archive/, .skills-doctor.json, the lockfile, and the plugin/MCP/skill entries created by install |
opencode.json(c) and MCP configs can contain credentials; they are parsed locally only to find the relevant entries, and those values are never sent anywhere nor included in a report. Reports contain file paths and skill descriptions (which are part of your skill files), never file bodies. check, plan, scan, fix --dry-run and mcp all work with the network fully offline.
What you see
In OpenCode 2, the first message of a session gets one notice in the chat when a skill is over budget, shadowed, or broken. It names at most three problems and does not change any file. /skills-doctor posts that notice again. The terminal check and --json output stay for CI.
How it works
flowchart LR
A["skill roots<br/>OpenCode · Claude · Grok · Cursor · Hermes · Kimi · DSH"] --> B["discover<br/>precedence resolved"]
B --> C["scan SKILL.md<br/>frontmatter + body + hash"]
C --> D["lint<br/>16 rules + token budget"]
D --> E{"findings?"}
E -->|"yes"| F["plan / fix<br/>trim · hide · archive"]
E -->|"always"| G["tell you<br/>chat · terminal · JSON"]
F --> G
G --> H["you · CI · the agent"]
Everything runs in one pass and is deterministic: the same skill files produce the same numbers, so a report is safe to diff in CI.
Quick start
# terminal report
npx -y opencode-skills-doctor check
# how many tokens can I actually cut?
npx -y opencode-skills-doctor plan
Install
# OpenCode — plugin + /skills-doctor and /skills-upgrade
npx -y opencode-skills-doctor install # auto-detects 1.x / 2.x / Desktop
npx -y opencode-skills-doctor install --client desktop
# DeepSeek Harness — MCP tool + audit skill, one command
npx -y opencode-skills-doctor install --client dsh
Claude Code, Codex, Grok or any MCP client — register the server once:
npx -y opencode-skills-doctor mcp
{ "mcpServers": { "skills-doctor": { "command": "npx", "args": ["-y", "opencode-skills-doctor", "mcp"] } } }
Nothing to configure for skills discovery: it reads .opencode/skills, .claude/skills, .agents/skills, .grok/skills, .cursor/skills, .hermes/skills, .kimi-code/skills, .dsh/skills (plus $DSH_HOME) and their user-level equivalents. See the full reference for OpenCode 1.x, DSH YAML, Codex TOML and Claude Code details.
Use it in CI (GitHub Action)
A composite action ships in this repo: no install step, no runtime dependencies — it runs the checked-out code directly. It is listed on the GitHub Marketplace.
name: skills
on: [push, pull_request]
permissions:
contents: read
pull-requests: write # only needed for `comment: true`
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wangyuchen5110/opencodeplugginprogram@v0.9.7
with:
budget: "1200"
fail-on: warn # error | warn | never
comment: "true" # post the summary on the PR
It writes a summary to the job page, optionally comments on the pull request,
and fails the job according to fail-on.
| Input | Default | Purpose |
|---|---|---|
root |
. |
Directory to audit |
budget |
1200 |
Description tokens paid per model step |
fail-on |
error |
Fail on error, warn, or never |
extra-args |
— | Extra check flags, e.g. --no-global |
comment |
false |
Post/append the summary as a pull request comment |
Outputs: exit-code, error-count, warning-count, advertised-tokens.
Commands
| Command | What it does |
|---|---|
check |
audit sources, conflicts, budget and broken references (default) |
plan |
savings from keeping the first sentence, then hiding redundant skills first, projected over N steps |
scan |
every skill with its source, precedence and cost |
fix |
archive shadowed definitions (reversible) or hide low-frequency skills |
update |
sync skills from HTTP catalogs, verify hashes, detect drift |
install / uninstall |
wire into OpenCode (1.x/2.x/Desktop) or DeepSeek Harness |
upgrade |
check for / apply a newer skills-doctor itself |
mcp |
run as an MCP server |
All commands accept --json, --lang en|zh, --budget, --root and --no-global. Full flags, rules and configuration live in the reference.
Works where you work
| Agent | How |
|---|---|
| OpenCode 2.x | plugins: ["opencode-skills-doctor"] → tool + commands + budget warning |
| OpenCode 1.x | install writes the local plugin entry and markdown commands |
| OpenCode Desktop | shares the CLI config; --client desktop detects the app and its bundled core |
| DeepSeek Harness | install --client dsh adds the MCP entry and the skills-doctor-audit skill; $DSH_HOME/skills is scanned |
| Claude Code / Codex | MCP server (npx -y opencode-skills-doctor mcp) |
| Grok CLI / Cursor | their skill roots are scanned natively |
| Hermes Agent | MCP entry in ~/.hermes/config.yaml; ~/.hermes/skills is scanned |
| Kimi Code | install --client kimi writes ~/.kimi-code/mcp.json + the audit skill; or use the native plugin: kimi-skills-doctor |
| OpenClaw | separate wrapper with its own native plugin: openclaw-skills-doctor |
Why it is safe
fixonly archives shadowed definitions, moving them into.skills-doctor-archive/<timestamp>/— reversible, and the effective skill is never touched.planis pure math: no LLM calls, no network, no file changes.updateblocks path traversal, writes atomically, verifies sha1 and detects drift.- It is not a sandbox; read SECURITY.md before pointing it at a real setup.
Development
npm test # 73 tests (node test/doctor.test.mjs)
npm run bench # lint timing for 100/500/1000 skills
CI runs ubuntu/macos/windows × Node 20/22/24; prepublishOnly re-runs the tests. Issues and PRs are welcome — see the reference.
Full reference · 中文 README · Changelog · Security
MIT