Auto Skill Extractor
by @wahajahmed010
Automatically learn from your AI's work and turn repeated subagent tasks into reusable skills
clawhub install auto-skill-extractorπ About This Skill
auto-skill-extractor
Automatically learn from your AI's work and turn repeated subagent tasks into reusable skills.
Description
Watches subagent completions, detects patterns worth reusing, and creates draft skills automatically. After 3 successful re-invocations, drafts are promoted to active skills.
How It Works
1. Trigger: After every subagent completion, the main agent calls scripts/auto-skill-trigger.py
2. Score: Complexity is calculated (tool calls Γ 0.7, +2 for multi-domain, +2 for error recovery)
3. Extract: If score β₯ 4 and β₯ 3 tool calls β create DRAFT skill in skills/auto-draft/
4. Evaluate: After 3 successful re-invocations β promote to skills/auto/
5. Archive: Drafts unused for 7+ days β archived
Integration
Add to AGENTS.md or your agent's completion handler:
# After subagent completion
import subprocess, jsontrigger_input = {
"completion_status": "success", # or "failed", "timeout"
"tool_calls": tool_call_count,
"session_id": session_key,
"multi_domain": True, # if task crossed domains (files + web + system)
"transcript_summary": brief_summary # keep brief, no secrets
}
Method 1: Stdin (recommended, no file on disk)
result = subprocess.run(
["python3", "scripts/auto-skill-trigger.py"],
input=json.dumps(trigger_input),
capture_output=True, text=True
)Method 2: File (delete immediately after)
with open("/tmp/trigger.json", "w") as f:
json.dump(trigger_input, f)
result = subprocess.run(["python3", "scripts/auto-skill-trigger.py", "/tmp/trigger.json"], capture_output=True)
os.remove("/tmp/trigger.json")
Directives
#skill: β Manually trigger extraction from last subagent#skill: force β Force extraction (ignore thresholds)Commands
# List active auto-skills
python3 scripts/skill-lifecycle.py listList drafts under evaluation
python3 scripts/skill-lifecycle.py draftsProcess promotions and archives
python3 scripts/skill-lifecycle.py processManually promote a draft
python3 scripts/skill-lifecycle.py promote my-skill-name
Complexity Scoring
| Factor | Points | Example | |--------|--------|---------| | Tool calls Γ 0.7 | 2-5 pts | 3 tools = 2, 5 tools = 4 | | Multi-domain | +2 pts | Files + web + system | | Error recovery | +2 pts | Retry on failure |
Threshold: 4 points = creates DRAFT
Directory Structure
skills/
βββ auto-draft/ # Draft skills (under evaluation)
β βββ {name}-{hash}/
β βββ SKILL.md
β βββ meta.json
βββ auto/ # Promoted skills (ready to use)
β βββ {skill-name}/
β βββ SKILL.md
β βββ promotion.json
βββ manual/ # Hand-crafted skills
Configuration
COMPLEXITY_THRESHOLD = 4 β Lower = more drafts, more curation neededPROMOTE_THRESHOLD = 3 β Re-invocations before promotionARCHIVE_AGE_DAYS = 7 β Days before unused drafts archivedMAX_QUEUE_SIZE = 50 β Pending extraction limitSafety
Companion Skills
βοΈ Configuration
COMPLEXITY_THRESHOLD = 4 β Lower = more drafts, more curation neededPROMOTE_THRESHOLD = 3 β Re-invocations before promotionARCHIVE_AGE_DAYS = 7 β Days before unused drafts archivedMAX_QUEUE_SIZE = 50 β Pending extraction limit