tmcfarlane/skillforge/bm25-skill-matching
Claude Code and agent skill by tmcfarlane/skillforge
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install tmcfarlane/skillforge/bm25-skill-matchingSKILL.md
BM25 Skill Matching
Rank a corpus of {skill_documents} against a free-text query using the BM25 probabilistic ranking function. Returns the top-N most relevant documents with snippets and matched terms. No external dependencies — pure TypeScript implementation.
When to Use
Use when you need text relevance ranking over a document corpus where:
- The corpus fits in memory (< 10K documents)
- No vector database or embedding model is available
- You need deterministic, explainable ranking
- Keyword overlap matters more than semantic similarity
For semantic similarity over large corpora, prefer embedding-based retrieval (P2-02).
Steps
- Tokenize documents and query — lowercase, remove stopwords, split on non-alphanumeric characters. Filter tokens shorter than 2 characters.
- Build an inverted index —
Map<term, Map<docId, termFrequency>>. Build once at query time from the live corpus.
- Compute IDF per term —
log((N - df + 0.5) / (df + 0.5) + 1)where N = total docs, df = number of docs containing term.
- Compute TF normalization —
(tf * (K1+1)) / (tf + K1 * (1 - B + B * (docLen / avgDocLen)))with K1=1.5, B=0.75.
- Sum IDF × TF-norm across all query terms — skip terms not in document.
- Sort by BM25 score descending — break ties by existing composite score.
- Extract snippet — find the document line with the most query term hits. Truncate to maxLen chars.
- Return top-N candidates — filter out docs with BM25 score of 0 (no overlap).
Algorithm
Primitives
- search, data-transform, aggregate
Tags
bm25, text-search, ranking, typescript, information-retrieval
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/bm25-skill-matching/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tmcfarlane/skillforge/bm25-skill-matching)