Skip to content

Commit 1d59577

Browse files
committed
Skill engine: weighted scoring, negative patterns, context guards, max 3 cap
Replace binary keyword matching with confidence-scored suggestions. Phrases carry weights (0.0-1.0), negative patterns suppress false positives, and context guards require confirming words for low-confidence matches. Results ranked by score and capped at 3 per prompt.
1 parent d2ba55e commit 1d59577

File tree

3 files changed

+487
-293
lines changed

3 files changed

+487
-293
lines changed

.devcontainer/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# CodeForge Devcontainer Changelog
22

3+
## [Unreleased]
4+
5+
### Changed
6+
7+
#### Skill Engine: Auto-Suggestion
8+
- **Weighted scoring** — Skill suggestion phrases now carry confidence weights (0.0–1.0) instead of binary match/no-match. Specific phrases like "build a fastapi app" score 1.0; ambiguous phrases like "start building" score 0.2
9+
- **Negative patterns** — Skills can define substrings that instantly disqualify them. Prevents `fastapi` from triggering when discussing `pydantic-ai`, and `docker` from triggering for `docker-py` prompts
10+
- **Context guards** — Low-confidence matches (score < 0.6) require a confirming context word elsewhere in the prompt. "health check" only suggests `docker` if "docker", "container", or "compose" also appears
11+
- **Ranked results, capped at 3** — Suggestions are sorted by score (then priority tier), and only the top 3 are returned. Eliminates 6+ skill suggestion floods
12+
- **Priority tiers** — Explicit commands (priority 10) outrank technology skills (7), which outrank patterns (5) and generic skills (3) when scores tie
13+
314
## [v1.14.2] - 2026-02-24
415

516
### Fixed

.devcontainer/plugins/devs-marketplace/plugins/skill-engine/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ Two capabilities:
3838

3939
### Auto-Suggestion
4040

41-
The `skill-suggester.py` hook matches user prompts against keyword maps defined in each skill. When a match is found, it injects a suggestion via `additionalContext` so Claude knows a relevant skill is available.
41+
The `skill-suggester.py` hook scores user prompts against keyword maps for each skill using weighted matching. Suggestions are ranked by confidence and capped at **3 skills maximum** per prompt.
4242

43-
Keywords are defined per skill as:
44-
- **Phrases** — Multi-word patterns (e.g., "docker compose", "REST API")
45-
- **Terms** — Single keywords (e.g., "FastAPI", "pytest")
43+
Each skill defines:
44+
- **Phrases**`(substring, weight)` tuples. Weight 0.0–1.0 reflects specificity (e.g., `("build a fastapi app", 1.0)` vs `("pydantic model", 0.3)`)
45+
- **Terms** — Whole-word regex patterns, all scored at 0.6
46+
- **Negative patterns** — Substrings that instantly disqualify a skill (e.g., `"pydanticai"` suppresses `fastapi`)
47+
- **Context guards** — Required co-occurring words for low-confidence matches. When the best score is below 0.6, at least one guard word must appear in the prompt or the match is dropped
48+
- **Priority** — Integer tie-breaker (10 = commands, 7 = tech, 5 = patterns, 3 = generic)
4649

4750
## How It Works
4851

@@ -55,9 +58,12 @@ User submits a prompt
5558
|
5659
+-> skill-suggester.py
5760
|
58-
+-> Scan prompt against all skill keyword maps
59-
+-> Match found? -> Inject skill suggestion as additionalContext
60-
+-> No match? -> Silent (no output)
61+
+-> Check negative patterns (instant disqualify)
62+
+-> Score phrases (best weight) and terms (0.6)
63+
+-> Enforce context guards on low-confidence matches
64+
+-> Rank by score desc, priority desc
65+
+-> Return top 3 as additionalContext
66+
+-> No matches above threshold? -> Silent (no output)
6167
```
6268

6369
### Skill Structure
@@ -126,7 +132,7 @@ skill-engine/
126132
+-- hooks/
127133
| +-- hooks.json # UserPromptSubmit hook registration
128134
+-- scripts/
129-
| +-- skill-suggester.py # Keyword-based skill auto-suggestion
135+
| +-- skill-suggester.py # Weighted scoring skill auto-suggestion
130136
+-- skills/
131137
| +-- api-design/ # 21 skill directories
132138
| +-- ast-grep-patterns/

0 commit comments

Comments
 (0)