Skill Evolution Driver
Task Objectives
- This Skill is used to: Drive self-evolution of skills, continuously optimize as the project progresses
- Capabilities include:
- Monitor data stored in skill-manager to identify skill optimization opportunities
- Notify users of potential optimization suggestions during idle time
- Maintain a list of skill optimization tasks
- Execute skill update processes (backup, update, testing, restoration)
- Manage skill version numbers
- Trigger conditions: Triggered by any of the following situations
- Direct user requests: "Optimize skill", "Improve skill", "Skill needs update", "Skill upgrade", "Fix skill issues"
- Automatic monitoring trigger: Detects pending optimization tasks in skill data stored in skill-manager (such as optimization tasks with status=pending, errors and warnings in logs, missing required fields)
- Version-related: "Skill version number needs update", "Need to record skill changes"
- Quality-related: "Skill format is incorrect", "Need to check skill quality", "Skill test failed"
Optimization Identification
Data Sources
Analyze optimization opportunities from skill data stored in skill-manager:
- Missing information: Lack of required fields in skill configuration (such as version)
- Format issues: Data format does not comply with specifications
- Duplicate information: Redundant or duplicate content exists
- Usage patterns: Identify improvement points based on access frequency and methods
- Error logs: Identify common errors or warnings from logs
- Cross-skill collaboration issues: Identify dependency issues or improvement suggestions for the current skill from logs of other skills
Optimization Types
- format_improvement: Format improvement
- content_optimization: Content optimization
- version_update: Version number update
- bug_fix: Bug fix
- feature_enhancement: Feature enhancement
Evolution Process
Step 1: Notify User
Automatic Monitoring Trigger
The agent periodically checks data stored in skill-manager to identify optimization opportunities:
Inspection Tools: Call
scripts/check_optimization_opportunities.py
bash
# Check all skills
python scripts/check_optimization_opportunities.py
# Check specific skill
python scripts/check_optimization_opportunities.py --skill-name dev-observability
Inspection Content:
- Pending tasks: Check optimization tasks stored in skill-evolution-driver itself (status=pending)
- Missing fields: Check if skill configuration lacks required fields (such as version, deploy_mode, manual_path)
- Error logs: Check ERROR/WARNING/CRITICAL logs in skill logs
- Directory issues: Check if skill directory structure complies with specifications
Notification Format:
Potential optimization opportunities detected:
- Skill: skill-name
- Optimization type: format_improvement
- Description: SKILL.md is missing version field
- Start optimization? (y/n)
User-Initiated Trigger
Directly notify the user when the user expresses the following needs:
- "Optimize skill", "Improve skill"
- "Skill needs update", "Skill upgrade"
- "Fix skill issues"
- "Skill version number needs update"
- "Skill format is incorrect", "Need to check skill quality"
Step 2: Maintain Task List
If the user agrees, call skill-manager to store the optimization task:
json
{
"task_id": "OPT-001",
"skill_name": "skill-name",
"optimization_type": "format_improvement",
"description": "SKILL.md is missing version field",
"status": "pending",
"feasibility": "pending",
"backup_path": "",
"old_version": "",
"new_version": "",
"test_result": "",
"notes": "",
"created_at": "2024-01-22 12:00:00",
"updated_at": "2024-01-22 12:00:00"
}
Storage method: Update the configuration of skill-evolution-driver in skill-manager
python
import sys
sys.path.insert(0, '/workspace/projects/skill-manager/scripts')
from skill_manager import SkillStorage
storage = SkillStorage(data_path="/workspace/projects/skill-data.json")
existing_config = storage.get_config("skill-evolution-driver") or {}
existing_config["optimization_tasks"] = [task_dict] # Task list
storage.save_config("skill-evolution-driver", existing_config)
Step 3: Analyze Feasibility
Analyze the feasibility of optimizing the skill:
Feasibility Evaluation Criteria:
- Complete skill directory structure
- Correct SKILL.md format
- Valid script syntax
- Clear dependency relationships
- Clear optimization content
Infeasible Scenarios:
- Skill directory does not exist or is damaged
- SKILL.md format is incorrect and cannot be parsed
- Optimization content is unclear or overly complex
- Optimization may damage existing functions
Update task status:
- Feasible:
- Infeasible:
feasibility: "not_feasible"
, and explain the reason in
Step 4: Backup Skill
Call
to backup the skill:
bash
python scripts/backup_skill.py --skill-dir /workspace/projects/skill-name
Backup file format:
skill-name.backup.<timestamp>.skill
Update task:
backup_path: "/workspace/projects/skill-name.backup.<timestamp>.skill"
Step 5: Update Skill
Execute specific optimization operations and update the version number:
- Execute optimization: Modify skill content according to optimization type
- Update version number: Call
scripts/update_version.py
bash
python scripts/update_version.py --skill-dir /workspace/projects/skill-name --type patch
Version number types:
- : Patch version (v1.0.0 -> v1.0.1)
- : Minor version (v1.0.0 -> v1.1.0)
- : Major version (v1.0.0 -> v2.0.0)
Update task:
Step 6: Conduct Testing
Test and verify the updated skill:
Testing Content:
- SKILL.md format verification (YAML preamble area)
- Script syntax check (Python syntax)
- Directory structure verification (complies with fixed structure)
- Dependency integrity check (dependency field)
Test script:
bash
python scripts/backup_skill.py --validate-only --skill-dir /workspace/projects/skill-name
Step 7: Handle Test Results
Test Failed:
- Call to restore the skill
- Use
manage_optimization_tasks.py
to update task status
bash
# Restore skill
python scripts/restore_skill.py --backup-file <backup path> --skill-dir /workspace/projects/skill-name
# Update task status
python scripts/manage_optimization_tasks.py update \
--task-id OPT-001 \
--status failed \
--test-result failed \
--notes "Test failed: SKILL.md format error"
Test Passed:
- Use
manage_optimization_tasks.py
to update task status
- Package the new .skill file
- Inform the user of update content
- Remind the user to reload the skill
bash
# Update task status
python scripts/manage_optimization_tasks.py update \
--task-id OPT-001 \
--status completed \
--test-result passed \
--notes "Optimization successful: version field added" \
--new-version v1.0.1 \
--backup-path /workspace/projects/skill-name.backup.20260122120000.skill
Important: Must update the task status to
to avoid repeated reminders of the same optimization opportunity during next inspection.
Step 8: Notify User
Notify the user based on test results:
Test Passed:
✓ Skill optimization successful
- Skill: skill-name
- Version: v1.0.0 -> v1.0.1
- Update content: Added version field
- Backup: skill-name.backup.<timestamp>.skill
Please reload the AI interaction interface to use the updated skill.
Test Failed:
✗ Skill optimization failed
- Skill: skill-name
- Reason: Test failed
- Details: SKILL.md format error
- Skill has been restored
Core Function Description
Functions Handled by the Agent
- Monitor skill-manager data to identify optimization opportunities
- Notify users of optimization suggestions during idle time
- Maintain skill optimization task list
- Analyze optimization feasibility
- Execute optimization operations
- Conduct test verification
- Handle test results
- Notify users
Functions Implemented by Scripts
- Check optimization opportunities:
scripts/check_optimization_opportunities.py
scans skill-manager data to automatically identify optimization opportunities (filter completed tasks)
- Manage optimization tasks:
scripts/manage_optimization_tasks.py
provides add/delete/update/query functions for optimization tasks
- Backup skill: backs up the entire skill directory
- Restore skill: restores skill from backup
- Update version number:
scripts/update_version.py
updates the version field in SKILL.md
- Test verification:
scripts/backup_skill.py --validate-only
verifies skill format
Resource Index
- Optimization opportunity inspection tool: See scripts/check_optimization_opportunities.py (automatically scans skill-manager data to identify optimization opportunities and filter completed tasks)
- Optimization task management tool: See scripts/manage_optimization_tasks.py (add/delete/update/query of optimization tasks)
- Backup tool: See scripts/backup_skill.py (backs up skill directory)
- Restore tool: See scripts/restore_skill.py (restores skill from backup)
- Version management: See scripts/update_version.py (updates version number)
- Optimization guide: See references/optimization_guide.md (optimization types, test standards, best practices)
Notes
- Must backup the skill before optimization
- Keep task status synchronized during optimization process
- Must restore the skill if test fails
- Version numbers follow semantic versioning specifications
- Major changes require explicit user confirmation
- Must update task status to after optimization to avoid repeated reminders
- Remind user to reload the skill after optimization
Best Practices
- Regularly monitor skill-manager data to identify optimization opportunities
- Prioritize high-value, low-risk optimizations
- Fully analyze feasibility before optimization
- Maintain detailed optimization logs
- Regularly clean up expired backup files
- Provide clear optimization instructions to users
Usage Examples
Example 1: Add version field
Detected that SKILL.md of skill-name is missing version field.
- Notify user
- Create optimization task after user agrees
- Analyze feasibility: feasible
- Backup skill: skill-name.backup.20240122120000.skill
- Update SKILL.md, add version: v1.0.0
- Test verification: passed
- Update task status: completed
- Notify user: optimization successful
Example 2: Format improvement
Detected that SKILL.md of skill-name does not comply with format specifications.
- Notify user
- Create optimization task after user agrees
- Analyze feasibility: feasible
- Backup skill
- Correct SKILL.md format
- Test verification: passed
- Update task status: completed
- Notify user: optimization successful
Example 3: Infeasible optimization
Detected that optimization content of skill-name is overly complex.
- Notify user
- Create optimization task after user agrees
- Analyze feasibility: infeasible
- Update task status: failed
- Update notes: optimization content is overly complex, requires manual intervention
- Notify user: optimization is infeasible, manual processing required