@qijenchen/design-system 0.1.0-beta.35 → 0.1.0-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CLAUDE.md +3 -3
  2. package/ds-canonical/hooks/check_dim_count_drift.sh +3 -3
  3. package/ds-canonical/hooks/check_pattern_invariants.sh +3 -1
  4. package/ds-canonical/hooks/check_post_main_ssot_propagate.sh +1 -1
  5. package/ds-canonical/hooks/check_storybook_addon_preset_cjs.sh +7 -2
  6. package/ds-canonical/hooks/inject_deploy_url_after_push.sh +5 -1
  7. package/ds-canonical/hooks/lib/_token_hygiene.sh +3 -2
  8. package/ds-canonical/hooks/session_start_governance_check.sh +32 -3
  9. package/ds-canonical/hooks/tests/test_check_token_hygiene.sh +1 -1
  10. package/ds-canonical/references/build-ui-canonicals.md +2 -2
  11. package/ds-canonical/references/item-anatomy-recipe.md +1 -1
  12. package/ds-canonical/references/ssot-consultation.md +1 -1
  13. package/ds-canonical/references/tailwind-gotchas.md +1 -1
  14. package/ds-canonical/rules/meta-patterns.md +2 -2
  15. package/ds-canonical/rules/story-rules.md +4 -4
  16. package/ds-canonical/skills/README.md +2 -2
  17. package/ds-canonical/skills/bug-fix-rhythm/SKILL.md +1 -1
  18. package/ds-canonical/skills/code-quality-audit/SKILL.md +2 -2
  19. package/ds-canonical/skills/codex-collab/SKILL.md +4 -4
  20. package/ds-canonical/skills/codify-corrections/SKILL.md +5 -5
  21. package/ds-canonical/skills/codify-principle/SKILL.md +2 -2
  22. package/ds-canonical/skills/component-quality-gate/SKILL.md +6 -6
  23. package/ds-canonical/skills/deep-audit-cross-codex/SKILL.md +5 -58
  24. package/ds-canonical/skills/deep-audit-cross-codex/references/phase-a-workflow.md +2 -2
  25. package/ds-canonical/skills/deep-audit-cross-codex/references/phase-b-codex-brief.md +23 -2
  26. package/ds-canonical/skills/deep-audit-cross-codex/references/skill-relationships-antipatterns-benchmarks.md +30 -0
  27. package/ds-canonical/skills/deep-audit-cross-codex/references/upstream-directives-r-mapping.md +33 -0
  28. package/ds-canonical/skills/design-system-audit/SKILL.md +24 -10
  29. package/ds-canonical/skills/design-system-audit/references/audit-prompts.md +16 -16
  30. package/ds-canonical/skills/design-system-audit/references/principle-audit-protocol.md +1 -1
  31. package/ds-canonical/skills/design-system-audit/references/rule-placement.md +10 -10
  32. package/ds-canonical/skills/ensure-canonical/SKILL.md +2 -2
  33. package/ds-canonical/skills/governance-health/SKILL.md +3 -2
  34. package/ds-canonical/skills/knowledge-prune/SKILL.md +10 -77
  35. package/ds-canonical/skills/knowledge-prune/references/phase-z-cross-repo-ssot-propagation.md +11 -0
  36. package/ds-canonical/skills/knowledge-prune/references/prune-dimensions-d5-d10.md +55 -0
  37. package/ds-canonical/skills/knowledge-prune/references/world-class-prune-alignment.md +7 -0
  38. package/ds-canonical/skills/new-component/SKILL.md +1 -1
  39. package/ds-canonical/skills/new-component/references/new-component-checklist.md +1 -1
  40. package/ds-canonical/skills/product-ui-audit/SKILL.md +9 -9
  41. package/ds-canonical/skills/product-ui-audit/references/audit-checks.md +3 -3
  42. package/ds-canonical/skills/product-ui-audit/references/report-template.md +1 -1
  43. package/ds-canonical/skills/propose-options/SKILL.md +18 -18
  44. package/ds-canonical/skills/prototype/SKILL.md +2 -2
  45. package/ds-canonical/skills/prototype/references/audit-checks.md +1 -1
  46. package/ds-canonical/skills/prototype/references/evaluation-matrix.md +1 -1
  47. package/ds-canonical/skills/prototype/references/proposal-template.md +1 -1
  48. package/ds-canonical/skills/scan-similar-bugs/SKILL.md +5 -5
  49. package/ds-canonical/skills/story-auto-compile-migrate/SKILL.md +2 -2
  50. package/ds-canonical/skills/story-writing/SKILL.md +3 -3
  51. package/ds-canonical/skills/story-writing/references/anatomy-standard.md +2 -2
  52. package/ds-canonical/skills/story-writing/references/category-templates.md +2 -2
  53. package/ds-canonical/skills/visual-audit/SKILL.md +3 -3
  54. package/ds-canonical/skills/visual-audit/references/visual-checklist.md +3 -3
  55. package/ds-canonical/skills/visual-audit/references/world-class-benchmarks.md +2 -2
  56. package/ds-story-manifest.json +1 -1
  57. package/package.json +1 -1
  58. package/src/styles/base.css +42 -5
  59. package/src/styles/tokens.css +1 -1
  60. package/src/tokens/color/primitives.css +7 -0
@@ -7,7 +7,7 @@ description: Prune governance sprawl across CLAUDE.md / specs / skills / hooks /
7
7
 
8
8
  **目的**:本 DS governance 自身是活的知識庫,若只 append 會讓 CLAUDE.md 載入成本失控、MEMORY.md 條目爆炸、hook 變殭屍、spec.md 重複。本 skill 掃 8 個 home 找冗贅,提議 retire 候選,加嚴執行 Rule-of-3 SSOT + 行數預算。
9
9
 
10
- **對齊 CLAUDE.md `# 資訊治理 canonical`**:本 skill 是 L3(Periodic deep)實作。L1(pre-write hook)+ L2(fire log)自動執行,L3 需人決策 canonical retire,走 checkpoint。
10
+ **對齊 CLAUDE.md `# 治理 canonical`**:本 skill 是 L3(Periodic deep)實作。L1(pre-write hook)+ L2(fire log)自動執行,L3 需人決策 canonical retire,走 checkpoint。
11
11
 
12
12
  **對齊 CLAUDE.md `# 稽核 canonical`「Audit-vs-execute 分權」**:動 canonical substantive meaning → **STOP 提議**;對齊 / 清 duplicate / 回填 pointer → **AUTO**。
13
13
 
@@ -72,7 +72,7 @@ Scan:同概念(同 keyword / 同 canonical)出現在 ≥ 3 個不同 home 寫完
72
72
  Example violations(historic — 2026-05-22 prune verify 後均已收斂為 pointer 模式,僅留作教學範例):
73
73
  - `Portal 逃脫 theme`:過去在 hover-card.spec.md / avatar.spec.md / color.spec.md 各重述;現只 M3 SSOT + 各 spec pointer。2026-05-22 audit verify 為已對齊(僅 ui-development.md / meta-patterns.md 2 home 涉及,clean pointer)
74
74
  - `Inline Action vs Button predicate`:過去 CLAUDE.md / item-anatomy.spec.md / button.spec.md 各完整;現 `inline-action.spec.md` 為 SSOT,其他 cross-link
75
- - 新範例(2026-05-22 抓):**hook count threshold** 在 CLAUDE.md L35 / meta-patterns M14 / M20 / `session_start_governance_check.sh:173` 4 處 drift 3 值(40/35/30)→ M14/M20 strip 數字改 pointer SSOT 修
75
+ - 新範例(2026-05-22 抓):**hook count threshold** 在 CLAUDE.md `# 治理 canonical` 行數預算表 / meta-patterns M14 / M20 / `session_start_governance_check.sh` 4 處 drift 3 值(40/35/30)→ M14/M20 strip 數字改 pointer SSOT 修
76
76
 
77
77
  **Output**:duplicate cluster 清單 + 建議 SSOT home。
78
78
 
@@ -104,68 +104,19 @@ Example:
104
104
 
105
105
  **Output**:matrix of 衝突點 + 誰該讓步
106
106
 
107
- #### D5 — Canonical drift(spec vs code 語義漂移)— 2026-05-17 加
107
+ #### D5-D102026-05-17 加維度(各維 scan + Example + Output 詳 references/prune-dimensions-d5-d10.md)
108
108
 
109
- Scan:`*.spec.md` 寫的 canonical vs `*.tsx` 實際 code 行為衝突 / spec 寫禁止但 code 仍用 / spec 升級但 code 沒跟。
110
-
111
- Example:
112
- - `radius.spec.md:57-71` 禁 `rounded-xl/2xl/3xl` → grep `packages/design-system/src/**/*.tsx` 仍有用 → drift
113
- - `field-controls.spec.md` v13 state machine 升級 → 但 Combobox.tsx 還是 v12 behavior → drift
114
-
115
- **Output**:per (spec, code) drift entry + 對應 commit hash 追溯 last alignment 時點
116
-
117
- #### D6 — Hook-fire health(log-driven)— 2026-05-17 加
118
-
119
- 讀 `.claude/logs/hook-fires-per-hook.jsonl`,3 大病徵:
120
- - **Dead**:6 月 0 fire(retire 候選,per `# Retire rules` Hook 規則)
121
- - **Hot**(過 fire):fire / day > 50 → 可能 false positive 多 / regex 太鬆
122
- - **Toggle pattern**:同 fire 反覆 inject + retract → hook design 不穩
123
-
124
- **Output**:dead retire list + hot tune list + toggle re-design list
125
-
126
- #### D7 — Skill-invoke health(log-driven)— 2026-05-17 加
127
-
128
- 讀 `.claude/logs/skill-invokes.jsonl`,2 大病徵:
129
- - **Unused**:3 月 0 invoke(除 rare-event skill 如 delivery-handoff)
130
- - **Always co-invoked**:Skill A 永遠跟 Skill B 一起 invoke → 該合 1 skill 或 chain auto
131
-
132
- **Output**:retire list + merge candidate list
133
-
134
- #### D8 — Memory recency / orphan— 2026-05-17 加
135
-
136
- Scan `~/.claude/.../memory/*.md`:
137
- - 6 月無 git log 變動 + 不在 MEMORY.md index head = stale candidate(per existing D2 retire rule)
138
- - file 存在但 MEMORY.md 沒 entry = orphan(可能 retire 漏刪)
139
- - entry 存在但 file 不在 = broken pointer
140
-
141
- **Output**:stale / orphan / broken pointer 3-class list
142
-
143
- #### D9 — Benchmark / citation debt(2026-05-17 加,對應 M22)
144
-
145
- Scan 全 repo:
146
- - `@benchmark-unverified-blanket` marker(per file retraction;codify 後該 backfill cite 變 verified)
147
- - spec.md / tsx 含 world-class DS keyword(Material / Polaris / Carbon / Ant / Atlassian / Apple)但無 inline URL / GitHub path / screenshot ref
148
- - 過期 benchmark(cite URL 是 v3 但 framework 已 v5)
149
-
150
- **Output**:per (file, claim) cite debt entry + 建議 WebFetch 補 source
151
-
152
- #### D10 — Verification artifact rot(2026-05-17 加,對應 M32)
153
-
154
- Scan 全 audit / test infra:
155
- - audit script 只驗 `getAttribute(...)` / `class.includes(...)` 不驗 `getBoundingClientRect()` numeric(pixel-quantified 缺)
156
- - `*.spec.md` 寫 visual canonical 但無對應 playwright snapshot 或 visual-audit 覆蓋
157
- - stale screenshot ref(snapshot file 6 月未更新)
158
-
159
- **Output**:per audit script 升 pixel-quantified 提名 + 缺 visual coverage 列表
109
+ D5 Canonical drift(spec vs code)/ D6 Hook-fire health / D7 Skill-invoke health / D8 Memory recency-orphan / D9 Benchmark-citation debt(M22)/ D10 Verification artifact rot(M32)。
160
110
 
161
111
  ### Phase 2 — Triage + Checkpoint 1(MUST ASK)
162
112
 
163
113
  ```
164
- Phase 1 findings:
114
+ Phase 1 findings(D1-D10):
165
115
  - D1 duplicate: M clusters
166
116
  - D2 dead/stale: N items
167
117
  - D3 over-concrete: K items (abstract proposals)
168
118
  - D4 contradiction: L pairs
119
+ - D5-D10(2026-05-17 加,detail 詳 references/prune-dimensions-d5-d10.md): D5 canonical drift / D6 hook-fire health / D7 skill-invoke health / D8 memory recency-orphan / D9 benchmark-citation debt / D10 verification artifact rot — 各 N items
169
120
 
170
121
  Priority:
171
122
  - P0 (AUTO): 對齊 SSOT / 補 pointer / 刪 confirmed dead hook / retire unused skill — 表達層調整,不動 canonical 意思
@@ -188,15 +139,9 @@ Proceed with P0+P1 as atomic commit? Then discuss P2?
188
139
  - 每 P2 item 一個獨立 commit(animation trail 可回溯)
189
140
  - 新 meta-pattern 加進 CLAUDE.md `# Meta-Pattern 預警` → 同時**必檢討哪些下游條目冗餘**(上游加 = 下游減)
190
141
 
191
- ### Phase Z reference — Cross-repo SSOT propagation(2026-05-26 retract skill-specific Phase Z,移到 CLAUDE.md canonical)
192
-
193
- **Per user 2026-05-26 correction**:「不是只要一 knowledge audit deep 之後就要,是等我 push main 後才要」。
142
+ ### Phase Z reference — Cross-repo SSOT propagation
194
143
 
195
- Cross-repo SSOT sync trigger 不是「skill 跑完」而是「push main 後 SSOT-affecting diff」— canonical 統一在:
196
- - `CLAUDE.md` `# Git solo-work canonical` Step 5.5
197
- - Hook `check_post_main_ssot_propagate.sh`(PostToolUse Bash 偵測 `git push origin main` + diff)
198
-
199
- → /knowledge-prune skill 本身**不負責 trigger sync**;Phase 3-4 commit + Phase 6 user 拍板 push main 後,canonical hook 自動偵測 SSOT diff + 提議 npm bump。**整鏈 1 trigger 同時 cover /deep-audit-cross-codex / 一般 dev / 任何 SSOT-affecting 來源**(DRY,不複製到每個 skill)。
144
+ 詳 references/phase-z-cross-repo-ssot-propagation.md(2026-05-26 retract skill-specific Phase Z;sync trigger = push main 後 SSOT-affecting diff,canonical 在 CLAUDE.md `# Git solo-work canonical` Step 5.5 + hook check_post_main_ssot_propagate.sh)。
200
145
 
201
146
  ---
202
147
 
@@ -293,23 +238,11 @@ Phase 1 D3 發現 5+ 條下游條目可被新 meta 吸收 → 提議新 Meta-Pat
293
238
 
294
239
  ## 世界級對照
295
240
 
296
- skill 是本 DS 原創的自我 prune 機制,但對齊:
297
-
298
- - **Elasticsearch Index Lifecycle Management**:hot / warm / cold 階段自動降級 + delete old data — 類 retire rate
299
- - **Linux kernel doc policy**:Sphinx deprecation warnings + removal schedule — 類 transition period 過渡期
300
- - **Python PEP 387 Backwards Compatibility Policy**:明定哪些改動需 deprecation 期,哪些可立刻刪 — 類 P0 vs P2 triage
241
+ references/world-class-prune-alignment.md(Elasticsearch ILM / Linux kernel doc policy / Python PEP 387)。
301
242
 
302
243
  ## 與其他 skill 的分工
303
244
 
304
245
  | Skill | Scope | 不重疊點 |
305
246
  |-------|-------|---------|
306
- | `/design-system-audit` | **33 DS code + spec audit**(Phase 0 自建 baseline) | 不管治理文件冗贅 — 找 bug / drift,不 prune governance 大小 |
247
+ | `/design-system-audit` | **full-dim DS code + spec audit**(Phase 0 自建 baseline) | 不管治理文件冗贅 — 找 bug / drift,不 prune governance 大小 |
307
248
  | `/knowledge-prune` | **治理文件冗贅 + 行數 + 矛盾** | 不 audit DS code 本體 — 管 governance 不管 DS |
308
-
309
- ---
310
-
311
- ## Non-goals 重申
312
-
313
- - 不 refactor spec.md 內容(改寫走 `/design-system-audit`)
314
- - 不 retire 有 active consumer 的 rule(必先改 consumer)
315
- - 不處理 `git log` 歷史 / 歷史 commit 訊息
@@ -0,0 +1,11 @@
1
+ # Phase Z reference — Cross-repo SSOT propagation(knowledge-prune SKILL.md「Phase Z reference」extract)
2
+
3
+ ### Phase Z reference — Cross-repo SSOT propagation(2026-05-26 retract skill-specific Phase Z,移到 CLAUDE.md canonical)
4
+
5
+ **Per user 2026-05-26 correction**:「不是只要一 knowledge audit deep 之後就要,是等我 push main 後才要」。
6
+
7
+ Cross-repo SSOT sync trigger 不是「skill 跑完」而是「push main 後 SSOT-affecting diff」— canonical 統一在:
8
+ - `CLAUDE.md` `# Git solo-work canonical` Step 5.5
9
+ - Hook `check_post_main_ssot_propagate.sh`(PostToolUse Bash 偵測 `git push origin main` + diff)
10
+
11
+ → /knowledge-prune skill 本身**不負責 trigger sync**;Phase 3-4 commit + Phase 6 user 拍板 push main 後,canonical hook 自動偵測 SSOT diff + 提議 npm bump。**整鏈 1 trigger 同時 cover /deep-audit-cross-codex / 一般 dev / 任何 SSOT-affecting 來源**(DRY,不複製到每個 skill)。
@@ -0,0 +1,55 @@
1
+ # Prune Phase 1 D5-D10 dimension detail(2026-05-17 加;knowledge-prune SKILL.md Phase 1 extract)
2
+
3
+ #### D5 — Canonical drift(spec vs code 語義漂移)— 2026-05-17 加
4
+
5
+ Scan:`*.spec.md` 寫的 canonical vs `*.tsx` 實際 code 行為衝突 / spec 寫禁止但 code 仍用 / spec 升級但 code 沒跟。
6
+
7
+ Example:
8
+ - `radius.spec.md:57-71` 禁 `rounded-xl/2xl/3xl` → grep `packages/design-system/src/**/*.tsx` 仍有用 → drift
9
+ - `field-controls.spec.md` v13 state machine 升級 → 但 Combobox.tsx 還是 v12 behavior → drift
10
+
11
+ **Output**:per (spec, code) drift entry + 對應 commit hash 追溯 last alignment 時點
12
+
13
+ #### D6 — Hook-fire health(log-driven)— 2026-05-17 加
14
+
15
+ 讀 `.claude/logs/hook-fires-per-hook.jsonl`,3 大病徵:
16
+ - **Dead**:6 月 0 fire(retire 候選,per `# Retire rules` Hook 規則)
17
+ - **Hot**(過 fire):fire / day > 50 → 可能 false positive 多 / regex 太鬆
18
+ - **Toggle pattern**:同 fire 反覆 inject + retract → hook design 不穩
19
+
20
+ **Output**:dead retire list + hot tune list + toggle re-design list
21
+
22
+ #### D7 — Skill-invoke health(log-driven)— 2026-05-17 加
23
+
24
+ 讀 `.claude/logs/skill-invokes.jsonl`,2 大病徵:
25
+ - **Unused**:3 月 0 invoke(除 rare-event skill 如 delivery-handoff)
26
+ - **Always co-invoked**:Skill A 永遠跟 Skill B 一起 invoke → 該合 1 skill 或 chain auto
27
+
28
+ **Output**:retire list + merge candidate list
29
+
30
+ #### D8 — Memory recency / orphan— 2026-05-17 加
31
+
32
+ Scan `~/.claude/.../memory/*.md`:
33
+ - 6 月無 git log 變動 + 不在 MEMORY.md index head = stale candidate(per existing D2 retire rule)
34
+ - file 存在但 MEMORY.md 沒 entry = orphan(可能 retire 漏刪)
35
+ - entry 存在但 file 不在 = broken pointer
36
+
37
+ **Output**:stale / orphan / broken pointer 3-class list
38
+
39
+ #### D9 — Benchmark / citation debt(2026-05-17 加,對應 M22)
40
+
41
+ Scan 全 repo:
42
+ - `@benchmark-unverified-blanket` marker(per file retraction;codify 後該 backfill cite 變 verified)
43
+ - spec.md / tsx 含 world-class DS keyword(Material / Polaris / Carbon / Ant / Atlassian / Apple)但無 inline URL / GitHub path / screenshot ref
44
+ - 過期 benchmark(cite URL 是 v3 但 framework 已 v5)
45
+
46
+ **Output**:per (file, claim) cite debt entry + 建議 WebFetch 補 source
47
+
48
+ #### D10 — Verification artifact rot(2026-05-17 加,對應 M32)
49
+
50
+ Scan 全 audit / test infra:
51
+ - audit script 只驗 `getAttribute(...)` / `class.includes(...)` 不驗 `getBoundingClientRect()` numeric(pixel-quantified 缺)
52
+ - `*.spec.md` 寫 visual canonical 但無對應 playwright snapshot 或 visual-audit 覆蓋
53
+ - stale screenshot ref(snapshot file 6 月未更新)
54
+
55
+ **Output**:per audit script 升 pixel-quantified 提名 + 缺 visual coverage 列表
@@ -0,0 +1,7 @@
1
+ # knowledge-prune 世界級對照(knowledge-prune SKILL.md「世界級對照」extract)
2
+
3
+ 本 skill 是本 DS 原創的自我 prune 機制,但對齊:
4
+
5
+ - **Elasticsearch Index Lifecycle Management**:hot / warm / cold 階段自動降級 + delete old data — 類 retire rate
6
+ - **Linux kernel doc policy**:Sphinx deprecation warnings + removal schedule — 類 transition period 過渡期
7
+ - **Python PEP 387 Backwards Compatibility Policy**:明定哪些改動需 deprecation 期,哪些可立刻刪 — 類 P0 vs P2 triage
@@ -134,7 +134,7 @@ traits:
134
134
 
135
135
  **Phase 5.1-5.3 — 三層 stories**:
136
136
 
137
- 1. **`{name}.stories.tsx` 展示**:per Phase 5.0 declared traits → 對照 `category-templates.md` 衍生 required core stories(`hasVariants` → AllVariants / `hasSizes` → AllSizes / `isOverlay` → OpenSnapshot 等)。再加 1-2 真實業務 scenario(Jira / Stripe / Notion 過 earn-existence)。Hook `check_story_category.sh` write-time 攔不符 trait core。
137
+ 1. **`{name}.stories.tsx` 展示**:per Phase 5.0 declared traits → 對照 `category-templates.md` 衍生 required core stories(`hasVariants` → AllVariants / `hasSizes` → AllSizes / `isOverlay` → OpenSnapshot 等)。再加 1-2 真實業務 scenario(Jira / Stripe / Notion 過 earn-existence)。Hook `check_story_invariants.sh` R3 category(原 check_story_category.sh folded 折入)write-time 攔不符 trait core。
138
138
  2. **`{name}.anatomy.stories.tsx` 設計規格**:5-story 標準(Overview + SizeMatrix + ColorMatrix + StateBehavior + Inspector)或合理 subset + rationale。
139
139
  3. **`{name}.principles.stories.tsx` 設計原則**(對齊 Polaris/Carbon/Ant canonical,2026-04-26):universal core ≥ 2 of {`WhenToUse` / `WhenNotToUse` / `Vs{Sibling}Rule` / `ContentGuidelines`}。do / don't 情境對照,每則 Rule title + Rule note + 範例。Hook `check_principles_canonical.sh` write-time 攔不符。
140
140
 
@@ -59,7 +59,7 @@
59
59
  - [ ] `{name}.principles.stories.tsx` 含 do/don't Rule stories,每則 title + note + 範例
60
60
  - [ ] 「人」test 過:遮標題 5 秒能懂情境
61
61
  - [ ] 「舉一反三」test 過:讀者推得出自己產品怎用
62
- - [ ] hook `check_story_anatomy.sh` 未觸發 block(無手刻 list item / label Button dismiss / 自刻 overlay)
62
+ - [ ] hook `check_story_invariants.sh` R1 anatomy(原 check_story_anatomy.sh folded 折入)未觸發 block(無手刻 list item / label Button dismiss / 自刻 overlay)
63
63
  - [ ] Storybook title path 正確(`Design System/Components/{Name}/{中文子頁}` 或 `Internal/{Name}/...`)
64
64
 
65
65
  ## Phase 6 — Self quality-gate chain
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: product-ui-audit
3
- description: Audit product / consumer UI code (非 design-system 本身) against DS usage discipline + mindset adherence. Catches element misuse / design principle violations / token leakage / geometry bugs / a11y gaps across 6 dimensions. Invoke via /product-ui-audit when user says「audit 這個 UI」「檢查 X feature 用對 DS 嗎」「這段 code 符合設計原則嗎」,or auto-invoked by /prototype Phase 3.5 gate.
3
+ description: Audit product / consumer UI code (非 design-system 本身) against DS usage discipline + mindset adherence. Catches element misuse / design principle violations / token leakage / geometry bugs / a11y gaps across 7 dimensions. Invoke via /product-ui-audit when user says「audit 這個 UI」「檢查 X feature 用對 DS 嗎」「這段 code 符合設計原則嗎」,or auto-invoked by /prototype Phase 3.5 gate.
4
4
  ---
5
5
 
6
6
  # Product UI Audit Workflow
@@ -38,24 +38,24 @@ Purpose: design-system-audit audits the **DS itself**(spec / cva / SSOT 三方
38
38
  ## Preconditions
39
39
 
40
40
  - User 指定 audit target(file path / folder / feature area)
41
- - Target 是 consumer 層 UI code(`src/app/**` / `src/explorations/**` / `src/pages/**` / `src/features/**`等 — **不掃 `packages/design-system/src/`**)
42
- - CLAUDE.md 全讀(6 維 audit 都依此為基準)
41
+ - Target 是 consumer 層 UI code(`src/app/**` / `src/explorations/**` / `src/pages/**` / `src/features/**` / `apps/**`(含 DS repo 自家 `apps/template` + create-app 產物)等 — **不掃 `packages/design-system/src/`**)
42
+ - CLAUDE.md 全讀(7 維 audit 都依此為基準)
43
43
 
44
44
  ---
45
45
 
46
- ## 6-Dimension Audit
46
+ ## 7-Dimension Audit
47
47
 
48
48
  每個 dimension 獨立檢查,產出 findings。詳細 grep pattern + rule 見 `references/audit-checks.md`。
49
49
 
50
50
  ### Dim 1 — Token 紀律(token hygiene)
51
51
 
52
52
  - 硬寫 hex / rgb / rgba / hsl 色值
53
- - shadcn compat alias(bg-popover / text-muted-foreground / bg-accent / bg-destructive / bg-background / bg-card / border-input / text-primary-foreground / text-accent-foreground / text-card-foreground / text-popover-foreground)
53
+ - shadcn compat alias(bg-popover / text-muted-foreground / bg-accent / bg-destructive / bg-background / bg-card / border-input / text-primary-foreground / text-accent-foreground / text-card-foreground / text-popover-foreground)**(完整 deny-list SSOT:`packages/design-system/src/tokens/utility-registry.json`;此處 inline 為 grep 便利,新增 alias 改 registry)**
54
54
  - Tailwind default shadow(shadow-sm / md / lg / xl / 2xl / inner)— 應走 elevation token
55
55
  - Tailwind v4 `[--foo]` shorthand 靜默失效
56
56
  - 硬寫 px 值當該用 token(`w-[48px]` 應改 token)
57
57
 
58
- 此維對齊既有 `check_token_hygiene.sh` hook 4 + 擴充硬色值 / 硬 px 檢查。
58
+ 此維對齊既有 token 防線(`lib/_token_hygiene.sh` 5-check:shadcn alias / v4 shorthand / hardcoded shadow / primitive-color-as-utility / native overflow,由 `post_edit_dispatcher.sh` source;+ `check_opacity_token_usage.sh` 讀 utility-registry.json)+ 擴充硬色值 / 硬 px 檢查。
59
59
 
60
60
  ### Dim 2 — Layout primitive 消費(per CLAUDE.md 清單)
61
61
 
@@ -95,7 +95,7 @@ Purpose: design-system-audit audits the **DS itself**(spec / cva / SSOT 三方
95
95
  - **M4 真實業務場景**:stories / examples 用真實場景 (Jira / Stripe / Notion...)?無 `Option A/B/C` / `按鈕一` / `Rule A`?
96
96
  - **M5 猶豫就問**:code 裡有 TODO-未確認留白?
97
97
 
98
- ### Dim 5 — 視覺幾何(Mindset #1 視覺擴充 + CLAUDE.md「同 flex 列互動 slot 幾何鐵律」)
98
+ ### Dim 5 — 視覺幾何(Mindset #1 視覺擴充 + .claude/references/ui-dev-rules.md「同 flex 列互動 slot 幾何鐵律」)
99
99
 
100
100
  - 同 flex 行的互動 slot box 尺寸一致(例:FileItem status / delete 都 h-field-sm)
101
101
  - hover-bg / ring / focus outline 不溢出 box 吃 gap token
@@ -133,7 +133,7 @@ chain `.claude/skills/design-system-audit/references/principle-audit-protocol.md
133
133
 
134
134
  ### Phase 1 — Parallel 6-dim audit
135
135
 
136
- 6 個維度各自獨立 grep + code review。可 parallelize。
136
+ 7 個維度各自獨立 grep + code review。可 parallelize。
137
137
 
138
138
  ### Phase 2 — Report
139
139
 
@@ -225,6 +225,6 @@ audit 完畢報告應含:
225
225
 
226
226
  ## References
227
227
 
228
- - [references/audit-checks.md](references/audit-checks.md) — 6 維度具體 grep pattern + rule
228
+ - [references/audit-checks.md](references/audit-checks.md) — 7 維度具體 grep pattern + rule
229
229
  - [references/common-misuses.md](references/common-misuses.md) — 常見元件誤用 negative example 庫
230
230
  - [references/report-template.md](references/report-template.md) — P0/P1/P2 severity 分類 + report 格式
@@ -1,4 +1,4 @@
1
- # Audit Checks — 6 維度 grep pattern + rule
1
+ # Audit Checks — 7 維度 grep pattern + rule
2
2
 
3
3
  每個維度的具體 check。AI Phase 1 parallel 執行時依此 grep + rule 判斷。
4
4
 
@@ -12,7 +12,7 @@
12
12
  grep -nE '\b(bg-popover|text-popover-foreground|text-muted-foreground|bg-accent|text-accent-foreground|bg-destructive|bg-background|bg-card|text-card-foreground|border-input|text-primary-foreground)\b' {target}
13
13
  ```
14
14
 
15
- **Severity**: P0。**Fix**: 對映見 `check_token_hygiene.sh` hook。
15
+ **Severity**: P0。**Fix**: 對映見 token 防線 `lib/_token_hygiene.sh` + `check_opacity_token_usage.sh`。
16
16
 
17
17
  ### Check 1.2: Tailwind default shadow
18
18
 
@@ -192,7 +192,7 @@ grep -nE '(TODO:\s*待確認|TODO:\s*decide|FIXME|XXX)' {target}
192
192
 
193
193
  例: FileItem `status slot(16px)` + `delete Button sm(28px)` = 不一致 → hover-bg 吃 gap。
194
194
 
195
- **Severity**: P0(世界級 DS 鐵律違反,違反 CLAUDE.md「同 flex 列的互動 slot 幾何鐵律」)。
195
+ **Severity**: P0(世界級 DS 鐵律違反,違反 .claude/references/ui-dev-rules.md「同 flex 列的互動 slot 幾何鐵律」)。
196
196
 
197
197
  ### Check 5.2: 自造 typography tier
198
198
 
@@ -15,7 +15,7 @@
15
15
  - Dialog / Modal 無 DialogTitle
16
16
  - 非 button 綁 onClick(a11y 破壞)
17
17
  - 巢狀浮層 / 巢狀 Modal(HTML invalid 或 UX 破壞)
18
- - CLAUDE.md「同 flex 列互動 slot 幾何鐵律」違反
18
+ - .claude/references/ui-dev-rules.md「同 flex 列互動 slot 幾何鐵律」違反
19
19
 
20
20
  **處理**: AI 可直接修(surgical fix),commit 時 user 一併 review。
21
21
 
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  name: propose-options
3
- description: Auto-invoke when listing options / 建議 / 候選方案. Forces inline 4-Q principle check(M8 benchmark / M17 SSOT / Rule-of-3 / M10 subsumption)per option BEFORE listing. Failures filtered or labeled. Codifies「verify before propose」runtime discipline.
3
+ description: Auto-invoke when listing options / 建議 / 候選方案. Forces inline 7-Q principle check(M8 benchmark / M17 SSOT / Rule-of-3 / M10 subsumption)per option BEFORE listing. Failures filtered or labeled. Codifies「verify before propose」runtime discipline.
4
4
  ---
5
5
 
6
- # /propose-options — Propose-time 4-Q Gate
6
+ # /propose-options — Propose-time 7-Q Gate
7
7
 
8
- **目的**:Claude 對 user 提建議 / 列 option list 時,**先跑 4 題原則自檢**,通過才寫進回覆。Reject 的不列 OR 列出時標 fail 原因。
8
+ **目的**:Claude 對 user 提建議 / 列 option list 時,**先跑 7 題原則自檢**,通過才寫進回覆。Reject 的不列 OR 列出時標 fail 原因。
9
9
 
10
10
  **對齊**:
11
11
  - CLAUDE.md mindset #1(不取巧)+ #2(消費既有)+ #5(猶豫就問)+ #6(meta 抽象)
12
- - M8 benchmark / M17 SSOT / M12 binary rule / 資訊治理「加規則前 3 題」
12
+ - M8 benchmark / M17 SSOT / M12 binary rule / 治理「加規則前 3 題」
13
13
  - 本 skill 是上述 meta 的**propose-time 落地** — meta 寫成文字不夠,要 mechanical workflow 釘住
14
14
 
15
15
  ## When to invoke
@@ -27,9 +27,9 @@ description: Auto-invoke when listing options / 建議 / 候選方案. Forces in
27
27
 
28
28
  ---
29
29
 
30
- ## Workflow(強制 6 題,缺一就 reject 此 option)
30
+ ## Workflow(強制 7 題,缺一就 reject 此 option)
31
31
 
32
- 每個 candidate option 過以下 6 題,inline 寫進回覆:
32
+ 每個 candidate option 過以下 7 題,inline 寫進回覆:
33
33
 
34
34
  ### Q0 — **Pre-ASK self-verify problem 真存在**(2026-05-18 加,absorbs Sheet/inline-action/SurfaceBody 三題誤判事件)
35
35
 
@@ -93,7 +93,7 @@ description: Auto-invoke when listing options / 建議 / 候選方案. Forces in
93
93
 
94
94
  ### Q4 — M10 下游吸收
95
95
  **問**:本 option 加入後,既有哪些 rule / memory / bug case 被吸收可刪?
96
- **Fail**:純 append 沒 retire,違反「上游加 = 下游減」 + 資訊治理 anti-bloat
96
+ **Fail**:純 append 沒 retire,違反「上游加 = 下游減」 + 治理 anti-bloat
97
97
  **例**:
98
98
  - ✅ "M18 加,M12 部分 overlap 但 scope 不同共存(說明)"
99
99
  - ❌ "新加 M18,既有 M-row 全保留(沒檢查)"
@@ -109,7 +109,7 @@ description: Auto-invoke when listing options / 建議 / 候選方案. Forces in
109
109
 
110
110
  ## Workflow Output Format
111
111
 
112
- 對 user 回覆中的 option list 必含 **inline 5-Q 表 + Issue mapping**(plan iteration 場景):
112
+ 對 user 回覆中的 option list 必含 **inline 7-Q 表 + Issue mapping**(plan iteration 場景):
113
113
 
114
114
  ```markdown
115
115
  | 選項 | M23 DS grep | M8 benchmark | M17 SSOT | Rule-of-3 | M10 下游 | Issue cover | 結論 |
@@ -126,17 +126,17 @@ description: Auto-invoke when listing options / 建議 / 候選方案. Forces in
126
126
  | ... | ... | ... |
127
127
  ```
128
128
 
129
- **所有 fail 過 4-Q 的 option 必明示 reject + 原因**,不只 list 不過的。User 看見 reject 過程才能信 propose 過原則。
129
+ **所有 fail 過 7-Q 的 option 必明示 reject + 原因**,不只 list 不過的。User 看見 reject 過程才能信 propose 過原則。
130
130
 
131
131
  ---
132
132
 
133
133
  ## Edge cases
134
134
 
135
135
  ### 緊急 / surgical bug fix
136
- 不需走全 4 題(沒 option list,直接修)。但 commit message 仍應簡述「修法已知 root cause + 不取巧」(對齊 mindset #1)。
136
+ 不需走全 7 題(沒 option list,直接修)。但 commit message 仍應簡述「修法已知 root cause + 不取巧」(對齊 mindset #1)。
137
137
 
138
138
  ### Option 內含 sub-option(nested)
139
- 每層各自跑 4 題。Skill 不限深度但實作上 ≥ 3 層 nested 已是設計問題,user 該停下重整。
139
+ 每層各自跑 7 題。Skill 不限深度但實作上 ≥ 3 層 nested 已是設計問題,user 該停下重整。
140
140
 
141
141
  ### User 已明示要 X(非 propose)
142
142
  不跑 skill。直接執行。
@@ -147,19 +147,19 @@ description: Auto-invoke when listing options / 建議 / 候選方案. Forces in
147
147
 
148
148
  User 已就「為什麼會給錯誤建議」糾正 ≥ 3 次:
149
149
  - session 初:G6/G7/G8 推力,我自己沒 dogfood test → 第 3 次問才補
150
- - 中:c hook + d M18-inner-area propose,**user sign-off 前剛好我自己覺察跑 4-Q 才撤回**
150
+ - 中:c hook + d M18-inner-area propose,**user sign-off 前剛好我自己覺察跑 7-Q 才撤回**
151
151
  - 末:user 直接質問「為什麼會給錯誤建議?如果我答應了會直接執行嗎?」(本 skill 的觸發)
152
152
 
153
- **Infra G6/G7/G8 是 post-edit / session-start 防線,沒 propose-time gate**。Claude Code event model 沒 OnAssistantMessage hook,**只能靠 model-runtime 紀律 + skill self-invoke**。本 skill 就是 mechanical 補位 — invoke 時讀本檔,4-Q 表格自然寫進回覆。
153
+ **Infra G6/G7/G8 是 post-edit / session-start 防線,沒 propose-time gate**。Claude Code event model 沒 OnAssistantMessage hook,**只能靠 model-runtime 紀律 + skill self-invoke**。本 skill 就是 mechanical 補位 — invoke 時讀本檔,7-Q 表格自然寫進回覆。
154
154
 
155
155
  ---
156
156
 
157
157
  ## Self-improvement capture
158
158
 
159
159
  每次 invoke 完,session 結束前自問:
160
- - (a) 是否每個 option 真跑了 4-Q 還是糊弄填表?
160
+ - (a) 是否每個 option 真跑了 7-Q 還是糊弄填表?
161
161
  - (b) 是否有 reject option 曾被 list?(reject 不該被列出)
162
- - (c) 是否 user 仍質疑 propose 品質?(若是 → 4-Q 沒抓到的 gap → 加 Q5)
162
+ - (c) 是否 user 仍質疑 propose 品質?(若是 → 7-Q 沒抓到的 gap → 加 Q5)
163
163
 
164
164
  回填到本 SKILL.md 或 CLAUDE.md M18(若需 escalate)。
165
165
 
@@ -170,8 +170,8 @@ User 已就「為什麼會給錯誤建議」糾正 ≥ 3 次:
170
170
  | Skill | scope |
171
171
  |---|---|
172
172
  | `pre_write_subsumption_check.sh`(hook)| Edit/Write 已發生時 |
173
- | `post_edit_canonical_interrogate.sh`(hook)| 寫完 canonical 後 3 題 |
174
- | `check_governance_compliance.sh`(hook)| 寫新 hook 7 題 |
175
- | **本 skill** `/propose-options` | **propose-time(寫進 user 回覆前)4 題** |
173
+ | `post_edit_canonical_interrogate.sh`(retired/未實作 — mindset enforcement)| 寫完 canonical 後 3 題 |
174
+ | `check_governance_compliance.sh`(retired/未實作 — 靠 `check_propose_pre_grep_verify.sh` + 加 hook 前 3 題)| 寫新 hook 7 題 |
175
+ | **本 skill** `/propose-options` | **propose-time(寫進 user 回覆前)7 題** |
176
176
 
177
177
  4 個正交 — propose 前 / write 前 / write 中 / write 後 全 cover。
@@ -141,7 +141,7 @@ Narrative 必含:
141
141
 
142
142
  **Input**: shortlist(2-3 items)+ Phase 3.0 產出的 Object Map
143
143
 
144
- **Phase 3.0a — SSOT 5-step pre-check**:寫任何 candidate code 前必過 CLAUDE.md「SSOT 消費 canonical」+ memory `feedback_proactive_5layer_pipeline.md`「5-step pre-check」(SSOT 在 memory + CLAUDE.md,本 skill 不重複)。`check_story_anatomy.sh` PreToolUse 是最後安全網,但 5-step 是事前 discipline。
144
+ **Phase 3.0a — SSOT 5-step pre-check**:寫任何 candidate code 前必過 CLAUDE.md「SSOT 消費 canonical」+ memory `feedback_proactive_5layer_pipeline.md`「5-step pre-check」(SSOT 在 memory + CLAUDE.md,本 skill 不重複)。`check_story_invariants.sh` R1 anatomy(原 check_story_anatomy.sh folded 折入)PreToolUse 是最後安全網,但 5-step 是事前 discipline。
145
145
 
146
146
  **Process**: 每個 candidate 建一個 exploration story,**各 candidate 共享 Object Map 但差異在 UI shape + CTAs 順序**。see `references/proposal-template.md` for structure。
147
147
 
@@ -209,7 +209,7 @@ User / stakeholder 決定採用某 candidate 後:
209
209
  - `(c)` 混搭 A+B 新 hybrid(新 exploration)
210
210
  - `(d)` 全部不採用(保留 explorations/ 作紀錄,也是有價值的 ruled-out)
211
211
 
212
- **Graduation 流程**:若升級到正式,在 `explorations/_archive/` 備份 exploration(CLAUDE.md line 633:「不再使用但需保留的內容移至 _archive/」),正式 code 進 design-system/。
212
+ **Graduation 流程**:若升級到正式,在 `explorations/_archive/` 備份 exploration(per CLAUDE.md `# 元件完成 + Exploration`:比稿定案升級 patterns/ 或 components/,舊比稿保留作紀錄),正式 code 進 design-system/。
213
213
 
214
214
  ### Phase 5 — Cleanup
215
215
 
@@ -22,7 +22,7 @@
22
22
  4. Chain `/ux-audit`(D4)scope 到 exploration
23
23
  5. Chain `/visual-audit`(D5 Layer B AI judgement)讀 `snapshots/*.png`
24
24
  6. **D6 真 scan**:chain `.claude/skills/design-system-audit/references/principle-audit-protocol.md` 對 exploration code 跑 4 子維;依判斷公式 auto / STOP
25
- 7. **Self-improvement capture**(強制 Phase F step,見 CLAUDE.md `# 資訊治理 canonical`)
25
+ 7. **Self-improvement capture**(強制 Phase F step,見 CLAUDE.md `# 治理 canonical`)
26
26
 
27
27
  ## Gate 規則(嚴格)
28
28
 
@@ -38,7 +38,7 @@ Phase 2 將 Phase 1 scan 結果變成可決策的評分表。
38
38
  **扣分場景**:
39
39
  - 候選需要覆蓋 `--chart-*` token 家族 → DS 一致性扣
40
40
  - 需要 hack Popover / Dialog 基底 → DS 一致性扣
41
- - 違反 hook check_token_hygiene.sh 4 條守則 → 直接 1(這是 bug,不是 DS 選擇)
41
+ - 違反 token 防線 lib/_token_hygiene.sh 5 條守則 → 直接 1(這是 bug,不是 DS 選擇)
42
42
 
43
43
  ### 業務 fit(1-5,5 最高)
44
44
 
@@ -217,7 +217,7 @@ Phase 3 建 exploration 時:
217
217
  1. **優先用既有元件** `packages/design-system/src/components/`,不自創
218
218
  2. **Layout primitives 消費**(per CLAUDE.md 清單):Empty / item-layout / overlay-surface / ScrollArea / AspectRatio
219
219
  3. **Token 紀律**:只用 semantic token,不硬寫 hex / rgb / shadow-sm
220
- 4. **hook check_token_hygiene 4 項**:shadcn alias / v4 shorthand / hardcoded shadow / native overflow — 4 項全過
220
+ 4. **token 防線 lib/_token_hygiene.sh 5-check**:shadcn alias / v4 shorthand / hardcoded shadow / primitive-color-as-utility / native overflow — 5 項全過
221
221
  5. **新元件需求**:**notes.md 明文標示**,不偷偷 add 到 Components/(Checkpoint 3 專屬)
222
222
 
223
223
  ---
@@ -13,7 +13,7 @@ description: Auto-invoke after fix commits — extracts root-cause anti-pattern,
13
13
  - 對齊 IDE「find similar / find references」+ Chrome DevTools「find usages」+ GitHub Copilot「related code」3+ 家世界級 idiom
14
14
 
15
15
  **對位其他 skill**:
16
- - `/design-system-audit` 是**定期 batch** 7 audit
16
+ - `/design-system-audit` 是**定期 batch** full-dim audit
17
17
  - `/visual-audit` 是**單次視覺對齊** check
18
18
  - 本 skill 是 **batch-end-only root-pattern scan**(2026-05-12 codex 抓 infra conflict 重構:per-fix → batch-end,對齊 `/bug-fix-rhythm` Phase 2-3 batch fix + single end-verify canonical;M32 split 後 batch-end home 移至 bug-fix-rhythm skill)
19
19
 
@@ -36,7 +36,7 @@ description: Auto-invoke after fix commits — extracts root-cause anti-pattern,
36
36
 
37
37
  ## Non-goals
38
38
 
39
- - 不擴展 scope 到「audit 7 維品質」(那是 `/design-system-audit`)
39
+ - 不擴展 scope 到「audit full-dim品質」(那是 `/design-system-audit`)
40
40
  - 不做視覺 regression baseline diff(那是 `/visual-audit`)
41
41
  - 不改 canonical(找到 pattern 後修是 surgical fix,動 canonical 走 audit / Checkpoint)
42
42
 
@@ -163,17 +163,17 @@ N 個 candidate 的修法 scope。**禁止 auto-fix 超過 5 檔不 ask user**
163
163
 
164
164
  | Tool | scope | 跟本 skill 關係 |
165
165
  |---|---|---|
166
- | `/design-system-audit` | 7 batch audit | 本 skill 抓不到的 architectural pattern audit 補位 |
166
+ | `/design-system-audit` | full-dim batch audit | 本 skill 抓不到的 architectural pattern audit 補位 |
167
167
  | `/visual-audit` | 單次視覺對齊 | Phase 3 verify 用 |
168
168
  | `/scan-similar-bugs`(本) | **immediate-after-fix grep + verify** | M10 mechanical 落地 |
169
169
  | `/knowledge-prune` | 季度 governance prune | 不重複 |
170
- | `check_l3_primitive_import.sh`(hook) | L3 import 違規 | 即時 detect,本 skill 是 batch retro scan |
170
+ | `check_canonical_propagation.sh` E.2(hook;原 check_l3_primitive_import.sh folded 折入,P0 BLOCK) | L3 primitive import 違規 | 即時 detect,本 skill 是 batch retro scan |
171
171
  | `pre_write_subsumption_check.sh`(hook)| 新 file / M-row | 不重複 |
172
172
 
173
173
  **3 層 防線**:
174
174
  - Hook(pre/post tool):**寫的瞬間** detect
175
175
  - 本 skill(fix-time):**修完瞬間** scan DS-wide
176
- - `/design-system-audit`(periodic):**季度** 7 sweep
176
+ - `/design-system-audit`(periodic):**季度** full-dim sweep
177
177
 
178
178
  ---
179
179
 
@@ -5,7 +5,7 @@ description: Batch-migrate design system components to Story Auto-Compile Phase
5
5
 
6
6
  # Story Auto-Compile Migrate — 批次將元件移到 Phase 1+2 結構
7
7
 
8
- **目的**:把 44+ 元件從 hand-written stories 遷到 auto-compile-able 結構(tsx `componentMeta` export + spec YAML frontmatter)。分「mechanical auto」+「judgment checkpoint」兩層。
8
+ **目的**:把全部元件從 hand-written stories 遷到 auto-compile-able 結構(tsx `componentMeta` export + spec YAML frontmatter)。分「mechanical auto」+「judgment checkpoint」兩層。元件總數 Phase 0 動態計(`ls -d packages/design-system/src/components/*/ | wc -l`,當前 62),禁 hardcode。
9
9
 
10
10
  **不含**:不改元件實作(cva / tsx logic 不動);不產 stories(compile-stories 負責)。只加 metadata。
11
11
 
@@ -121,7 +121,7 @@ Commit 每批 5-10 元件一個(不一次全推,好 review)。
121
121
  ## Self-improvement capture
122
122
  - 新發現 cva patterns: {特殊邏輯整理到 planning/story-auto-compile.md 供未來參考}
123
123
  - Mechanical migration 失敗 case: {列出 + 手動 workaround 紀錄}
124
- - Migration 覆蓋率:{N migrated / 44 total}
124
+ - Migration 覆蓋率:{N migrated / total}(total = Phase 0 動態計 `ls -d packages/design-system/src/components/*/ | wc -l`)
125
125
  ```
126
126
 
127
127
  ---
@@ -53,7 +53,7 @@ Purpose: Storybook 是公開文件,範例 = 設計系統品質。本 skill 把
53
53
  - 真實業務情境 → 1 場景 1 故事
54
54
  4. **present mapping** 給 user sign-off(若走 skill);user 拍板才寫;反 pattern 在 step 3 即可避免
55
55
 
56
- Hook `check_story_slot_split.sh` write-time block 同源反 pattern。Audit `/design-system-audit` Dim 28 後驗。
56
+ Hook `check_story_invariants.sh` R2 slot_split write-time block 同源反 pattern。Audit `/design-system-audit` Dim 28 後驗。
57
57
 
58
58
  ### Phase 1 — 定位(決定寫哪層 story)
59
59
 
@@ -82,7 +82,7 @@ Hook `check_story_slot_split.sh` write-time block 同源反 pattern。Audit `/de
82
82
 
83
83
  **參考 `references/anatomy-standard.md`**——每個元件 anatomy 必備 **6 件套**(`export const Overview / Inspector / ColorMatrix / SizeMatrix / StateBehavior / Accessibility`,一字不差;Accessibility 第 6 章 2026-04-24+ 對齊 Material / Polaris / Atlassian) + Inspect 面板規格 + token-first 原則 + 值溯源完整性。
84
84
 
85
- **偏離 canonical 規則**(CLAUDE.md Consistency Audit 原則」):
85
+ **偏離 canonical 規則**(CLAUDE.md `# 稽核 canonical`「Consistency 類稽核必 Phase 0 全掃再判」;偏離需 rationale 由 design-system-audit Dim 13 enforce):
86
86
  - 追加第 7+ 個元件特有 story → OK,免 rationale
87
87
  - 取代 6-canonical 中某個 → **必須在元件 spec.md 寫 rationale**
88
88
  - 同概念改名(如 `VisualTokens` 取代 `ColorMatrix`) → **禁止**
@@ -119,4 +119,4 @@ Checkpoint: 寫完後必驗:
119
119
 
120
120
  - `.claude/rules/story-rules.md`:三層定位 + title 命名(high-level signal)
121
121
  - CLAUDE.md `# 失敗記憶索引` → 三方漂移:SegmentedControl cva defaultVariants bug
122
- - `.claude/hooks/check_sync_update.sh`:Edit 後自動提醒三方連動
122
+ - M3 mindset #3「改一處看三處」+ `.claude/hooks/pre_edit_spec_check.sh`:Edit 前讀 spec、三方連動靠 mindset(`check_sync_update.sh` retired/未實作)
@@ -58,7 +58,7 @@ export const Overview = {
58
58
 
59
59
  **嚴格警告**:曾經被誤用「applicable-where-meaningful」放行大量元件跳 Inspector,造成 anatomy 紙本文件不如世界級。**2026-04-21 audit 重修:policy 改回「6-canonical 預設全建(含 Accessibility),N/A 要硬 rationale」**。N/A 不是省工通行證。
60
60
 
61
- ### 允許的偏離(CLAUDE.mdConsistency Audit 原則」公式)
61
+ ### 允許的偏離(CLAUDE.md `# 稽核 canonical`「Consistency 類稽核」公式;design-system-audit Dim 13 enforce)
62
62
 
63
63
  #### `@anatomy-rationale:` 檔頭註解(scope-N/A 的 canonical escape)
64
64
 
@@ -76,7 +76,7 @@ import type { Meta, StoryObj } from '@storybook/react'
76
76
  **何時不用**:section 只是還沒填完 — 補完內容,不要拿 escape 規避。
77
77
  **世界級對照**:對齊 ESLint `eslint-disable-next-line {rule}` 的 per-line allowlist idiom — 每個豁免必有具名 rule + 一行 rationale,不允許整檔默默繞過。
78
78
 
79
- `check_story_anatomy.sh` 識別 `@anatomy-rationale:` block:列出的 section 視為 legitimately N/A;未列出的 missing section 仍 violation。
79
+ `check_story_invariants.sh` R1 anatomy 識別 `@anatomy-rationale:` block:列出的 section 視為 legitimately N/A;未列出的 missing section 仍 violation。
80
80
 
81
81
  #### 其他允許的偏離
82
82
 
@@ -100,7 +100,7 @@ v1 7 categories(A 視覺 variant / B field control / C selection / D structural
100
100
 
101
101
  - `.claude/rules/story-rules.md`「拆分原則」— canonical 上游 one-liner
102
102
  - `/story-writing` SKILL.md Phase 0 — write-time mapping
103
- - Hook `check_story_category.sh` — pre-write enforcement(攔不符 trait core)
103
+ - Hook `check_story_invariants.sh` R3 category — pre-write enforcement(攔不符 trait core)
104
104
  - `/design-system-audit` Dim 29 — periodic verify
105
105
  - `/new-component` Phase 5 — 新元件 trait-based scaffold
106
106
  - `scripts/compile-stories.mjs` — runtime trait → required stories check
@@ -168,7 +168,7 @@ v1 7 categories(A 視覺 variant / B field control / C selection / D structural
168
168
 
169
169
  ## 強制機制
170
170
 
171
- - **Hook** `check_principles_canonical.sh`:PreToolUse 攔不符 ≥ 2 universal core
171
+ - **Hook** `check_canonical_propagation.sh` E.1 principles:PreToolUse 攔不符 ≥ 2 universal core
172
172
  - **Audit Dim 30**:periodic verify
173
173
  - **`/new-component` Phase 5.3**:scaffold 4 universal stories template
174
174