Skip to content

About

skill-collider — LLM-free static routing-collision analyzer for Agent Skills (SKILL.md)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Development Experiment 003 — skill-collider

LLM-free static routing-collision analyzer for Agent Skills (SKILL.md).

Point it at a directory of skills and it tells you — deterministically, offline, with no API key and no tokens burned — which skills compete for the same user queries, before an LLM router ever has to guess between them.

$ skill-collider analyze ./skills
HARD collisions (identical quoted trigger phrase): 1
  [ high ] "landing page"  <-  copywriting, page-cro
...
$ skill-collider route ./skills "help me improve my landing page"
verdict : AMBIGUOUS  (top-2 margin=0.026)
  1. page-cro      0.499 <- winner
  2. copywriting   0.473   # a hair behind — an LLM could pick either

Thesis

Agent Skills are selected by an LLM's forward pass over the aggregated names + descriptions of every installed skill — there is no algorithmic router, no embeddings, no keyword match (confirmed in the 2026 skill-authoring guidance; see RESEARCH.md). That means routing quality is entirely a function of how distinct the descriptions are, and the ecosystem has already crossed 5,000+ community skills. When two skills describe overlapping trigger territory, the model mis-routes or triggers ambiguously — the single cheapest agent failure to prevent, because it happens at the very first hop. Yet the existing tooling only checks JSON schema and name collisions, or leans on a non-deterministic LLM-judge. skill-collider is the smallest thing that proves you can catch routing collisions deterministically and offline: model each skill's trigger surface as a weighted TF-IDF vector and flag the pairs that overlap, the broad skills that shadow narrow ones, and the queries that land ambiguously — a fast gate you can run on every PR without spending a token.

What it detects

Finding Meaning Confidence
Hard collision Two+ skills quote the same literal trigger phrase (e.g. both claim "form"). High / deterministic
Soft collision Two skills' trigger surfaces are lexically similar above a cosine threshold. Tunable
Shadowing A broad skill's trigger terms subsume a narrow one's, so the narrow skill risks never being top match. Tunable
Discoverability warning A description with no quoted phrases / too few terms — likely to under-trigger. Heuristic
Route ambiguity For a given query, the top two skills are within a thin margin. Deterministic proxy

Delegations suppress false positives. A description that says "for forms, see form-cro" is an intentional hand-off, not a collision — the analyzer parses these cross-references and excludes those pairs.

How to run

Requires Python 3.11+. Zero runtime dependencies.

# lint a skill library (exit 1 if hard collisions found — CI-ready)
python main.py analyze path/to/skills

# machine-readable output for CI artifacts
python main.py analyze path/to/skills --json

# simulate how a query would route
python main.py route path/to/skills "reduce form abandonment"

# try it on the bundled fixture library
make run
make route Q="help me improve my landing page"

CLI exit codes follow linter convention: 0 clean, 1 hazards found (governed by --fail-on {hard,any,never}), 2 usage/parse error.

Tests

Tests use the stdlib unittest runner, so they need nothing installed:

make test                     # or: python -m unittest discover -s tests -t . -v

They are also pytest-compatible (pip install pytest && make test-pytest).

Architecture

SKILL.md files
     |  parser.py   ── frontmatter + trigger-surface extraction
     v               (quoted phrases 3x, name 2.5x, prose 1x; delegations parsed out)
 [ Skill records ]
     |  tfidf.py    ── build a corpus TF-IDF space, L2-normalized vectors
     v
 [ Vectors ]
     |  analyzer.py ── hard collisions (shared quoted phrase)
     |               ── soft collisions (cosine >= threshold, delegation-suppressed)
     |               ── shadowing (containment, asymmetric)
     |               ── discoverability + a single 0-100 routing-health score
     |  simulate.py ── vectorize a query in the same space, rank, report top-2 margin
     v
 report.py (text / JSON)  <──  cli.py (analyze | route)

Data flow: each skill's description is reduced to a weighted bag of trigger terms. Quoted phrases (the strongest literal cue) and name tokens are up-weighted; delegated sibling names are stripped so a skill can't collide with the sibling it hands off to. A TF-IDF space over the corpus gives common words low weight and distinctive trigger words high weight; cosine similarity between two skill vectors is their collision score, and cosine between a query vector and each skill is the routing score.

Two approaches considered

A. Deterministic lexical / TF-IDF trigger-surface analysis (chosen).

  • Pros: deterministic (same input → identical report, byte for byte), zero cost, sub-second on hundreds of skills, no API key, no network, ~0 memory footprint, trivial to drop into CI. Zero third-party dependencies.
  • Cons: it is a lexical proxy for what an LLM does — it can miss pure paraphrase overlap where two descriptions share meaning but no tokens ("A/B test" vs "split experiment"). Mitigated by weighting author-provided quoted phrases heavily and by the route simulator surfacing thin margins.

B. Embedding / LLM-judge semantic analysis (rejected for the core gate).

  • Pros: catches paraphrase and deep semantic overlap.
  • Cons: a local embedding model means a heavy dependency (hundreds of MB, torch), slower runs, and version-dependent, non-deterministic scores — a bad fit for a regression gate. An LLM judge additionally costs tokens per run and is non-reproducible. The reliability literature (RESEARCH.md) is explicit that a non-deterministic check erodes the very consistency we want to enforce.

Trade-off summary: we deliberately trade recall on pure-paraphrase collisions for determinism, zero cost, and zero dependencies. Approach B is complementary, not a replacement — the right place for it is a slower, opt-in nightly job, not the per-PR gate. This experiment ships the gate.

Sample run

Captured from python main.py analyze tests/fixtures/skills on 2026-07-12 (11 fixture skills crafted to contain realistic overlap):

skill-collider report
============================================================
skills analyzed : 11
routing health  :  74.7/100  [###############-----]

HARD collisions (identical quoted trigger phrase): 1
  [ high ] "landing page"  <-  copywriting, page-cro

Soft collisions (overlapping trigger surface): 1
  [ low  ] copywriting <> page-cro  sim=0.36
           shared: page, landing, marketing, improve, see, feature

Discoverability warnings: 1
  vague-helper  (score=38)
     - no quoted trigger phrases -- router has only prose to key on

And the route simulator making the impact concrete:

$ python main.py route tests/fixtures/skills "help me improve my landing page"
query   : "help me improve my landing page"
verdict : AMBIGUOUS  (top-2 margin=0.026)
ranked  :
  1. page-cro       0.499 <- winner
  2. copywriting    0.473
  3. vague-helper   0.062

WARNING: top matches are within the ambiguity margin -- an LLM router
         could plausibly pick either. Tighten these descriptions.

$ python main.py route tests/fixtures/skills "add JSON-LD schema for rich snippets"
verdict : CONFIDENT  (top-2 margin=0.596)
  1. schema-markup  0.596 <- winner

The fixtures also demonstrate delegation suppression: email-sequence and cold-email overlap at ~0.34, but because email-sequence says "see cold-email", the pair is not reported as a collision.

Assumptions & limitations

  • Trigger surface = name + description only. The skill body is intentionally ignored because progressive disclosure means the body plays no part in routing.
  • Lexical, not semantic. As above, pure-paraphrase collisions with no shared tokens can slip through. Quoted-phrase weighting narrows this gap for the common case where authors list explicit trigger terms.
  • The router is an LLM; this is a proxy. Scores are a deterministic estimate of routing pressure, not a reproduction of any specific model's choice. Use the findings as a prioritized list of descriptions to review, not as ground truth.
  • Frontmatter parser is a YAML subset — key: value with multi-line continuations, covering real single-line and folded descriptions. It does not implement full YAML (block scalars |/>, flow collections). Malformed files fail loud with the offending path rather than being silently skipped.
  • Default thresholds (collision cosine 0.35, shadow containment 0.60, ambiguity margin 0.05) are sensible starting points calibrated on the fixtures, not universal constants — tune per library with the CLI flags.
  • English stop-word list. Non-English skill descriptions will be analyzed but with less effective term filtering.

Project layout

skillcollider/      package (parser, tfidf, analyzer, simulate, report, cli)
main.py             convenience entry point (python main.py ...)
tests/              unittest suite (49 tests) + fixtures/skills/ (11 skills)
Makefile            make test / run / route / clean
pyproject.toml      packaging (console script: skill-collider)

License

MIT — see LICENSE.


Development Experiment 003 of the autonomous daily R&D series. Assumption for this run: no external paid services were available or needed; everything is stdlib-only and runs offline.

About

skill-collider — LLM-free static routing-collision analyzer for Agent Skills (SKILL.md)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages