Auto Skill Trigger
/install auto-skill-trigger
Auto Skill Trigger - Automatic Skill Matching
Overview
Automatically match relevant skills to the current task using keyword/pattern scoring. Pre-filters the \x3Cavailable_skills> list before the LLM decides which to load.
How It Works
- When a message arrives, score each skill's description against the message
- Only include high-scoring skills in the prompt
- The LLM makes the final decision from a relevant subset
Scoring Algorithm
Simple TF-IDF-like keyword overlap:
api.registerHook("before_prompt_build", async ({ event, ctx }) => {
const msg = event.messages?.[0]?.content || "";
const keywords = extractKeywords(msg);
// Get all skills and their descriptions
const skills = await getAllSkills();
const scored = skills.map(skill => ({
skill,
score: keywordOverlap(keywords, skill.description)
})).filter(s => s.score > 0.3); // threshold
// Sort by score and take top 5
scored.sort((a, b) => b.score - a.score);
const topSkills = scored.slice(0, 5);
// Return instruction to prioritize matched skills
if (topSkills.length > 0) {
return {
prompt: `\
\
## Skill Hint\
Focus on: ${topSkills.map(s => s.skill.name).join(", ")}\
`
};
}
return {};
});
Keyword Extraction
function extractKeywords(text) {
// Extract meaningful words/n-grams
const words = text.toLowerCase()
.split(/\W+/)
.filter(w => w.length > 2)
.filter(w => !STOP_WORDS.has(w));
return new Set(words);
}
function keywordOverlap(keywords, description) {
const descWords = extractKeywords(description);
let matches = 0;
for (const kw of keywords) {
if (descWords.has(kw)) matches++;
}
return matches / keywords.size;
}
Configuration
{
"agents": {
"defaults": {
"autoSkillTrigger": {
"enabled": true,
"maxSkills": 5,
"threshold": 0.3,
"stopWords": ["the", "a", "an", "is", "are", "and"]
}
}
}
}
Patterns That Match
| Message Pattern | Matched Skills |
|---|---|
| "帮我查 GitHub issue" | github |
| "天气怎么样" | weather |
| "写个 Python 脚本" | coding |
| "搜一下最近的新闻" | search |
Limitations
- Pattern-based matching is imperfect
- Complex tasks may need multiple skills
- LLM still has final say via SKILL.md scanning
- Update threshold based on results
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install auto-skill-trigger - After installation, invoke the skill by name or use
/auto-skill-trigger - Provide required inputs per the skill's parameter spec and get structured output
What is Auto Skill Trigger?
Auto Skill Trigger - Match skills to tasks using keyword scoring. It is an AI Agent Skill for Claude Code / OpenClaw, with 147 downloads so far.
How do I install Auto Skill Trigger?
Run "/install auto-skill-trigger" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Auto Skill Trigger free?
Yes, Auto Skill Trigger is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Auto Skill Trigger support?
Auto Skill Trigger is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Auto Skill Trigger?
It is built and maintained by hanxiao-bot (@hanxiao-bot); the current version is v1.0.0.