mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
feat: implement dynamic SKILL discovery with intelligent matching
Transform load-skill-memory from manual specification to automatic discovery: **Core Change**: - From: User specifies SKILL name manually - To: System automatically discovers and matches SKILL based on task context **New Capabilities**: 1. **Three-Step Execution**: - Step 1: Discover all available SKILLs (.claude/skills/) - Step 2: Match most relevant SKILL using scoring algorithm - Step 3: Activate matched SKILL via Skill() tool 2. **Intelligent Matching Algorithm**: - **Path-Based** (Highest Priority): Direct path match from file paths - **Keyword Matching** (Secondary): Score by keyword overlap - **Action Matching** (Tertiary): Detect action verbs (分析/修改/学习) 3. **Updated Parameters**: - From: `<skill_name> [--level] [task description]` - To: `"task description or file path"` - More intuitive user experience 4. **New Examples**: ```bash /memory:load-skill-memory "分析热模型builder pattern实现" /memory:load-skill-memory "D:\dongdiankaifa9\hydro_generator_module\builders\base.py" /memory:load-skill-memory "修改workflow文档生成逻辑" ``` **Matching Examples**: Task: "分析热模型builder pattern实现" - hydro_generator_module: 4 points (thermal+builder+analyzing) ✅ - Claude_dms3: 1 point (analyzing only) Task: "D:\dongdiankaifa9\hydro_generator_module\builders\base.py" - Path match: hydro_generator_module ✅ (exact path) **Benefits**: - No manual SKILL name required - Automatic best match selection - Path-based intelligent routing - Keyword scoring for relevance - Action verb detection for context **User Experience**: Before: "/memory:load-skill-memory hydro_generator_module '分析热模型'" After: "/memory:load-skill-memory '分析热模型实现'" System automatically discovers and activates hydro_generator_module SKILL. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,78 +1,126 @@
|
||||
---
|
||||
name: load-skill-memory
|
||||
description: Load SKILL package documentation with progressive levels based on task requirements
|
||||
argument-hint: "<skill_name> [--level 0|1|2|3] [task description]"
|
||||
description: Automatically discover and activate SKILL packages based on task context with intelligent matching
|
||||
argument-hint: "\"task description or file path\""
|
||||
allowed-tools: Bash(*), Read(*), Glob(*), Skill(*)
|
||||
examples:
|
||||
- Skill(command: "hydro_generator_module")
|
||||
- Skill(command: "Claude_dms3")
|
||||
- Skill(command: "multiphysics_network")
|
||||
- /memory:load-skill-memory "分析热模型builder pattern实现"
|
||||
- /memory:load-skill-memory "修改workflow文档生成逻辑"
|
||||
- /memory:load-skill-memory "D:\dongdiankaifa9\hydro_generator_module\builders\base.py"
|
||||
---
|
||||
|
||||
# Memory Load SKILL Command (/memory:load-skill-memory)
|
||||
|
||||
## 1. Overview
|
||||
|
||||
The `memory:load-skill-memory` command **activates SKILL packages** generated by `/memory:skill-memory`. It validates SKILL existence and uses the `Skill()` tool to load comprehensive documentation context.
|
||||
The `memory:load-skill-memory` command **automatically discovers and activates** the most relevant SKILL package based on task description or file path. It dynamically matches user intent against available SKILL descriptions and activates the best match.
|
||||
|
||||
**Core Philosophy**:
|
||||
- **Two-Step Process**: Validate SKILL existence → Activate via Skill tool
|
||||
- **Automatic Context Loading**: SKILL system loads appropriate documentation automatically
|
||||
- **No Manual Reading**: Use Skill tool instead of manual Read operations
|
||||
- **Task-Driven Activation**: System automatically determines required context based on SKILL description triggers
|
||||
- **Dynamic SKILL Discovery**: Automatically finds relevant SKILL without manual specification
|
||||
- **Intelligent Matching**: Matches task keywords against SKILL descriptions
|
||||
- **Path-Based Detection**: Recognizes project paths and activates corresponding SKILL
|
||||
- **Automatic Activation**: Uses Skill() tool to load comprehensive context
|
||||
|
||||
## 2. Parameters
|
||||
|
||||
- `<skill_name>` (Required): Name of SKILL package to activate
|
||||
- Example: `hydro_generator_module`
|
||||
- Example: `Claude_dms3`
|
||||
- Example: `multiphysics_network`
|
||||
- `"task description or file path"` (Required): Task context or file path for SKILL matching
|
||||
- **Task description**: "分析热模型实现", "修改workflow逻辑", "学习参数系统"
|
||||
- **File path**: "D:\dongdiankaifa9\hydro_generator_module\builders\base.py"
|
||||
- **Domain keywords**: "thermal modeling", "workflow management", "multi-physics"
|
||||
|
||||
## 3. Two-Step Execution Flow
|
||||
## 3. Three-Step Execution Flow
|
||||
|
||||
### Step 1: Validate SKILL Existence
|
||||
### Step 1: Discover Available SKILLs
|
||||
|
||||
**Check SKILL.md File**:
|
||||
**List All SKILL Packages**:
|
||||
```bash
|
||||
bash(test -f .claude/skills/{skill_name}/SKILL.md && echo "exists" || echo "not_found")
|
||||
bash(ls -1 .claude/skills/ 2>/dev/null || echo "No SKILLs available")
|
||||
```
|
||||
|
||||
**Validation Logic**:
|
||||
- If `exists`: Continue to Step 2
|
||||
- If `not_found`: Return error message with available SKILLs:
|
||||
```bash
|
||||
bash(ls -1 .claude/skills/ 2>/dev/null || echo "No SKILLs available")
|
||||
```
|
||||
|
||||
**Error Message Format**:
|
||||
**Read Each SKILL.md for Matching**:
|
||||
```bash
|
||||
# For each SKILL directory found
|
||||
for skill in $(ls -1 .claude/skills/); do
|
||||
Read(.claude/skills/${skill}/SKILL.md)
|
||||
done
|
||||
```
|
||||
❌ SKILL '{skill_name}' not found.
|
||||
|
||||
**Extract Matching Information**:
|
||||
- SKILL name
|
||||
- Description (with trigger keywords)
|
||||
- Location path (from description)
|
||||
- Domain keywords
|
||||
|
||||
### Step 2: Match Most Relevant SKILL
|
||||
|
||||
**Matching Algorithm**:
|
||||
|
||||
1. **Path-Based Matching** (Highest Priority):
|
||||
- Extract path from user input if provided
|
||||
- Compare against SKILL location paths in descriptions
|
||||
- Exact match: `D:\dongdiankaifa9\hydro_generator_module` → `hydro_generator_module` SKILL
|
||||
|
||||
2. **Keyword Matching** (Secondary Priority):
|
||||
- Extract keywords from task description
|
||||
- Match against SKILL description keywords
|
||||
- Score each SKILL by keyword overlap count
|
||||
|
||||
3. **Action Matching** (Tertiary Priority):
|
||||
- Detect action verbs: "分析", "修改", "学习", "实现"
|
||||
- Match against SKILL description triggers
|
||||
- Prefer SKILLs with matching action patterns
|
||||
|
||||
**Scoring Example**:
|
||||
```javascript
|
||||
Task: "分析热模型builder pattern实现"
|
||||
|
||||
hydro_generator_module SKILL:
|
||||
- Path match: No
|
||||
- Keywords: "热模型"(1), "builder"(1), "实现"(1) = 3 points
|
||||
- Action match: "analyzing"(1) = 1 point
|
||||
- Total: 4 points ✅ Winner
|
||||
|
||||
Claude_dms3 SKILL:
|
||||
- Path match: No
|
||||
- Keywords: "workflow"(0) = 0 points
|
||||
- Action match: "analyzing"(1) = 1 point
|
||||
- Total: 1 point
|
||||
```
|
||||
|
||||
**No Match Handling**:
|
||||
```
|
||||
⚠️ No matching SKILL found for: "{task_description}"
|
||||
|
||||
Available SKILLs:
|
||||
- hydro_generator_module (D:\dongdiankaifa9\hydro_generator_module)
|
||||
- Claude_dms3 (D:\Claude_dms3)
|
||||
- hydro_generator_module - Hydro-generator thermal modeling
|
||||
- Claude_dms3 - Workflow orchestration system
|
||||
|
||||
Use: Skill(command: "skill_name")
|
||||
Generate new SKILL: /memory:skill-memory [path]
|
||||
Generate SKILL for your project: /memory:skill-memory [path]
|
||||
```
|
||||
|
||||
### Step 2: Activate SKILL Package
|
||||
### Step 3: Activate Matched SKILL
|
||||
|
||||
**Use Skill Tool to Activate**:
|
||||
**Activate Best Match**:
|
||||
```javascript
|
||||
Skill(command: "{skill_name}")
|
||||
Skill(command: "{matched_skill_name}")
|
||||
```
|
||||
|
||||
**What Happens**:
|
||||
1. Claude's SKILL system reads `.claude/skills/{skill_name}/SKILL.md`
|
||||
1. System reads `.claude/skills/{matched_skill_name}/SKILL.md`
|
||||
2. Automatically loads appropriate documentation based on:
|
||||
- SKILL description triggers (analyzing, modifying, learning)
|
||||
- Current conversation context
|
||||
- Memory gaps detection
|
||||
3. Progressive loading levels (0-3) handled automatically by system
|
||||
3. Progressive loading levels (0-3) handled automatically
|
||||
4. Context loaded directly into conversation memory
|
||||
|
||||
**No Manual Reading Required**: The Skill tool handles all documentation loading automatically based on SKILL.md configuration.
|
||||
**Confirmation Output**:
|
||||
```
|
||||
✅ Matched and activated SKILL: {matched_skill_name}
|
||||
🎯 Match reason: {path/keyword/action match}
|
||||
📦 Location: {project_path}
|
||||
💡 Context loaded for: {domain_description}
|
||||
```
|
||||
|
||||
## 4. Output Format
|
||||
|
||||
@@ -95,63 +143,109 @@ Skill(command: "{skill_name}")
|
||||
|
||||
## 5. Usage Examples
|
||||
|
||||
### Example 1: Activate Hydro Generator Module SKILL
|
||||
### Example 1: Task-Based Discovery (Keyword Matching)
|
||||
|
||||
**User Request**: "分析热模型builder pattern实现"
|
||||
**User Command**:
|
||||
```bash
|
||||
/memory:load-skill-memory "分析热模型builder pattern实现"
|
||||
```
|
||||
|
||||
**Command Execution**:
|
||||
**Execution Flow**:
|
||||
```javascript
|
||||
// Step 1: Validate
|
||||
bash(test -f .claude/skills/hydro_generator_module/SKILL.md && echo "exists")
|
||||
// Output: exists
|
||||
// Step 1: Discover available SKILLs
|
||||
bash(ls -1 .claude/skills/)
|
||||
// Output: hydro_generator_module, Claude_dms3
|
||||
|
||||
// Step 2: Activate
|
||||
// Read each SKILL.md
|
||||
Read(.claude/skills/hydro_generator_module/SKILL.md)
|
||||
Read(.claude/skills/Claude_dms3/SKILL.md)
|
||||
|
||||
// Step 2: Match keywords
|
||||
Keywords extracted: ["热模型", "builder", "pattern", "实现", "分析"]
|
||||
|
||||
Matching scores:
|
||||
- hydro_generator_module: 4 points (thermal modeling, builder, analyzing)
|
||||
- Claude_dms3: 1 point (analyzing only)
|
||||
|
||||
Best match: hydro_generator_module
|
||||
|
||||
// Step 3: Activate matched SKILL
|
||||
Skill(command: "hydro_generator_module")
|
||||
```
|
||||
|
||||
**SKILL Activation**:
|
||||
- System reads `.claude/skills/hydro_generator_module/SKILL.md`
|
||||
- Description triggers match: "analyzing" + "hydro-generator thermal modeling"
|
||||
- Automatically loads appropriate documentation (Level 1-2)
|
||||
- Context available for subsequent analysis
|
||||
**Output**:
|
||||
```
|
||||
✅ Matched and activated SKILL: hydro_generator_module
|
||||
🎯 Match reason: Keywords ["thermal", "builder"] + Action ["analyzing"]
|
||||
📦 Location: D:\dongdiankaifa9\hydro_generator_module
|
||||
💡 Context loaded for: hydro-generator thermal modeling
|
||||
```
|
||||
|
||||
### Example 2: Activate Workflow System SKILL
|
||||
### Example 2: Path-Based Discovery (Direct Path Match)
|
||||
|
||||
**User Request**: "修改文档生成workflow调度逻辑"
|
||||
**User Command**:
|
||||
```bash
|
||||
/memory:load-skill-memory "D:\dongdiankaifa9\hydro_generator_module\builders\base.py"
|
||||
```
|
||||
|
||||
**Command Execution**:
|
||||
**Execution Flow**:
|
||||
```javascript
|
||||
// Step 1: Validate
|
||||
bash(test -f .claude/skills/Claude_dms3/SKILL.md && echo "exists")
|
||||
// Output: exists
|
||||
// Step 1: Discover SKILLs
|
||||
bash(ls -1 .claude/skills/)
|
||||
|
||||
// Step 2: Activate
|
||||
// Step 2: Match path
|
||||
Path extracted: "D:\dongdiankaifa9\hydro_generator_module"
|
||||
|
||||
Matching:
|
||||
- hydro_generator_module location: "D:\dongdiankaifa9\hydro_generator_module" ✅ Exact match
|
||||
- Claude_dms3 location: "D:\Claude_dms3" ❌ No match
|
||||
|
||||
Best match: hydro_generator_module (path match - highest priority)
|
||||
|
||||
// Step 3: Activate
|
||||
Skill(command: "hydro_generator_module")
|
||||
```
|
||||
|
||||
**Output**:
|
||||
```
|
||||
✅ Matched and activated SKILL: hydro_generator_module
|
||||
🎯 Match reason: Path match (D:\dongdiankaifa9\hydro_generator_module)
|
||||
📦 Location: D:\dongdiankaifa9\hydro_generator_module
|
||||
💡 Context loaded for: hydro-generator thermal modeling
|
||||
```
|
||||
|
||||
### Example 3: Domain Keyword Discovery
|
||||
|
||||
**User Command**:
|
||||
```bash
|
||||
/memory:load-skill-memory "修改workflow文档生成调度逻辑"
|
||||
```
|
||||
|
||||
**Execution Flow**:
|
||||
```javascript
|
||||
// Step 1: Discover SKILLs
|
||||
bash(ls -1 .claude/skills/)
|
||||
|
||||
// Step 2: Match keywords
|
||||
Keywords: ["workflow", "文档生成", "调度", "修改"]
|
||||
|
||||
Matching scores:
|
||||
- Claude_dms3: 3 points (workflow, docs generation, modifying)
|
||||
- hydro_generator_module: 1 point (modifying only)
|
||||
|
||||
Best match: Claude_dms3
|
||||
|
||||
// Step 3: Activate
|
||||
Skill(command: "Claude_dms3")
|
||||
```
|
||||
|
||||
**SKILL Activation**:
|
||||
- Description triggers match: "modifying" + "workflow management"
|
||||
- System loads comprehensive documentation (Level 2-3)
|
||||
- Ready for workflow modification tasks
|
||||
|
||||
### Example 3: Activate Multi-Physics Network SKILL
|
||||
|
||||
**User Request**: "学习电磁域组件设计模式"
|
||||
|
||||
**Command Execution**:
|
||||
```javascript
|
||||
// Step 1: Validate
|
||||
bash(test -f .claude/skills/multiphysics_network/SKILL.md && echo "exists")
|
||||
// Output: exists
|
||||
|
||||
// Step 2: Activate
|
||||
Skill(command: "multiphysics_network")
|
||||
**Output**:
|
||||
```
|
||||
✅ Matched and activated SKILL: Claude_dms3
|
||||
🎯 Match reason: Keywords ["workflow", "docs"] + Action ["modifying"]
|
||||
📦 Location: D:\Claude_dms3
|
||||
💡 Context loaded for: workflow orchestration and documentation
|
||||
```
|
||||
|
||||
**SKILL Activation**:
|
||||
- Description triggers match: "learning" + "multi-physics"
|
||||
- System provides overview and core module docs (Level 0-1)
|
||||
- Context available for exploration
|
||||
|
||||
## 6. SKILL Trigger Mechanism
|
||||
|
||||
|
||||
Reference in New Issue
Block a user