技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
evolve-skill-from-traces【数据与研究】Evolve SKILL.md files from agent execution traces using a three-stage pipeline: trajectory collection from observed runs, parallel multi-agent patch proposal for error and success analysis, and conflict-free consolidation of overlapping edits via prevalence-weighting. Based on the Trace2Skill methodology.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
以三階流轉員執跡為驗 SKILL.md:軌集、並行多員補議、無衝合。此技接已觀員行與已記術,化成功之運為可復之技。
traces —— 員執日或會話錄(薦至少十成功運)target_skill —— 欲演 SKILL.md 之路,或 "new" 自零提技analyst_count —— 並行析員數(默 4)held_out_ratio —— 留以驗不用於草之跡比(默 0.2)集示目行之員會話日、工具呼序、或對話錄。篩標成功之運。正為標跡式:(state, action, outcome) 三元之序附時戳。
trace_entry:
state: <context before the action>
action: <tool call, command, or decision made>
outcome: <result, output, or state change>
timestamp: <ISO 8601>
held_out_ratio(默 20%)供第七步驗,餘供 2-6 步# Example: count available traces and compute partition
total_traces=$(ls traces/*.json | wc -l)
held_out=$(echo "$total_traces * 0.2 / 1" | bc)
drafting=$((total_traces - held_out))
echo "Drafting: $drafting traces, Held-out: $held_out traces"
得: 正後跡集分為草(80%)與留(20%)。各條含 state、action、outcome、timestamp 域。
敗則: 若成功跡不足十,先集更多。小集生過擬之技,新入則敗。若跡缺時戳,賦序號代之。
按結模聚正跡。識不變核(諸成功軌皆有之步)對變枝(諸運中異之步)。不變核為技術之骨。
invariant_core:
- action: "read_input_file"
frequency: 100%
- action: "validate_schema"
frequency: 100%
- action: "transform_data"
frequency: 100%
variant_branches:
- action: "retry_on_timeout"
frequency: 35%
condition: "network latency > 2s"
- action: "fallback_to_cache"
frequency: 15%
condition: "API returns 503"
得: 不變核行(諸跡皆有)與變枝(有條件,於子集)之明分。各變枝附頻計與觸條件。
敗則: 若無不變核現(跡過雜),目行或實為多異技。按結類分跡為一致子,各處之。
自不變核生初 SKILL.md:frontmatter、When to Use(自諸跡入條件導)、Inputs(諸運中異之參)、Procedure(各不變行一步)。
# Scaffold the skeleton if creating a new skill
mkdir -p skills/<skill-name>/
# Skeleton structure
## When to Use
- <derived from common entry conditions>
## Inputs
- **Required**: <parameters present in all traces>
- **Optional**: <parameters present in some traces>
## Procedure
### Step N: <invariant action label>
<most common implementation from traces>
**Expected:** <most common success outcome>
**On failure:** <placeholder -- refined in Steps 4-6>
得: 語法有效之 SKILL.md 骨含 frontmatter、When to Use、Inputs、Procedure 各不變核行一步。Expected 映已觀結;On failure 為占位。
敗則: 若骨加變枝前已逾 500 行,不變核過細。合常共現之鄰行為單步。目標 5-10 步。
生 N 析員(薦 4-6),各以異析鏡審全跡集對草骨。各員生結補:節、舊文、新文、理。
各員一鏡:
| Analyst | Lens | Focus |
|---|---|---|
| 1 | Correctness | Does the skeleton capture all success paths? Are any invariant steps missing? |
| 2 | Efficiency | Are there redundant steps? Can any steps be merged or parallelized? |
| 3 | Robustness | Which failure modes are unhandled? What should On failure blocks contain? |
| 4 | Edge Cases | Which variant branches should become conditional steps or pitfalls? |
| 5 (optional) | Clarity | Is each step unambiguous? Can an agent follow it mechanically? |
| 6 (optional) | Generalizability | Are there trace-specific artifacts that should be abstracted? |
各析員受:
各員返結補之列:
patch:
analyst: "robustness"
section: "Procedure > Step 3"
old_text: "**On failure:** <placeholder>"
new_text: "**On failure:** If the API returns 503, wait 5 seconds and retry up to 3 times. If retries are exhausted, fall back to the cached response from the previous successful run."
rationale: "Traces #4, #7, #12 show 503 errors resolved by retry. Trace #15 shows cache fallback when retries fail."
supporting_traces: [4, 7, 12, 15]
得: 各員返 3-10 結補附節引、舊新文、理、援跡 ID。諸補集為一補集。
敗則: 若員返無補,其鏡或不適此技。可——非各鏡皆浮問。若員返模糊補無跡引,拒並求具體 supporting_traces 再生。
較四步諸補之重編。各重對類為三。
| Conflict Type | Definition | Resolution |
|---|---|---|
| Compatible | Different sections, no overlap | Merge directly |
| Complementary | Same section, additive (both add content, no contradiction) | Combine text |
| Contradictory | Same section, mutually exclusive (one adds X, other removes X or adds Y instead) | Needs resolution in Step 6 |
conflict_report:
total_patches: 24
compatible: 18
complementary: 4
contradictory: 2
contradictions:
- section: "Procedure > Step 5"
patch_a: {analyst: "efficiency", action: "remove step"}
patch_b: {analyst: "robustness", action: "add retry logic"}
supporting_traces_a: [2, 8, 11]
supporting_traces_b: [4, 7, 12, 15]
得: 衝報列諸補對、類、及於矛盾各方之援跡計。
敗則: 若類模糊(補同節加又改),分為二:一加、一改。類小補。
以三層解策合諸補為單 SKILL.md。
argumentation 技評何補更事技之目consolidation_log:
applied_directly: 18
combined: 4
resolved_by_prevalence: 1
resolved_by_argumentation: 1
rejected_alternatives_documented: 2
合後驗 SKILL.md:
得: 單合 SKILL.md 含諸員補。矛盾以記理解。各矛盾之被拒替現為陷或注。
敗則: 若合生內不一之文(如第三步假文存而第二步被效率補去),復原衝編,該節留原骨文。標不一供手審。
心中以留跡(一步留 20%)運合技。驗 Expected/On failure 合未見跡中已觀結。
validation_results:
held_out_traces: 5
full_match: 4
partial_match: 1
no_match: 0
mismatches:
- trace_id: 23
step: 4
expected: "API returns 200"
actual: "API returns 429 (rate limited)"
action: "Add rate-limit handling to On failure block"
create-skill 造目、登條、造 symlinkevolve-skill 升版並同譯# Final validation: line count
lines=$(wc -l < skills/<skill-name>/SKILL.md)
[ "$lines" -le 500 ] && echo "OK ($lines lines)" || echo "FAIL: $lines lines > 500"
得: 至少 80% 留跡合技首尾。技於 skills/_registry.yml 登附正元數。
敗則: 若驗敗(>20% 不合),技過擬草跡。加不合跡入草集重運自第二步。若二迭仍敗,行或過變為單技——按結類分為多技。
evolve-skill —— 簡之人導演(互補:跡不得時用)create-skill —— 為新提尚未存之技;七步登中用review-skill-format —— 合後驗以確 agentskills.io 合規argumentation —— 六步中解頻等之矛盾補verify-agent-output —— 補議之證鏈;四步中驗員出