Files
log/skills/learn/SKILL.md
T
jiantw83andClaude Fable 5 fac3285ca7 feat(learn): 新增技能教訓紀錄與查閱技能及 LEARN wiki 頁範本
What:新增 skills/learn/SKILL.md(record/consult 兩種模式)與 templates/learn-page.md、templates/learn-contents.md 兩份 wiki 頁範本。
Why:參考 oh-my-pi 的 learn 工具,讓技能執行後能把教訓沉澱下來、執行前能先查閱套用,避免同樣的問題重複發生。
How:教訓以六欄表格(日期、技能、CLI、情境、教訓、下次做法)逐列附加到 LEARN_{HASH},並同步更新 LEARN_CONTENTS 目錄;HASH 依共用 8 碼 wiki hash 規則(含 H 前綴退回),wiki 位置依 JSC_WIKI_REPO_LEARN → JSC_WIKI_REPO 解析,讀寫皆透過 jsc-gitea:wiki。
Who:jsc-log domain 的 learn 技能(教訓紀錄與查閱功能)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 11:36:45 +08:00

3.2 KiB

name, description
name description
learn Record a lesson learned after a skill run to wiki LEARN_{HASH} plus LEARN_CONTENTS, or consult past lessons before a skill run. Each entry is one table row with date, skill, CLI, situation, lesson, and next-time approach. HASH follows the shared 8-char rule with the H-prefix fallback. Use when a skill run produced a reusable lesson, or before running a skill to consult past lessons; not for work-time logs (see worklog).

learn — lessons learned

Close the loop on skill runs: record what a run taught you, consult it before the next run. Two modes — record and consult. Page content is chart-first Traditional Chinese (STE100): markdown table entries, prose as the last resort.

Target pages

  • Directory page: LEARN_CONTENTS. Content page: LEARN_{HASH}, one page per repository.
  • Compute {HASH} from {owner}/{repo} with jsc-gitea/tools/hash-id (shared wiki hash rule: first 8 uppercase SHA-1 hex chars; H plus the first 7 chars when the raw hash starts with 0-9, A, B, or C).
  • Wiki repo resolution: JSC_WIKI_REPO_LEARN first, then JSC_WIKI_REPO. Inspect the inherited shell environment variables first; ask the user per the jsc-ask:ask rules only when neither resolves. Never borrow another type's JSC_WIKI_REPO_{TYPE}.
  • All wiki reads and writes go through jsc-gitea:wiki.

Mode: record

Run after a skill run that produced a reusable lesson.

  1. Collect the six facts below. Done when every field has a value.

    # Field (page column) Source
    1 日期 Today, yyyy-MM-dd
    2 技能 The skill that ran, as jsc-{domain}:{name}
    3 CLI One of claude / codex / copilot / antigravity / kiro
    4 情境 What was happening when the lesson appeared, one sentence
    5 教訓 What the run taught, one sentence
    6 下次做法 How to apply it on the next run, one sentence
  2. Resolve {owner}/{repo} from git remote get-url origin and compute {HASH} with jsc-gitea/tools/hash-id. Done when the page name LEARN_{HASH} is known.

  3. Write the entry. This step MUST run as a sub agent; the main agent only confirms the write succeeded.

    • Read LEARN_{HASH} via jsc-gitea:wiki. If it does not exist, create it from templates/learn-page.md; otherwise APPEND the new row at the end of the table. Never overwrite existing rows.
    • Update LEARN_CONTENTS in the same pass (apply templates/learn-contents.md; add the repo row if missing, otherwise refresh its 最後更新時間).
    • Done when the sub agent reports both pages written and the main agent has confirmed the row exists on LEARN_{HASH}.

Mode: consult

Run before a skill run, to apply past lessons.

  1. Resolve {owner}/{repo} and compute {HASH} as in record mode. Done when LEARN_{HASH} is known.
  2. Read LEARN_CONTENTS and the repo's LEARN_{HASH} via jsc-gitea:wiki. When either page is missing (exit 4), report 「無教訓紀錄」 and let the caller proceed. Done when both pages are read or reported missing.
  3. Surface every row whose 技能 matches the skill about to run, and summarize each matched 下次做法 for the caller to apply. Done when the matched rows (or 「無相符教訓」) are reported.