auto-skill-trigger

Auto Skill Trigger - Match skills to tasks using keyword scoring

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "auto-skill-trigger" with this command: npx skills add hanxiao-bot/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 <available_skills> list before the LLM decides which to load.

How It Works

  1. When a message arrives, score each skill's description against the message
  2. Only include high-scoring skills in the prompt
  3. 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: `\n\n## Skill Hint\nFocus on: ${topSkills.map(s => s.skill.name).join(", ")}\n`
    };
  }
  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 PatternMatched 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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Img2img

Generate images from text descriptions using DALL-E 3 while adhering to usage policies and avoiding realistic human faces.

Registry SourceRecently Updated
General

Habitat-GS-Navigator

Navigate and interact with photo-realistic 3DGS environments via the Habitat-GS Bridge. Use when: user asks to explore a 3D scene, perform embodied navigatio...

Registry SourceRecently Updated
General

Memory Palace

持久化记忆管理。Use when: 用户告诉你个人信息/偏好/习惯、需要记住项目状态/技术决策、完成任务后有可复用经验、用户说"记住""别忘了""下次注意"、需要回忆之前的对话内容。支持语义搜索和时间推理。

Registry SourceRecently Updated
General

Podcast Transcript Mining Authority Positioning

Extract guest appearances, speaking topics, and soundbites from podcast transcripts to build authority portfolios and generate podcast pitch templates. Use w...

Registry SourceRecently Updated