Files
Claude-Code-Workflow/.claude/commands/memory/load-skill-memory.md
catlog22 9e0a70150a refactor: redesign load-skill-memory to use Skill tool activation
Complete redesign from manual document reading to SKILL activation pattern:

**Before (Manual Loading)**:
- Complex level selection logic (0-3)
- Manual Read operations for each document
- Task-based auto-level selection
- ~200 lines of document loading code

**After (Skill Activation)**:
- Simple two-step: Validate → Activate
- Use Skill(command: "skill_name") tool
- System handles all documentation loading automatically
- ~100 lines simpler, more maintainable

**Key Changes**:

1. **Examples Updated**:
   - From: `/memory:load-skill-memory hydro_generator_module "分析热模型"`
   - To: `Skill(command: "hydro_generator_module")`

2. **Execution Flow Simplified**:
   - Step 1: Validate SKILL.md exists
   - Step 2: Skill(command: "skill_name")
   - System automatically handles progressive loading

3. **Removed Manual Logic**:
   - No explicit --level parameter
   - No manual document reading
   - No level selection algorithm
   - System determines context needs automatically

4. **Added SKILL Trigger Mechanism**:
   - Explains how SKILL description triggers work
   - Keyword matching (domain terms)
   - Action detection (analyzing, modifying, learning)
   - Memory gap detection
   - Path-based triggering

5. **Updated Integration Examples**:
   ```javascript
   Skill(command: "hydro_generator_module")
   SlashCommand(command: "/workflow:plan \"task\"")
   ```

**Benefits**:
- Simpler user experience (just activate SKILL)
- Automatic context optimization
- System handles complexity
- Follows Claude SKILL architecture
- Leverages built-in SKILL trigger patterns

**Philosophy Shift**:
- From: Manual control over documentation loading
- To: Trust SKILL system to load appropriate context
- Aligns with skill-memory.md description optimization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:26:52 +08:00

8.4 KiB

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]" allowed-tools: Bash(), Read(), Glob(), Skill() examples: - Skill(command: "hydro_generator_module") - Skill(command: "Claude_dms3") - Skill(command: "multiphysics_network")

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.

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

2. Parameters

  • <skill_name> (Required): Name of SKILL package to activate
    • Example: hydro_generator_module
    • Example: Claude_dms3
    • Example: multiphysics_network

3. Two-Step Execution Flow

Step 1: Validate SKILL Existence

Check SKILL.md File:

bash(test -f .claude/skills/{skill_name}/SKILL.md && echo "exists" || echo "not_found")

Validation Logic:

  • If exists: Continue to Step 2
  • If not_found: Return error message with available SKILLs:
    bash(ls -1 .claude/skills/ 2>/dev/null || echo "No SKILLs available")
    

Error Message Format:

❌ SKILL '{skill_name}' not found.

Available SKILLs:
- hydro_generator_module (D:\dongdiankaifa9\hydro_generator_module)
- Claude_dms3 (D:\Claude_dms3)

Use: Skill(command: "skill_name")
Generate new SKILL: /memory:skill-memory [path]

Step 2: Activate SKILL Package

Use Skill Tool to Activate:

Skill(command: "{skill_name}")

What Happens:

  1. Claude's SKILL system reads .claude/skills/{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
  4. Context loaded directly into conversation memory

No Manual Reading Required: The Skill tool handles all documentation loading automatically based on SKILL.md configuration.

4. Output Format

Success Output:

✅ Activated SKILL: {skill_name}

📦 SKILL Package Information:
- Location: {project_path}
- Description: {description from SKILL.md}
- Documentation: .workflow/docs/{skill_name}/

💡 Context loaded automatically by SKILL system based on:
- Current task requirements
- Conversation memory gaps
- SKILL description triggers

🎯 Ready for: analyzing, modifying, or learning about {domain_description}

5. Usage Examples

Example 1: Activate Hydro Generator Module SKILL

User Request: "分析热模型builder pattern实现"

Command Execution:

// Step 1: Validate
bash(test -f .claude/skills/hydro_generator_module/SKILL.md && echo "exists")
// Output: exists

// Step 2: Activate
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

Example 2: Activate Workflow System SKILL

User Request: "修改文档生成workflow调度逻辑"

Command Execution:

// Step 1: Validate
bash(test -f .claude/skills/Claude_dms3/SKILL.md && echo "exists")
// Output: exists

// Step 2: 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:

// Step 1: Validate
bash(test -f .claude/skills/multiphysics_network/SKILL.md && echo "exists")
// Output: exists

// Step 2: Activate
Skill(command: "multiphysics_network")

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

How SKILL System Determines Context Loading:

The SKILL.md description includes trigger patterns that automatically activate when:

  1. Keyword Matching:

    • User mentions domain keywords (e.g., "热模型", "workflow", "多物理场")
    • Description keywords match task requirements
  2. Action Detection:

    • "analyzing" triggers for analysis tasks
    • "modifying" triggers for code modification
    • "learning" triggers for exploration
  3. Memory Gap Detection:

    • "especially when no relevant context exists in memory"
    • System prioritizes SKILL loading when conversation lacks context
  4. Path-Based Triggering:

    • User mentions file paths matching SKILL location
    • "files under this path" clause activates

Progressive Loading (Automatic):

  • Level 0: ~2K tokens (Quick overview)
  • Level 1: ~10K tokens (Core modules)
  • Level 2: ~25K tokens (Complete system)
  • Level 3: ~40K tokens (Full documentation)

System automatically selects appropriate level based on task complexity and context requirements.

7. Implementation Steps

Execution Logic:

// Step 1: Validate SKILL existence
skill_path = `.claude/skills/${skill_name}/SKILL.md`
if (!exists(skill_path)) {
  list_available_skills()
  return error_message
}

// Step 2: Activate SKILL
Skill(command: skill_name)

// Step 3: System handles automatically
// - Reads SKILL.md description
// - Matches triggers with task context
// - Loads appropriate documentation level
// - Injects context into conversation memory

// Step 4: Confirm activation
output_success_message(skill_name, project_path, description)

8. Error Handling

SKILL Not Found

❌ SKILL 'unknown_module' not found.

Available SKILLs:
- hydro_generator_module (D:\dongdiankaifa9\hydro_generator_module)
- Claude_dms3 (D:\Claude_dms3)

Activate SKILL: Skill(command: "skill_name")
Generate new SKILL: /memory:skill-memory [path]

Documentation Missing

⚠️  SKILL 'hydro_generator_module' exists but documentation incomplete.

Missing files:
- .workflow/docs/hydro_generator_module/ARCHITECTURE.md

Regenerate documentation: /memory:skill-memory --regenerate

9. Integration with Other Commands

Workflow Integration:

// 1. Activate SKILL context
Skill(command: "hydro_generator_module")

// 2. Use loaded context for planning
SlashCommand(command: "/workflow:plan \"增强thermal template支持动态阻抗\"")

// 3. Execute implementation
SlashCommand(command: "/workflow:execute")

Memory Refresh Pattern:

// Refresh SKILL context after code changes
Skill(command: "hydro_generator_module")
// System automatically detects changes and loads updated documentation

10. Token Optimization Strategy

Automatic Progressive Loading: The SKILL system automatically handles token optimization:

  1. Initial Load: Starts with minimum required context
  2. On-Demand Escalation: Loads more documentation if needed
  3. Task-Driven: Adjusts depth based on task complexity
  4. Memory-Aware: Avoids loading redundant context

Token Budget (Automatic):

  • Simple queries: ~2-10K tokens
  • Code analysis: ~10-25K tokens
  • Implementation: ~25-40K tokens

Optimization Benefits:

  • No manual level selection required
  • System learns from conversation context
  • Efficient memory usage
  • Automatic reload when context insufficient

11. Notes

  • Validation First: Always checks SKILL existence before activation
  • Automatic Loading: Skill tool handles all documentation reading
  • Session-Scoped: Activated SKILL context valid for current session
  • Trigger-Based: Description patterns drive automatic activation
  • Path-Aware: Triggers on project path mentions
  • Memory-Smart: Prioritizes loading when conversation lacks context
  • Read-Only: Does not modify SKILL files or documentation
  • Reactivation: Can re-activate SKILL to refresh context after changes