Health check & slim-down for your AI coding agent's skills, plugins and context files. Works with Claude Code · Codex CLI · Gemini CLI · Antigravity · Cursor · opencode · Windsurf · Zed · Copilot CLI.
Every skill description and rules file you install rides along in every conversation. Most setups carry dead weight: duplicated skills, prompts that never fire, oversized rule files. skill-slim audits what your agent actually loads, prices it in tokens and dollars, and safely quarantines the dead weight.
skill-slim — agent context health check
scanned: 4/4 agents installed · usage window 30d
● Codex CLI [codex]
skills: 5 · always-on instructions: 1 · always-on tokens: ~580 · ≈ $1.74 per 1k conversations
· Always-on context: ~580 tokens
instructions ~0 tok + 5 skill descriptions ~580 tok; heaviest: verify-engineering-work (~225 tok)
health score: 100/100 (A)
──────────────────────────────────────────
overall score: 100/100 (A) · always-on everywhere: ~580 tokens · recoverable: ~0 tokens
- 🩺 Multi-agent — one scan covers nine agents: Claude Code, Codex CLI, Gemini CLI, Antigravity, Cursor, opencode, Windsurf, Zed and Copilot CLI
- 💸 Always-on token bill — every always-loaded byte, converted to tokens and an estimated USD cost per 1,000 conversations and per month at your observed pace
- 👯 Duplicate detection — flags skills whose descriptions overlap enough to compete for the same triggers
- 📉 Never-invoked detection — parses local session transcripts (Claude Code and Codex) to find skills that were not used once in the scan window
- 📋 Convention checks — missing descriptions, over-length descriptions (1,024-char limit), oversized bodies that break progressive disclosure, name/folder mismatches
- 🏥 Health score — 0–100 per agent, plus a shareable HTML report (
--html) - 🔒 Reversible
fix/restore— quarantines never-invoked skills you own to~/.skill-slim/quarantine/with a manifest; dry-run shows the upside first (~N fewer always-on tokens ≈ $X/month),--applyre-scores and prints the before/after health delta;restore <name>moves them back. Plugin-bundled skills are never touched — uninstall the plugin instead - 🧾 Scannable reports — actionable findings always surface; plugin-bundle noise
collapses into a summary line (
--verboseto expand) - 🖥️ Local web dashboard —
skill-slim serveopens a wood-and-paper dashboard in your browser: score rings, per-agent bills, one-click slim-down with a live before/after score, and one-click restore from quarantine - 🤖 CI-ready —
--min-score <n>and--max-always-on-tokens <n>exit 1 when health drops below the gate or always-on context grows past the budget - 📦 Zero runtime dependencies — plain Node ≥ 22.18, no install step
npm release pending. The package is build- and install-tested (
npm run test:pack) but not on the registry yet — until it is, run it from a clone (below); everynpx skill-slim …command maps 1:1 tonode src/cli.ts ….
npx skill-slim # health check across all detected agents
npx skill-slim serve # web dashboard, opens in your browser
npx skill-slim agents # which agents were found on this machine
npx skill-slim fix # dry-run: plan + upside (tokens & $ saved)
npx skill-slim fix --apply # quarantine, then re-score: 76 → 91
npx skill-slim restore # list quarantined skills
npx skill-slim restore <name> # move one back to its original location
npx skill-slim --json # machine-readable output
npx skill-slim --html report.html # shareable HTML report card
npx skill-slim --html r.html --lang zh # report / wrapped bill in Chinese (default: system locale)
npx skill-slim --agent claude-code,codex --days 14
npx skill-slim --verbose # expand collapsed informational findingsOr from a git clone (node src/cli.ts accepts the same commands):
git clone https://github.com/0718lol/skill-slim && cd skill-slim
node src/cli.tsskill-slim serve (or --port 8080 --no-open for a quieter start) starts a local
dashboard on http://127.0.0.1:7466 — bound to localhost only, no data leaves the
machine, no framework and no build step (one static page + node:http). Requests
must carry a loopback Host header (DNS-rebinding defense) and state-changing
POSTs must be same-origin (CSRF defense); curl-style header-less clients keep
working. It can:
- show the overall score ring and the always-on token bill for every agent
- list findings with severity colors, plugin-bundle noise collapsed
- compute the slim-down plan with its upside in tokens and dollars
- apply the plan (double-confirmed) and show the score moving 76 → 91 live
- list the quarantine and restore any skill with one click
CI gate — fail the build when your skills repo gets bloated. Gate on the health score, on a hard always-on token budget, or both:
- run: npx skill-slim --min-score 85 --max-always-on-tokens 3000Once published, npx skill-slim will run with zero install (Node ≥ 22.18). The npm
package ships prebuilt JavaScript (dist/, built by npm run build with Node's own
type stripper — still zero dependencies), because Node does not run TypeScript from
node_modules.
| Agent | Skills | Always-on instructions | Usage data |
|---|---|---|---|
| Claude Code | ~/.claude/skills, .claude/skills, plugin bundles |
global & project CLAUDE.md |
✅ local ~/.claude/projects transcripts |
| Codex CLI | ~/.codex/skills, ~/.codex/prompts, plugin bundles |
global & project AGENTS.md |
✅ exec calls reading a SKILL.md + leading slash commands |
| Gemini CLI | ~/.gemini/skills, .gemini/skills |
global & project GEMINI.md, extensions |
— not logged locally |
| Antigravity | ~/.gemini/config/skills, installed plugins (config.json), .agent/skills |
always-on rules (always_on / standalone AGENTS.md), GEMINI.md |
✅ view_file / read_file calls on SKILL.md in conversation DBs, evidence-gated |
| Cursor | non-always-apply .cursor/rules/*.mdc |
always-apply rules | conversations only (ai-tracking); rule usage isn't logged |
| opencode | ~/.config/opencode/skills, commands; compat ~/.claude/skills, ~/.agents/skills |
global & project AGENTS.md (CLAUDE.md fallback) |
✅ session SQLite (part/session_message, evidence-gated) |
| Windsurf | .windsurf/.devin rules & workflows, ~/.codeium/windsurf/global_workflows |
memories/global_rules.md, .windsurfrules, always_on rules |
— not logged locally |
| Zed | ~/.agents/skills, .agents/skills (cross-agent standard) |
~/.config/zed/AGENTS.md, project AGENTS.md |
✅ threads SQLite (zstd payloads, evidence-gated) |
| Copilot CLI | — (no local skill store) | ~/.copilot/copilot-instructions.md, .github/copilot-instructions.md |
— |
Everything stays on your machine: skill-slim reads local files only and makes no network requests.
A local tool that parses agent config files, transcripts and databases — and serves a web dashboard — has a real attack surface, so it gets treated like one:
- OWASP-mapped threat model & self-assessment: docs/security.md
- 21 security tests in
tests/security.test.ts: stored-XSS through hostile skill names, CSRF & DNS-rebinding rejection, request-size caps, regex-DoS bounds, quarantine path containment, restore-never-overwrites, symlink non-following, prototype-pollution inertness - CodeQL static analysis on every push (
.github/workflows/codeql.yml), results in the Security tab - Reports aggregate only — skill/instruction file bodies never appear in any report, JSON output or API response
- Token counts use a heuristic (CJK ≈ 1 token/char, other text ≈ 3.8 chars/token) — good for sizing, not billing-grade.
- Cost estimates assume $3 per 1M input tokens; adjust
PRICE_PER_MTOKinsrc/util/tokens.tsto match your plan. The monthly figure extrapolates from the conversation count inside the scan window. - Claude Code usage parsing is a best-effort regex over session JSONL; Codex usage is a
proxy (exec calls reading a
SKILL.md, leading slash commands) and only scans tool-call inputs — command outputs overcount wildly. Both may overcount, which is the safe direction: it only ever protects a skill from the unused list. A skill counts as used when either its frontmatternameor its folder name shows up. - "Never invoked" needs evidence: with fewer than 5 conversations in the scan window an
agent gets no unused findings and no quarantine plan, just a note. Override with
SKILL_SLIM_MIN_CONVERSATIONS=<n>(0disables the gate). - The headline health score is weighted by how many skills and instruction files each agent carries; agents that carry nothing are left out of the average.
- Gemini usage is evidence-gated: Antigravity conversation databases are scanned
(read-only, via Node's built-in
node:sqlite) forSKILL.mdpath references. When a database never mentions the skill system, the report says "usage unknown" instead of falsely marking every skill unused. - Cursor doesn't log rule invocations locally, so only conversation counts (from
~/.cursor/ai-tracking/ai-code-tracking.db) are read — they power the monthly bill. fixonly ever moves skills you own (global/project). Plugin-bundled skills live in agent-managed caches and are reported as informational — uninstall the plugin instead.- Cross-agent compatibility roots (
~/.claude/skills,~/.agents/skills) are loaded by several agents; each agent's bill counts what it really carries, andfixquarantines a physical directory only once.
-
restorecommand to un-quarantine by name - Usage parsing for Codex (exec-proxy + slash commands)
- Usage parsing for Gemini CLI (Antigravity DBs, evidence-gated)
- Usage parsing for opencode & Zed (session/thread SQLite, evidence-gated)
- Conversation counts for Cursor's monthly bill
- Local web dashboard (
skill-slim serve) - Per-rule usage for Cursor (not logged locally by Cursor)
- Embedding-based duplicate detection (optional local model)
- MCP server tool-definition pricing
- GitHub Action that posts a health report on your skills repo
- npm-ready packaging: prebuilt
dist/, pack-and-install smoke test in CI - Publish to npm (
npm i -g skill-slim/npx skill-slim)
The skill's SKILL.md is a prompt, so it gets tested like one. evals/ holds a 15-case
promptfoo harness: it hands an agent a realistic request, grades the reply on
command routing, safety ordering, metric interpretation and edge states, and fails the run when the
candidate prompt drops below 90% or any safety case breaks.
The original prompt (evals/prompts/skill-v0.md) scored 60–67%;
the shipped SKILL.md is now the tightened v1, which scores 100% for +120 always-on tokens per turn.
cd evals && cp .env.example .env # any OpenAI-compatible endpoint
./run.sh # eval → gate → results/summary.htmlPRs welcome — especially new agent adapters. An adapter is one file in
src/adapters/ implementing detect() + scan() plus a test and a doc; see
docs/adapters/ for the per-adapter data-source docs and the
NEW_ADAPTER.md guide. Run tests with npm test (zero deps, sub-second).
skill-slim 给 AI 编码 Agent 的技能包做“体检”:统计常驻上下文的 token 成本、找出重复
与从未使用的技能、检查规范问题,并可一键隔离(可恢复)瘦身。支持 Claude Code / Codex /
Gemini CLI / Cursor 四家,纯本地运行,零依赖。用量解析覆盖 Claude Code(会话 JSONL)、
Codex(exec 调用代理)、Gemini CLI(Antigravity 会话库,证据门控);Cursor 不记录规则
调用,仅读取会话数支撑月度账单。常用命令见上方 Usage;fix 默认 dry-run,加 --apply
才会实际移动目录到 ~/.skill-slim/quarantine/,restore <name> 随时恢复。
- pr-test-receipt — Pre-PR verification and paste-ready GitHub/GitLab test receipts (separates dirty working-tree runs from committed
HEADand catches0-test false passes). - verify-engineering-work — Full risk-aware reliability workflow for AI coding agents.
- scout-before-build — Scouts GitHub and design references before starting a build.
MIT
