Files
log/skills/stats/SKILL.md
T
jiantw83 7d803245a5 fix(overwrite): 只有頁面真的不存在才建新頁
- What:worklog、learn、report 三支技能共六處讀取分流改寫,只有結束碼 4 才建新頁;
  結束碼 7 與 8 一律中止,一個字都不寫。三份目錄頁樣板補上寫入語意,明寫禁止整頁覆蓋、
  不得改動別人的列。usage-stats.sh 的參數護欄改成明確回傳結束碼 2。
- Why:原本把「讀失敗」與「頁面不存在」當成同一件事。金鑰失效時讀取回 7,技能卻讀成
  「這頁還沒有」,於是照樣板建一份新頁蓋回去。整份工作日誌會被這一筆條目取代,
  既有教訓會被清成空表,報表則產出一份說「這段期間沒有工作」的假數字。
  這些內容只活在 wiki 上,蓋掉就救不回來,所以這是本輪最要緊的一項。
- How:每一處讀取都先看結束碼再決定動作,並在技能文件裡列成表格:
  0 接在既有內容後面附加,4 才從樣板建頁,5 缺網址就中止,7 金鑰或權限問題就中止,
  8 其他 API 失敗就中止。目錄頁一律先讀整頁再改那一列。
  stats 也補上分流,參數錯誤不再被讀成「零次」。
- Who:worklog、learn、report、stats 四支技能的 wiki 讀寫與統計輸出。
2026-08-31 11:07:16 +08:00

1.6 KiB

name, description
name description
stats Report usage counts of every jsc skill and every skill call chain, aggregated by tools/usage-stats.sh from $JSC_HOME/usage/*.jsonl recorded by jsc-hooks. Supports --cli filtering. Use when the user asks how often skills or chains are used; not for token or time stats (see worklog).

stats — skill and call-chain usage counts

Data is recorded continuously by jsc-hooks/hooks/skill-usage.sh under $JSC_HOME/usage/ (default ~/.jsc/usage/).

Operations

Count Command Output
Uses per skill tools/usage-stats.sh skills count<TAB>skill, descending
Uses per call chain tools/usage-stats.sh chains count<TAB>from -> to, descending
Filter by CLI Append --cli claude (or codex / copilot / antigravity / kiro) Same as above

Reporting

  1. Run the tool directly and branch on its exit code — never read the printed lines without it.

    Exit Do
    0 Present every printed line as one table row. No line printed is still exit 0: the data file under $JSC_HOME/usage/ does not exist yet, which is a count of zero, not a failure — say the counts are zero and that jsc-hooks has to be installed and wired via jsc-hooks:hooks-install before anything is recorded, and show no table
    2 The subcommand or the --cli argument was rejected — the subcommand is neither skills nor chains, or --cli came with no value. Fix the argument and rerun. Never rerun the same command unchanged, and never report the counts as zero: nothing was read

    Done when the exit code was read and the branch it names was taken.