@haposoft/cafekit 0.16.7 → 0.18.1

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 (231) hide show
  1. package/README.md +14 -22
  2. package/bin/__tests__/codex-hooks-ownership.test.js +2 -2
  3. package/bin/__tests__/codex-hooks.test.js +169 -272
  4. package/bin/__tests__/codex-native.test.js +100 -202
  5. package/bin/__tests__/develop-contract.test.js +122 -1413
  6. package/bin/__tests__/docs-sync-on-demand.test.js +93 -0
  7. package/bin/__tests__/grok-envelope.test.js +0 -56
  8. package/bin/__tests__/hook-payload.test.js +4 -6
  9. package/bin/__tests__/legacy-authority-decoupled.test.js +154 -0
  10. package/bin/__tests__/legacy-hooks-retired.test.js +221 -0
  11. package/bin/__tests__/omp-bridge.test.js +20 -17
  12. package/bin/__tests__/omp-hooks.test.js +0 -19
  13. package/bin/__tests__/optional-skill-inventory.test.js +112 -4
  14. package/bin/__tests__/orca-session.test.js +0 -2
  15. package/bin/__tests__/package-inventory.test.js +90 -925
  16. package/bin/__tests__/runtime-dir.test.js +0 -3
  17. package/bin/__tests__/runtime-schema.test.js +3 -2
  18. package/bin/__tests__/skill-routing-source.test.js +27 -15
  19. package/bin/__tests__/spec-narrowing.test.js +30 -161
  20. package/bin/__tests__/specs-v2-execution-closeout.test.js +0 -437
  21. package/bin/__tests__/test-runtime-dependency-closure.cjs +1 -2
  22. package/bin/__tests__/ui-ux-skill.test.js +101 -0
  23. package/bin/__tests__/usage-hook-retired.test.js +114 -0
  24. package/bin/__tests__/validator-grounding.test.js +18 -2949
  25. package/bin/lib/managed-writer.js +2 -3
  26. package/bin/phases/codex-runtime.js +27 -0
  27. package/bin/phases/copy-payload.js +13 -28
  28. package/bin/phases/omp-runtime.js +25 -0
  29. package/package.json +2 -3
  30. package/src/claude/CLAUDE.md +3 -10
  31. package/src/claude/agents/brainstormer.md +7 -3
  32. package/src/claude/agents/code-auditor.md +44 -56
  33. package/src/claude/agents/debugger.md +8 -88
  34. package/src/claude/agents/deployer.md +3 -5
  35. package/src/claude/agents/docs-keeper.md +6 -14
  36. package/src/claude/agents/git-ops.md +2 -4
  37. package/src/claude/agents/implementer.md +12 -16
  38. package/src/claude/agents/inspector.md +4 -3
  39. package/src/claude/agents/project-manager.md +9 -17
  40. package/src/claude/agents/researcher.md +9 -3
  41. package/src/claude/agents/spec-maker.md +15 -15
  42. package/src/claude/agents/test-runner.md +8 -11
  43. package/src/claude/agents/ui-ux-designer.md +0 -1
  44. package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -1
  45. package/src/claude/hooks/__tests__/spec-gate.test.js +244 -333
  46. package/src/claude/hooks/__tests__/spec-state-touched.test.js +160 -0
  47. package/src/claude/hooks/__tests__/state.test.js +68 -0
  48. package/src/claude/hooks/__tests__/statusline.test.js +140 -11
  49. package/src/claude/hooks/agent.cjs +2 -1
  50. package/src/claude/hooks/lib/hook-payload.cjs +2 -2
  51. package/src/claude/hooks/rules.cjs +2 -1
  52. package/src/claude/hooks/session.cjs +0 -1
  53. package/src/claude/hooks/spec-gate.cjs +17 -83
  54. package/src/claude/hooks/spec-state.cjs +142 -39
  55. package/src/claude/hooks/state.cjs +21 -2
  56. package/src/claude/migration-manifest.json +42 -22
  57. package/src/claude/output-styles/coding-level-0-eli5.md +9 -9
  58. package/src/claude/output-styles/coding-level-1-junior.md +3 -3
  59. package/src/claude/output-styles/coding-level-2-mid.md +3 -3
  60. package/src/claude/output-styles/coding-level-3-senior.md +2 -2
  61. package/src/claude/output-styles/coding-level-4-lead.md +5 -5
  62. package/src/claude/output-styles/coding-level-5-god.md +6 -6
  63. package/src/claude/rules/ai-dev-rules.md +2 -3
  64. package/src/claude/rules/hook-protocols.md +8 -15
  65. package/src/claude/rules/manage-docs.md +9 -23
  66. package/src/claude/rules/orchestrator.md +3 -4
  67. package/src/claude/rules/review-audit-self-decision.md +3 -3
  68. package/src/claude/rules/skill-domain-routing.md +1 -3
  69. package/src/claude/rules/skill-workflow-routing.md +4 -5
  70. package/src/claude/rules/state-sync.md +3 -12
  71. package/src/claude/rules/workflow.md +11 -19
  72. package/src/claude/runtime.schema.json +5 -3
  73. package/src/claude/scripts/generate-skill-catalog.cjs +7 -6
  74. package/src/claude/scripts/provenance.cjs +23 -5
  75. package/src/claude/scripts/spec-receipt.cjs +24 -121
  76. package/src/claude/scripts/spec-resolver.cjs +41 -458
  77. package/src/claude/scripts/workflow-policy.cjs +3 -1801
  78. package/src/claude/settings/settings.json +1 -32
  79. package/src/claude/skills/agent-browser/SKILL.md +1 -1
  80. package/src/claude/skills/{question → ask}/SKILL.md +9 -75
  81. package/src/claude/skills/brainstorm/SKILL.md +43 -131
  82. package/src/claude/skills/chrome-devtools/SKILL.md +14 -31
  83. package/src/claude/skills/code-review/SKILL.md +29 -81
  84. package/src/claude/skills/code-review/references/spec-compliance-review.md +4 -8
  85. package/src/claude/skills/debug/SKILL.md +29 -149
  86. package/src/claude/skills/develop/SKILL.md +26 -83
  87. package/src/claude/skills/develop/references/parallel-waves.md +0 -8
  88. package/src/claude/skills/develop/references/quality-gate.md +15 -13
  89. package/src/claude/skills/develop/references/subagent-patterns.md +0 -6
  90. package/src/claude/skills/docs/SKILL.md +2 -2
  91. package/src/claude/skills/docs/references/update-workflow.md +1 -1
  92. package/src/claude/skills/fix/SKILL.md +153 -0
  93. package/src/claude/skills/{hotfix → fix}/references/diagnosis-protocol.md +2 -2
  94. package/src/claude/skills/{hotfix → fix}/references/parallel-patterns.md +2 -2
  95. package/src/claude/skills/{hotfix → fix}/references/prevention-gate.md +3 -3
  96. package/src/claude/skills/{hotfix → fix}/references/review-cycle.md +1 -1
  97. package/src/claude/skills/git/SKILL.md +48 -9
  98. package/src/claude/skills/git/references/commit-protocols.md +35 -16
  99. package/src/claude/skills/git/references/worktree-blueprint.md +42 -6
  100. package/src/claude/skills/orca/SKILL.md +9 -8
  101. package/src/claude/skills/research/SKILL.md +17 -46
  102. package/src/claude/skills/scout/SKILL.md +61 -0
  103. package/src/claude/skills/{inspect → scout}/references/internal-inspection.md +26 -10
  104. package/src/claude/skills/specs/SKILL.md +22 -29
  105. package/src/claude/skills/specs/references/review.md +8 -6
  106. package/src/claude/skills/specs/references/templates.md +34 -41
  107. package/src/claude/skills/sync/SKILL.md +16 -45
  108. package/src/claude/skills/sync/references/rebind-and-audit.md +59 -0
  109. package/src/claude/skills/sync/references/sync-protocols.md +4 -13
  110. package/src/claude/skills/test/SKILL.md +39 -104
  111. package/src/claude/skills/test/references/execution-strategy.md +93 -21
  112. package/src/claude/skills/test/references/failure-triage.md +1 -1
  113. package/src/claude/skills/ui-ux/LICENSE +21 -0
  114. package/src/claude/skills/ui-ux/SKILL.md +497 -0
  115. package/src/claude/skills/ui-ux/references/brand-tokens.md +90 -0
  116. package/src/claude/skills/ui-ux/references/budgets.md +113 -0
  117. package/src/claude/skills/ui-ux/references/checklist.md +271 -0
  118. package/src/claude/skills/ui-ux/references/components/accordion.md +246 -0
  119. package/src/claude/skills/ui-ux/references/components/avatar.md +153 -0
  120. package/src/claude/skills/ui-ux/references/components/banner.md +43 -0
  121. package/src/claude/skills/ui-ux/references/components/breadcrumb.md +201 -0
  122. package/src/claude/skills/ui-ux/references/components/button.md +142 -0
  123. package/src/claude/skills/ui-ux/references/components/card.md +113 -0
  124. package/src/claude/skills/ui-ux/references/components/charts.md +376 -0
  125. package/src/claude/skills/ui-ux/references/components/chat.md +132 -0
  126. package/src/claude/skills/ui-ux/references/components/choice-controls.md +369 -0
  127. package/src/claude/skills/ui-ux/references/components/comment-thread.md +17 -0
  128. package/src/claude/skills/ui-ux/references/components/description-list.md +116 -0
  129. package/src/claude/skills/ui-ux/references/components/empty-state.md +98 -0
  130. package/src/claude/skills/ui-ux/references/components/file-upload.md +107 -0
  131. package/src/claude/skills/ui-ux/references/components/inline-edit.md +128 -0
  132. package/src/claude/skills/ui-ux/references/components/input.md +161 -0
  133. package/src/claude/skills/ui-ux/references/components/list-row.md +56 -0
  134. package/src/claude/skills/ui-ux/references/components/loading.md +198 -0
  135. package/src/claude/skills/ui-ux/references/components/logo.md +147 -0
  136. package/src/claude/skills/ui-ux/references/components/otp-input.md +43 -0
  137. package/src/claude/skills/ui-ux/references/components/quantity-input.md +100 -0
  138. package/src/claude/skills/ui-ux/references/components/range-slider.md +16 -0
  139. package/src/claude/skills/ui-ux/references/components/small-controls.md +340 -0
  140. package/src/claude/skills/ui-ux/references/components/sortable-header.md +86 -0
  141. package/src/claude/skills/ui-ux/references/components/tag-input.md +14 -0
  142. package/src/claude/skills/ui-ux/references/components/timeline.md +38 -0
  143. package/src/claude/skills/ui-ux/references/components/tree.md +30 -0
  144. package/src/claude/skills/ui-ux/references/design-process.md +650 -0
  145. package/src/claude/skills/ui-ux/references/layouts/app-kanban.html +303 -0
  146. package/src/claude/skills/ui-ux/references/layouts/app.md +1369 -0
  147. package/src/claude/skills/ui-ux/references/layouts/form.md +430 -0
  148. package/src/claude/skills/ui-ux/references/layouts/overlay.md +552 -0
  149. package/src/claude/skills/ui-ux/references/layouts/pricing.md +204 -0
  150. package/src/claude/skills/ui-ux/references/locked-rules.md +35 -0
  151. package/src/claude/skills/ui-ux/references/principles.md +408 -0
  152. package/src/claude/skills/ui-ux/references/refactor.md +245 -0
  153. package/src/claude/skills/ui-ux/references/responsive.md +195 -0
  154. package/src/claude/skills/ui-ux/references/review.md +528 -0
  155. package/src/claude/skills/ui-ux/references/rules-color.md +623 -0
  156. package/src/claude/skills/ui-ux/references/rules-form.md +235 -0
  157. package/src/claude/skills/ui-ux/references/rules-state.md +680 -0
  158. package/src/claude/skills/ui-ux/references/rules-type.md +369 -0
  159. package/src/claude/skills/ui-ux/references/styles.md +311 -0
  160. package/src/claude/skills/ui-ux/references/system.md +219 -0
  161. package/src/claude/skills/ui-ux/references/tailwind-v4-traps.md +237 -0
  162. package/src/claude/skills/ui-ux/references/tokens.css +362 -0
  163. package/src/claude/skills/ui-ux/scripts/lint-skill.mjs +216 -0
  164. package/src/claude/skills/ui-ux/scripts/package.json +9 -0
  165. package/src/claude/skills/ui-ux/scripts/probe.mjs +4447 -0
  166. package/src/claude/skills/ui-ux-pro-max/SKILL.md +25 -80
  167. package/src/claude/skills/web-testing/SKILL.md +2 -20
  168. package/src/claude/status.cjs +149 -144
  169. package/src/codex/AGENTS.md +8 -13
  170. package/src/codex/hooks/agent.cjs +2 -1
  171. package/src/codex/hooks/lib/spec-receipt.cjs +4 -32
  172. package/src/codex/hooks/lib/spec-utils.cjs +6 -52
  173. package/src/codex/hooks/rules.cjs +2 -1
  174. package/src/codex/hooks/session.cjs +0 -2
  175. package/src/codex/hooks/spec-gate.cjs +13 -81
  176. package/src/codex/hooks/spec-state.cjs +37 -41
  177. package/src/codex/hooks.json +0 -20
  178. package/src/codex/rules/state-sync.md +3 -12
  179. package/src/common/AGENTS.md +6 -12
  180. package/src/omp/extensions/cafekit-bridge.mjs +6 -6
  181. package/bin/__tests__/change-firewall.semantic-firewall.test.js +0 -2133
  182. package/bin/__tests__/finalizer-pass-gate.semantic-firewall.test.js +0 -342
  183. package/bin/__tests__/release-preflight.semantic-firewall.test.js +0 -586
  184. package/bin/__tests__/review-receipt-c2.semantic-firewall.test.js +0 -378
  185. package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +0 -665
  186. package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +0 -1132
  187. package/src/claude/hooks/__tests__/completion-authority.test.js +0 -990
  188. package/src/claude/hooks/__tests__/semantic-review-authority.test.js +0 -259
  189. package/src/claude/hooks/completion-authority-check.cjs +0 -56
  190. package/src/claude/hooks/completion-authority-state.cjs +0 -527
  191. package/src/claude/hooks/completion-authority.cjs +0 -163
  192. package/src/claude/hooks/lib/context.cjs +0 -616
  193. package/src/claude/hooks/lib/detect.cjs +0 -474
  194. package/src/claude/hooks/semantic-review-authority.cjs +0 -154
  195. package/src/claude/hooks/task-scaffold-guard.cjs +0 -114
  196. package/src/claude/hooks/usage.cjs +0 -197
  197. package/src/claude/scripts/change-firewall.cjs +0 -1748
  198. package/src/claude/scripts/spec-authoring-digest.cjs +0 -151
  199. package/src/claude/scripts/spec-authoring-validation.cjs +0 -126
  200. package/src/claude/scripts/spec-final-state.cjs +0 -290
  201. package/src/claude/scripts/spec-ground.cjs +0 -650
  202. package/src/claude/scripts/spec-readiness.cjs +0 -425
  203. package/src/claude/scripts/spec-scaffold.cjs +0 -2317
  204. package/src/claude/scripts/spec-semantic-model.cjs +0 -396
  205. package/src/claude/scripts/validate-spec-output.cjs +0 -3941
  206. package/src/claude/skills/code-review/references/verification-gate.md +0 -46
  207. package/src/claude/skills/delegate/SKILL.md +0 -124
  208. package/src/claude/skills/delegate/references/codex-delegation.md +0 -71
  209. package/src/claude/skills/delegate/references/grok-delegation.md +0 -84
  210. package/src/claude/skills/hotfix/SKILL.md +0 -289
  211. package/src/claude/skills/inspect/SKILL.md +0 -142
  212. package/src/claude/skills/loop/SKILL.md +0 -114
  213. package/src/claude/skills/loop/references/bounded-loop-protocol.md +0 -104
  214. package/src/claude/skills/loop/references/metric-and-guard-contract.md +0 -76
  215. package/src/claude/skills/route/SKILL.md +0 -94
  216. package/src/claude/skills/route/references/agent-timing.md +0 -46
  217. package/src/claude/skills/route/references/chaining-patterns.md +0 -53
  218. package/src/claude/skills/route/references/task-taxonomy.md +0 -48
  219. package/src/claude/skills/specs/templates/design.md +0 -82
  220. package/src/claude/skills/specs/templates/requirements-init.md +0 -8
  221. package/src/claude/skills/specs/templates/requirements.md +0 -42
  222. package/src/claude/skills/specs/templates/spec-state.json +0 -56
  223. package/src/claude/skills/specs/templates/task.md +0 -47
  224. package/src/codex/hooks/completion-authority-check.cjs +0 -67
  225. package/src/codex/hooks/completion-authority-state.cjs +0 -527
  226. package/src/codex/hooks/completion-authority.cjs +0 -109
  227. package/src/codex/hooks/semantic-review-authority.cjs +0 -130
  228. package/src/codex/hooks/task-scaffold-guard.cjs +0 -63
  229. /package/src/claude/skills/{question → ask}/templates/question.md +0 -0
  230. /package/src/claude/skills/{hotfix → fix}/references/escalation-tactics.md +0 -0
  231. /package/src/claude/skills/{hotfix → fix}/references/workflow-specialized.md +0 -0
@@ -14,10 +14,6 @@
14
14
  "type": "command",
15
15
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/session.cjs\""
16
16
  },
17
- {
18
- "type": "command",
19
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/docs-sync.cjs\""
20
- },
21
17
  {
22
18
  "type": "command",
23
19
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/state.cjs\""
@@ -58,18 +54,9 @@
58
54
  "type": "command",
59
55
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/rules.cjs\""
60
56
  },
61
- {
62
- "type": "command",
63
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/completion-authority.cjs\""
64
- },
65
57
  {
66
58
  "type": "command",
67
59
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/spec-state.cjs\""
68
- },
69
- {
70
- "type": "command",
71
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/usage.cjs\"",
72
- "timeout": 30
73
60
  }
74
61
  ]
75
62
  }
@@ -87,15 +74,6 @@
87
74
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/inspect-block.cjs\""
88
75
  }
89
76
  ]
90
- },
91
- {
92
- "matcher": "Write",
93
- "hooks": [
94
- {
95
- "type": "command",
96
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/task-scaffold-guard.cjs\""
97
- }
98
- ]
99
77
  }
100
78
  ],
101
79
  "PostToolUse": [
@@ -113,8 +91,7 @@
113
91
  "hooks": [
114
92
  {
115
93
  "type": "command",
116
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/usage.cjs\"",
117
- "timeout": 30
94
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/spec-state.cjs\""
118
95
  }
119
96
  ]
120
97
  }
@@ -126,10 +103,6 @@
126
103
  "type": "command",
127
104
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/spec-gate.cjs\""
128
105
  },
129
- {
130
- "type": "command",
131
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/completion-authority.cjs\""
132
- },
133
106
  {
134
107
  "type": "command",
135
108
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/state.cjs\""
@@ -140,10 +113,6 @@
140
113
  "SubagentStop": [
141
114
  {
142
115
  "hooks": [
143
- {
144
- "type": "command",
145
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/semantic-review-authority.cjs\""
146
- },
147
116
  {
148
117
  "type": "command",
149
118
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/state.cjs\""
@@ -236,7 +236,7 @@ agent-browser snapshot -i
236
236
  agent-browser fill @e1 "user@example.com"
237
237
  agent-browser fill @e2 "password123"
238
238
  agent-browser click @e3 # Submit button
239
- agent-browser wait url "/dashboard"
239
+ agent-browser wait --url "/dashboard"
240
240
  ```
241
241
 
242
242
  ### State Persistence (Auth)
@@ -24,6 +24,7 @@ metadata:
24
24
 
25
25
  <ANSWER-ONLY-GATE>
26
26
  Do NOT implement, scaffold, refactor, modify files, generate full specs, or make final architecture decisions.
27
+ This holds even when the question itself asks for a change ("and fix it", "rồi đổi luôn cho tôi"): answer the cause with evidence, edit nothing, and point to `cf:fix` for the change, or to `cf:debug` when the cause is not yet known.
27
28
  The output is an answer, evidence, confidence, and a follow-up only when needed.
28
29
  </ANSWER-ONLY-GATE>
29
30
 
@@ -43,10 +44,7 @@ Do not use it when:
43
44
  - The user asks to implement, fix, debug, test, commit, or publish.
44
45
  - The user wants ideation/tradeoff exploration; use `cf:brainstorm`.
45
46
  - The user wants a formal spec; use `cf:specs`.
46
- - The user wants full legacy documentation reconstruction: use
47
- `cf:docs --reconstruct` when the optional document bundle is installed;
48
- otherwise use `cf:scout` plus source evidence, or explain how to install the
49
- bundle with `npx @haposoft/cafekit --with-document-skills`.
47
+ - The user wants full legacy documentation reconstruction: use `cf:docs --reconstruct` when the optional document bundle is installed; otherwise use `cf:scout` plus source evidence, or explain how to install the bundle with `npx @haposoft/cafekit --with-document-skills`.
50
48
  - The user wants root-cause diagnosis for a failure; use `cf:debug`.
51
49
 
52
50
  ## Modes
@@ -60,50 +58,19 @@ Do not use it when:
60
58
 
61
59
  If modes conflict, prefer the most explicit source mode in this order: `--both`, `--repo`, `--web`, then default. Apply `--brief` or `--deep` as output depth modifiers.
62
60
 
63
- ## Workflow
61
+ ## Standards
64
62
 
65
- ### 1. Classify The Question
63
+ **Unclear questions.** If `unclear`, ask one focused follow-up with the minimum choices needed.
66
64
 
67
- Pick one primary answer type:
65
+ **Repo evidence priority:** `README.md`, `AGENTS.md`, `CLAUDE.md`; then relevant `docs/`, `specs/`, `.claude/`; then source files, tests, scripts, package manifests, config files; git history only when the question asks about changes or provenance. Use focused search (`rg`, targeted file reads) instead of broad scans. Use `cf:scout` when the user asks where something lives or the source surface is unclear.
68
66
 
69
- ```text
70
- source-code behavior | config/version | spec/docs consistency | dependency/library | workflow/process | external/current knowledge | unclear
71
- ```
72
-
73
- If `unclear`, ask one focused follow-up with the minimum choices needed.
74
-
75
- ### 2. Gather Evidence
76
-
77
- Repo evidence priority:
78
- 1. `README.md`, `AGENTS.md`, `CLAUDE.md`
79
- 2. relevant `docs/`, `specs/`, `.claude/`
80
- 3. source files, tests, scripts, package manifests, config files
81
- 4. git history only when the question asks about changes or provenance
82
-
83
- Use focused search (`rg`, targeted file reads) instead of broad scans. Use `cf:scout` when the user asks where something lives or the source surface is unclear.
84
-
85
- External evidence:
86
- - Use external/current docs when repo evidence is absent, stale, or not authoritative.
87
- - Prefer official docs, standards, source repositories, or primary vendor docs.
88
- - State clearly when an answer is inferred from external docs rather than confirmed in the repo.
67
+ **External evidence.** Use external/current docs when repo evidence is absent, stale, or not authoritative. Prefer official docs, standards, source repositories, or primary vendor docs. State clearly when an answer is inferred from external docs rather than confirmed in the repo.
89
68
 
90
- ### 3. Decide Whether To Answer Or Ask Back
69
+ **Broad questions.** When the question names no aspect or target — "Is this system stable?", "Is the code good?" — ask back before gathering evidence, offering 2-3 aspects (for example code and tests, runtime reliability, deploy readiness), even when a cautious answer would be possible.
91
70
 
92
- Answer directly when at least one of these is true:
93
- - repo evidence answers the question,
94
- - external/current evidence answers the non-project part,
95
- - a cautious answer can separate known facts from inference.
71
+ **Answer or ask back.** Answer directly when at least one of these is true: repo evidence answers the question, external/current evidence answers the non-project part, or a cautious answer can separate known facts from inference. Ask back when the target system/module is not named and multiple targets are plausible, the needed file/source is blocked or private, the question requires business/domain judgment not present in source, the answer would require guessing customer intent, or the question bundles multiple unrelated topics. Ask only one follow-up question. Include 2-3 concrete options if helpful.
96
72
 
97
- Ask back when:
98
- - the target system/module is not named and multiple targets are plausible,
99
- - the needed file/source is blocked or private,
100
- - the question requires business/domain judgment not present in source,
101
- - the answer would require guessing customer intent,
102
- - the question bundles multiple unrelated topics.
103
-
104
- Ask only one follow-up question. Include 2-3 concrete options if helpful.
105
-
106
- ### 4. Output Contract
73
+ ## Output Contract
107
74
 
108
75
  Default output:
109
76
 
@@ -135,36 +102,3 @@ Use `templates/question.md` when the user asks to save or document the answer.
135
102
  - Keep the answer proportional: concise for simple questions, structured for complex ones.
136
103
  - If external sources were used, include source links or names.
137
104
  - If no evidence exists, say "no evidence found in the current source" and explain what was checked.
138
-
139
- ## Examples
140
-
141
- ### Source Question
142
-
143
- ```text
144
- /cf:ask "In this system, which file does cafekit use to toggle skill routing?"
145
- ```
146
-
147
- Expected behavior:
148
- - read runtime/config/install files,
149
- - answer with exact config file and relevant keys,
150
- - say whether it is runtime-driven or hard-coded.
151
-
152
- ### Mixed Source + Web Question
153
-
154
- ```text
155
- /cf:ask "Which React version does this project use, and does that version still match current best practice?" --both
156
- ```
157
-
158
- Expected behavior:
159
- - read `package.json` or lockfile,
160
- - check current React docs/release info if needed,
161
- - separate local version from external recommendation.
162
-
163
- ### Ask Back
164
-
165
- ```text
166
- /cf:ask "Is this system stable?"
167
- ```
168
-
169
- Expected behavior:
170
- - ask one narrowing question because "stable" could mean architecture, security, performance, UX, tests, or deploy readiness.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: cf:brainstorm
3
- description: "Turn unresolved product or architecture intent into a bounded decision contract, with proportional routing, evidence, and safe handoff."
3
+ description: "Shape an unsettled piece of work into a decided one before anyone builds it. Use when the outcome is already agreed but two or more approaches would each satisfy it with meaningfully different consequences — setup cost, migration, failure behaviour, who carries the work afterwards; use it too when an idea still wants exploring, or when only one approach is viable but the contract and the candidate design still need a decision. It weighs viable approaches against a bounded contract of Outcome, Constraints, Non-goals and Acceptance, records what was chosen and what was rejected and why, and stops there; it writes no code and carries nothing onward by itself. Skip it for a direct factual answer, skip it for a bug or failure that still needs its root cause, and skip it when the request needs a plan and its tasks rather than a choice between designs."
4
4
  user-invocable: true
5
- when_to_use: "Use when material product, scope, or architecture choices remain; skip direct factual answers and already-concrete Specs work."
5
+ when_to_use: "Use when an outcome is agreed and designs compete, an idea wants exploring, or a candidate needs a decision; skip direct factual answers, undiagnosed bugs, and requests that need a plan and its tasks."
6
6
  category: utilities
7
7
  keywords: [ideation, tradeoffs, decisions, scope]
8
8
  argument-hint: "<idea_or_problem>"
@@ -12,9 +12,7 @@ metadata:
12
12
  ---
13
13
  # Brainstorm — proportional pre-delivery design
14
14
 
15
- Turn unresolved intent into a bounded contract without turning clear work into
16
- an interview. `cf:brainstorm` owns the workflow; `brainstormer` is an optional
17
- specialist for real architectural trade-offs.
15
+ Turn unresolved intent into a bounded contract without turning clear work into an interview. `cf:brainstorm` owns the workflow; `brainstormer` is an optional specialist for real architectural trade-offs.
18
16
 
19
17
  <HARD-GATE>
20
18
  Brainstorm never writes implementation, invokes Develop, or treats approval as
@@ -24,64 +22,32 @@ for a new explicit `cf:specs` invocation; it never starts Specs implicitly.
24
22
 
25
23
  ## Control flags
26
24
 
27
- Parse controls only from the leading consecutive token segment. Accept
28
- `--deep`, `--visual`, and `--advice` in any order, each at most once. `--` ends
29
- the control segment. After it or the first content token, every token is user
30
- content. An unknown or duplicate `--*` inside the leading segment returns usage
31
- and performs no scout, question, tool call, write, or workflow action.
25
+ Parse controls only from the leading consecutive token segment. Accept `--deep`, `--visual`, and `--advice` in any order, each at most once. `--` ends the control segment. After it or the first content token, every token is user content. An unknown or duplicate `--*` inside the leading segment returns usage and performs no scout, question, tool call, write, or workflow action.
32
26
 
33
- Parsing identifies controls but does not apply them. Route Direct first, then
34
- apply controls only to requests that remain in Brainstorm. `--deep` may raise
35
- non-direct analysis depth but never lower a gate; `--visual` changes presentation
36
- only; and no control grants persistence, approval, dispatch, or implementation
37
- authority. Use `-- --dry-run` when literal flag-like content leads the prompt.
27
+ Parsing identifies controls but does not apply them. Route Direct first, then apply controls only to requests that remain in Brainstorm. `--deep` may raise non-direct analysis depth but never lower a gate; `--visual` changes presentation only; and no control grants persistence, approval, dispatch, or implementation authority. Use `-- --dry-run` when literal flag-like content leads the prompt.
38
28
 
39
29
  ## Front-door routing — before scout or questions
40
30
 
41
31
  Classify intent first. This routing never waives safety or permission rules.
42
32
 
43
- 1. **Direct request:** for a factual answer, a specific command, or an explicitly
44
- different workflow, leave Brainstorm before scout, questions, approval, or
45
- persistence. Read-only product or architecture exploration is not direct merely
46
- because it writes no files.
47
- 2. **Hydrate the contract, then keep routing:** for every request that remains,
48
- reuse accepted Outcome, Constraints, Non-goals, and Acceptance field by field
49
- only when current user text or an approved artifact binds them to the same
50
- target and revision. Preserve current non-conflicting fields; treat missing,
51
- stale, or conflicting fields as gaps. Never infer approval. Hydration is not a
52
- terminal route; continue to exactly one intent route below.
53
- 3. **Bug or failure:** before diagnosis, capture the repaired-behavior Outcome,
54
- Constraints, Non-goals, and Acceptance evidence. Then use `cf:debug` until
55
- root cause is evidenced. Do not brainstorm fixes from a symptom. If at least
56
- two cause-aligned remedies remain, compare 2–3 here. Hand off to `cf:fix`
57
- only when the user explicitly requested a fix; diagnosis-only work returns the
58
- root-cause report and stops.
59
- 4. **Non-bug exploration only:** inspect enough evidence, give a chat
60
- recommendation, and stop. Do not request design approval, persist a report, or
61
- invoke another workflow without a new explicit request.
62
- 5. **Feature or documentation delivery:** continue through the design workflow.
33
+ 1. **Direct request:** for a factual answer, a specific command, or an explicitly different workflow, leave Brainstorm before scout, questions, approval, or persistence. Read-only product or architecture exploration is not direct merely because it writes no files.
34
+ 2. **Plan-and-tasks request:** when the user asks for a plan, a task list, or work split into tasks rather than a choice between designs, leave Brainstorm before scout or questions: say in one or two sentences that Specs owns plans and tasks, and ask the user to invoke `cf:specs` in a new request. Do not interview, compare options, write the list, or start Specs. Open this answer with `Route: plan-and-tasks · Depth: Standard`.
35
+ 3. **Hydrate the contract, then keep routing:** for every request that remains, reuse accepted Outcome, Constraints, Non-goals, and Acceptance field by field only when current user text or an approved artifact binds them to the same target and revision. Preserve current non-conflicting fields; treat missing, stale, or conflicting fields as gaps. Never infer approval. Hydration is not a terminal route; continue to exactly one intent route below.
36
+ 4. **Bug or failure:** before diagnosis, capture the repaired-behavior Outcome, Constraints, Non-goals, and Acceptance evidence. Then use `cf:debug` until root cause is evidenced. Do not brainstorm fixes from a symptom. If at least two cause-aligned remedies remain, compare 2–3 here. Hand off to `cf:fix` only when the user explicitly requested a fix; diagnosis-only work returns the root-cause report and stops.
37
+ 5. **Non-bug exploration only:** inspect enough evidence, give a chat recommendation, and stop. Do not request design approval, persist a report, or invoke another workflow without a new explicit request.
38
+ 6. **Feature or documentation delivery:** continue through the design workflow.
63
39
 
64
40
  ## Adaptive analysis depth
65
41
 
66
- For every non-direct request, choose the smallest adequate depth from current
67
- evidence and material risk:
42
+ For every non-direct request, choose the smallest adequate depth from current evidence and material risk:
68
43
 
69
44
  - **Standard:** bounded single-surface work with no material risk signal.
70
- - **Deep:** critical safety/security risk; public compatibility or data migration;
71
- cross-service state or concurrency; costly or irreversible rollback; or
72
- unresolved feasibility at a material boundary.
73
- - With no Deep signal, use Standard. `--deep` raises Standard to Deep. If three
74
- or more subsystems are independently deliverable, split them instead of using
75
- Deep as a monolithic substitute.
76
-
77
- Deep is selective, not a checklist. Apply a lens only when its trigger is
78
- present and otherwise record `skipped: <reason>`: feasibility for an unresolved
79
- material boundary; stakeholders for externally affected roles; system boundaries
80
- for cross-component state; failure isolation for partial or cascading failure
81
- across boundaries; reversibility and recovery for costly or irreversible failure;
82
- operability for runtime ownership; migration/rollback for data or public
83
- compatibility; testability for a material proof gap; and second-order effects
84
- for downstream behavior or incentives.
45
+ - **Deep:** critical safety/security risk; public compatibility or data migration; cross-service state or concurrency; costly or irreversible rollback; or unresolved feasibility at a material boundary.
46
+ - With no Deep signal, use Standard. `--deep` raises Standard to Deep. If three or more subsystems are independently deliverable, split them instead of using Deep as a monolithic substitute.
47
+
48
+ Open every non-direct answer with one line naming its route and depth, for example `Route: feature delivery · Depth: Standard`. When the answer is a `cf:debug` report, that report's heading comes first and this line follows it.
49
+
50
+ Deep is selective, not a checklist. Apply a lens only when its trigger is present and otherwise record `skipped: <reason>`: feasibility for an unresolved material boundary; stakeholders for externally affected roles; system boundaries for cross-component state; failure isolation for partial or cascading failure across boundaries; reversibility and recovery for costly or irreversible failure; operability for runtime ownership; migration/rollback for data or public compatibility; testability for a material proof gap; and second-order effects for downstream behavior or incentives.
85
51
 
86
52
  ## Contract and evidence
87
53
 
@@ -92,118 +58,64 @@ For feature/docs delivery and every bug/failure, resolve four user-owned fields:
92
58
  - **Non-goals:** nearby work excluded from this delivery.
93
59
  - **Acceptance:** observable evidence that proves completion.
94
60
 
95
- After front-door routing, run `cf:scout` or a narrow equivalent before
96
- technical design. Inspect relevant modules, patterns, docs/plans, contracts, and
97
- runtime constraints; summarize only useful findings in 3–6 bullets.
61
+ After front-door routing, run `cf:scout` or a narrow equivalent before technical design. Inspect relevant modules, patterns, docs/plans, contracts, and runtime constraints; summarize only useful findings in 3–6 bullets.
98
62
 
99
- For supplied images, video, PDFs, or mockups, use `cf:ai-multimodal` when the
100
- optional document bundle is installed; otherwise use the runtime's available
101
- multimodal capability or report the evidence gap. Add a diagram only when it
102
- clarifies a material choice or flow.
63
+ For supplied images, video, PDFs, or mockups, use `cf:ai-multimodal` when the optional document bundle is installed; otherwise use the runtime's available multimodal capability or report the evidence gap. Add a diagram only when it clarifies a material choice or flow.
103
64
 
104
- Derive technical touchpoints from repository evidence. Ask the user about a
105
- touchpoint only when its ownership or scope boundary is a product decision that
106
- cannot be discovered. Keep intent separate from current-state evidence.
65
+ Derive technical touchpoints from repository evidence. Ask the user about a touchpoint only when its ownership or scope boundary is a product decision that cannot be discovered. Keep intent separate from current-state evidence.
107
66
 
108
- On every route, keep feasibility (`confirmed | plausible | unknown |
109
- infeasible`), confidence (`high | medium | low`), and disposition (`chosen |
110
- rejected | deferred`) separate and cite evidence or basis. Missing evidence
111
- forces feasibility `unknown` and confidence `low`. A numeric estimate requires
112
- range, unit, basis, evidence, and assumptions; otherwise report `unknown`.
67
+ On every route, keep feasibility (`confirmed | plausible | unknown | infeasible`), confidence (`high | medium | low`), and disposition (`chosen | rejected | deferred`) separate and cite evidence or basis. Missing evidence forces feasibility `unknown` and confidence `low`. A numeric estimate requires range, unit, basis, evidence, and assumptions; otherwise report `unknown`.
113
68
 
114
- If the request spans three or more independently deliverable subsystems, split
115
- it. A subsystem is independent only when its outcome, boundary, and verification
116
- or deployment path can move through the lifecycle separately.
69
+ If the request spans three or more independently deliverable subsystems, split it. A subsystem is independent only when its outcome, boundary, and verification or deployment path can move through the lifecycle separately.
117
70
 
118
71
  ## Discovery Question Framework
119
72
 
120
- Load `references/question-framework.md` before the first discovery question.
121
- Generate questions from scout evidence, user intent, contract gaps, applicable
122
- domain guidance, and risk surfaces. Never ask the user for a technical fact that
123
- code, docs, or trusted current research can answer.
73
+ Load `references/question-framework.md` before the first discovery question. Generate questions from scout evidence, user intent, contract gaps, applicable domain guidance, and risk surfaces. Never ask the user for a technical fact that code, docs, or trusted current research can answer.
74
+
75
+ Use the runtime's native structured user-input tool when available. Ask one highest-impact question by default; batch at most three independent questions only when none depends on an earlier answer. Record confirmed decisions, assumptions, and open questions separately in the decision register.
124
76
 
125
- Use the runtime's native structured user-input tool when available. Ask one
126
- highest-impact question by default; batch at most three independent questions
127
- only when none depends on an earlier answer. Record confirmed decisions,
128
- assumptions, and open questions separately in the decision register.
77
+ Stop asking when remaining details have safe implementation defaults. Do not force questions merely to consume a budget.
129
78
 
130
- Stop asking when remaining details have safe implementation defaults. Do not
131
- force questions merely to consume a budget.
79
+ When the user delegates a choice ("pick whichever is fastest"), choose from the recorded evidence, say that you chose on the user's behalf and why, record it in the Decision register as a delegated choice, and ask only for the approvals its route requires.
132
80
 
133
81
  ## Options and specialist use
134
82
 
135
- A material design choice exists only when at least two viable paths would satisfy
136
- the contract with meaningfully different consequences.
83
+ A material design choice exists only when at least two viable paths would satisfy the contract with meaningfully different consequences.
137
84
 
138
- - For a material choice, compare 2–3 mechanically distinct viable approaches by
139
- setup cost, runtime complexity, maintenance, UX/DX, compatibility/migration,
140
- risk, and time-to-value.
141
- - With one viable path, present it and explain briefly why alternatives would be
142
- artificial or fail the contract. Never create strawman options.
85
+ - For a material choice, compare 2–3 mechanically distinct viable approaches by setup cost, runtime complexity, maintenance, UX/DX, compatibility/migration, risk, and time-to-value.
86
+ - With one viable path, present it and explain briefly why alternatives would be artificial or fail the contract. Never create strawman options.
143
87
  - Recommend the smallest path that satisfies the contract.
144
88
 
145
- Call `brainstormer` only for a material architectural choice that benefits from
146
- deeper pressure-testing. Use researcher only for current external facts the
147
- repository cannot establish. The controller remains responsible for questions,
148
- approval, persistence, and handoff.
89
+ Unless the user names `brainstormer`, call it only for a material architectural choice that benefits from deeper pressure-testing. When the user names `brainstormer`, call it; tell it which route applies; the routes are feature delivery; an explicitly authorized fix; diagnosis-only bug work; non-bug exploration. Pass the contract with it; it may return a single-path conclusion. Use researcher only for current external facts the repository cannot establish. The controller remains responsible for questions, approval, persistence, and handoff.
149
90
 
150
- `--visual` may present inline Mermaid or ASCII for any non-direct analysis and
151
- falls back to equivalent text when rendering is unavailable. Durable or external
152
- rendering requires explicit user authority before invocation. `--advice` invokes
153
- `brainstormer` only after the material-choice gate; if advice is unavailable or
154
- fails, label it unavailable and continue with controller analysis. Before an
155
- external visual tool or adviser handoff, minimize context and redact secrets,
156
- credentials, private keys, access tokens, and unnecessary PII. Neither overlay
157
- writes, approves, persists, dispatches, or completes work.
91
+ `--visual` may present inline Mermaid or ASCII for any non-direct analysis and falls back to equivalent text when rendering is unavailable. Durable or external rendering requires explicit user authority before invocation. `--advice` invokes `brainstormer` only after the material-choice gate; if advice is unavailable or fails, label it unavailable and continue with controller analysis. Before an external visual tool or adviser handoff, minimize context and redact secrets, credentials, private keys, access tokens, and unnecessary PII. Neither overlay writes, approves, persists, dispatches, or completes work.
158
92
 
159
93
  ## Delivery design and approval
160
94
 
161
95
  For feature or documentation delivery:
162
96
 
163
- 1. Draft one coherent candidate scaled to the work: architecture, data flow,
164
- interfaces/UX, error behavior, verification, and rollout only when material.
97
+ 1. Draft one coherent candidate scaled to the work: architecture, data flow, interfaces/UX, error behavior, verification, and rollout only when material.
165
98
  2. Run the internal 4-point review before presentation:
166
99
  - remove placeholders and vague instructions;
167
100
  - reconcile contradictory behavior;
168
101
  - remove scope creep;
169
102
  - make observable behavior and proof concrete.
170
103
  3. Present the reviewed candidate.
171
- 4. Before final approval, require a separate explicit section decision when
172
- the design changes auth/secrets/privacy, destructive or irreversible behavior
173
- or data-loss risk, money/privilege/safety, or production-state mutation.
174
- 5. After critical section decisions and revisions, request one final approval by
175
- default.
104
+ 4. Before final approval, require a separate explicit section decision when the design changes auth/secrets/privacy, destructive or irreversible behavior or data-loss risk, money/privilege/safety, or production-state mutation.
105
+ 5. After critical section decisions and revisions, request one final approval by default.
176
106
 
177
- Revise material disagreement before handoff. An already accepted, current
178
- contract is not re-approved unless new evidence changes it.
107
+ Revise material disagreement before handoff. An already accepted, current contract is not re-approved unless new evidence changes it.
179
108
 
180
109
  ## Persistence and handoff
181
110
 
182
- Persist only approved decisions and semantics, only with user authority, and
183
- only when they must survive the session or feed Specs. Use the repository's
184
- configured report path and naming convention. Do not create a report merely to
185
- satisfy this skill. Before writing, redact live secrets, credentials, private
186
- keys, access tokens, and unnecessary PII; preserve exact approved meaning with a
187
- safe placeholder and ownership reference instead of copying the sensitive value.
188
-
189
- The default handoff stays in chat Markdown. Use these exact headings:
190
- `Target and evidence freshness`, `Outcome`, `Constraints`, `Non-goals`,
191
- `Acceptance`, `Touchpoints`, `Direction and alternatives`, `Relevant impacts
192
- and failure behavior`, `Rollout and recovery`, `Proof mapping`, `Decision
193
- register`, `Assumptions`, and `Open questions`. The first section records target
194
- identity, current source revision and worktree state or `[UNVERIFIED]`, an
195
- evidence-as-of value, and what change invalidates the brief. Durable file output
196
- requires explicit authority and creates no readiness, approval, proof, or
197
- execution state.
198
-
199
- - Feature/docs delivery: provide the approved summary and ask the user to invoke
200
- `cf:specs` explicitly in a new request.
111
+ Persist only approved decisions and semantics, only with user authority, and only when they must survive the session or feed Specs. Use the repository's configured report path and naming convention. Do not create a report merely to satisfy this skill. Before writing, redact live secrets, credentials, private keys, access tokens, and unnecessary PII; preserve exact approved meaning with a safe placeholder and ownership reference instead of copying the sensitive value.
112
+
113
+ The default handoff stays in chat Markdown. Use these exact headings: `Target and evidence freshness`, `Outcome`, `Constraints`, `Non-goals`, `Acceptance`, `Touchpoints`, `Direction and alternatives`, `Relevant impacts and failure behavior`, `Rollout and recovery`, `Proof mapping`, `Decision register`, `Assumptions`, and `Open questions`. The first section records target identity, current source revision and worktree state or `[UNVERIFIED]`, an evidence-as-of value, and what change invalidates the brief. Durable file output requires explicit authority and creates no readiness, approval, proof, or execution state.
114
+
115
+ - Feature/docs delivery: provide the approved summary and ask the user to invoke `cf:specs` explicitly in a new request.
201
116
  - Diagnosed bug: follow the fix-authority rule in front-door routing.
202
117
  - Non-bug exploration: recommendation already returned in chat; stop.
203
118
 
204
119
  ## Completion bar
205
120
 
206
- Brainstorm is complete when the selected route is explicit, current evidence is
207
- separated from intent, every material user-owned gap is resolved or named, and
208
- the route-specific output has been returned without unauthorized persistence or
209
- implementation. Never claim live behavior from this written contract alone.
121
+ Brainstorm is complete when the selected route is explicit, current evidence is separated from intent, every material user-owned gap is resolved or named, and the route-specific output has been returned without unauthorized persistence or implementation. Never claim live behavior from this written contract alone.
@@ -52,8 +52,7 @@ Browser visibility is resolved automatically by `resolveHeadless()` in `lib/brow
52
52
 
53
53
  Override with `--headless true` or `--headless false` on any script.
54
54
 
55
- - Run multiple scripts/sessions in parallel to simulate real user interactions.
56
- - Run multiple scripts/sessions in parallel to simulate different device types (mobile, tablet, desktop).
55
+ Scripts share one browser and its first tab through `.browser-session.json`, so run them one at a time; parallel runs drive the same page.
57
56
 
58
57
  ## ARIA Snapshot (Element Discovery)
59
58
 
@@ -104,7 +103,6 @@ node "$SKILL_DIR/aria-snapshot.js" --url https://example.com --output ./packages
104
103
 
105
104
  ### Interact by Ref
106
105
 
107
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
108
106
  Use `select-ref.js` to interact with elements by their ref:
109
107
 
110
108
  ```bash
@@ -129,7 +127,6 @@ node "$SKILL_DIR/select-ref.js" --ref e5 --action hover
129
127
 
130
128
  ### Store Snapshots
131
129
 
132
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
133
130
  Store snapshots for analysis in `<project>/packages/spec/src/claude/chrome-devtools/snapshots/`:
134
131
 
135
132
  ```bash
@@ -162,7 +159,6 @@ node "$SKILL_DIR/aria-snapshot.js" --url https://example.com --output packages/s
162
159
 
163
160
  ## Local HTML Files
164
161
 
165
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
166
162
  **IMPORTANT**: Never browse local HTML files via `file://` protocol. Always serve via local server:
167
163
  **Why**: `file://` protocol blocks many browser features (CORS, ES modules, fetch API, service workers). Local server ensures proper HTTP behavior.
168
164
 
@@ -176,7 +172,7 @@ python -m http.server 3000 --directory ./dist &
176
172
  node "$SKILL_DIR/navigate.js" --url http://localhost:3000
177
173
  ```
178
174
 
179
- **Note**: when port 3000 is busy, find an available port with `lsof -i :3000` and use a different one.
175
+ **Note**: when port 3000 is busy, find its owner with `lsof -i :3000`; stop it if you started it, otherwise ask the user. Do not move to another port (`rules/process-management.md`).
180
176
 
181
177
  ## Quick Start
182
178
 
@@ -207,11 +203,10 @@ chrome-devtools auto-detects Chrome at standard OS paths and uses it automatical
207
203
 
208
204
  ### Manual Configuration
209
205
 
210
- To force a specific Chrome installation, copy `.env.example` to `.env` and set `CHROME_EXECUTABLE_PATH`:
206
+ To force a specific Chrome installation, export `CHROME_EXECUTABLE_PATH` (or `PUPPETEER_EXECUTABLE_PATH`) in the shell that runs the scripts; they read the environment, not a `.env` file:
211
207
 
212
208
  ```bash
213
- cp "$SKILL_DIR/.env.example" "$SKILL_DIR/.env"
214
- # Edit .env and set CHROME_EXECUTABLE_PATH to your Chrome executable
209
+ export CHROME_EXECUTABLE_PATH="/path/to/chrome"
215
210
  ```
216
211
 
217
212
  ### Skip Chromium Download
@@ -249,7 +244,6 @@ node "$SKILL_DIR/navigate.js" --url about:blank --close true
249
244
 
250
245
  ## Available Scripts
251
246
 
252
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
253
247
  All in `packages/spec/src/claude/skills/chrome-devtools/scripts/`:
254
248
 
255
249
  | Script | Purpose |
@@ -281,15 +275,14 @@ All in `packages/spec/src/claude/skills/chrome-devtools/scripts/`:
281
275
 
282
276
  ## Writing Custom Test Scripts
283
277
 
284
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
285
- For complex automation, write scripts to `<project>/packages/spec/src/claude/chrome-devtools/tmp/`:
278
+ For complex automation, write scripts to `$SKILL_DIR/../tmp/` (beside `scripts/`, so the `../scripts/lib/browser.js` import resolves):
286
279
 
287
280
  ```bash
288
281
  # Create tmp directory for test scripts
289
- mkdir -p $SKILL_DIR/packages/spec/src/claude/chrome-devtools/tmp
282
+ mkdir -p "$SKILL_DIR/../tmp"
290
283
 
291
284
  # Write a test script
292
- cat > $SKILL_DIR/packages/spec/src/claude/chrome-devtools/tmp/login-test.js << 'EOF'
285
+ cat > "$SKILL_DIR/../tmp/login-test.js" << 'EOF'
293
286
  import { getBrowser, getPage, disconnectBrowser, outputJSON } from '../scripts/lib/browser.js';
294
287
 
295
288
  async function loginTest() {
@@ -315,7 +308,7 @@ loginTest();
315
308
  EOF
316
309
 
317
310
  # Run the test
318
- node $SKILL_DIR/packages/spec/src/claude/chrome-devtools/tmp/login-test.js
311
+ node "$SKILL_DIR/../tmp/login-test.js"
319
312
  ```
320
313
 
321
314
  **Key principles for custom scripts**:
@@ -327,11 +320,7 @@ node $SKILL_DIR/packages/spec/src/claude/chrome-devtools/tmp/login-test.js
327
320
 
328
321
  ## Screenshots
329
322
 
330
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
331
-
332
- **IMPORTANT:** Store browser artifacts in a project-local screenshots or reports folder and include exact output paths in the final report.
333
-
334
- Store screenshots for analysis in `<project>/packages/spec/src/claude/chrome-devtools/screenshots/`:
323
+ Store screenshots in `<project>/packages/spec/src/claude/chrome-devtools/screenshots/` and give their exact output paths in the final report:
335
324
 
336
325
  ```bash
337
326
  # Basic screenshot
@@ -356,15 +345,13 @@ node "$SKILL_DIR/screenshot.js" --url https://example.com --output ./packages/sp
356
345
  node "$SKILL_DIR/screenshot.js" --url https://example.com --output ./packages/spec/src/claude/chrome-devtools/screenshots/page.png --max-size 3
357
346
 
358
347
  # Disable compression
359
- node "$SKILL_DIR/screenshot.js" --url https://example.com --output ./packages/spec/src/claude/chrome-devtools/screenshots/page.png --no-compress
348
+ node "$SKILL_DIR/screenshot.js" --url https://example.com --output ./packages/spec/src/claude/chrome-devtools/screenshots/page.png --no-compress true
360
349
  ```
361
350
 
362
351
  Store screenshots for analysis in `<project>/packages/spec/src/claude/chrome-devtools/screenshots/`.
363
352
 
364
353
  ## Console Log Collection & Analysis
365
354
 
366
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
367
-
368
355
  ### Capture Logs
369
356
 
370
357
  ```bash
@@ -407,7 +394,6 @@ node "$SKILL_DIR/console.js" --url https://example.com --types error --duration
407
394
 
408
395
  ## Finding Elements
409
396
 
410
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
411
397
  Use `snapshot.js` to discover selectors before interacting:
412
398
 
413
399
  ```bash
@@ -423,12 +409,11 @@ node "$SKILL_DIR/snapshot.js" --url https://example.com | jq '.elements[] | sele
423
409
 
424
410
  ## Error Recovery
425
411
 
426
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
427
412
  If script fails:
428
413
 
429
414
  ```bash
430
415
  # 1. Capture current state (without navigating to preserve state)
431
- node "$SKILL_DIR/screenshot.js" --output ./packages/spec/src/claude/skills/chrome-devtools/screenshots/debug.png
416
+ node "$SKILL_DIR/screenshot.js" --output ./packages/spec/src/claude/chrome-devtools/screenshots/debug.png
432
417
 
433
418
  # 2. Get console errors
434
419
  node "$SKILL_DIR/console.js" --url about:blank --types error --duration 1000
@@ -469,22 +454,20 @@ node "$SKILL_DIR/performance.js" --url https://example.com | jq '.vitals'
469
454
  All scripts support:
470
455
  - `--headless true/false` - Override auto-detected headless mode (default: auto by OS)
471
456
  - `--close true` - Close browser completely (default: stay running)
472
- - `--timeout 30000` - Set timeout (ms)
473
- - `--wait-until networkidle2` - Wait strategy
457
+ - `--wait-until networkidle2` - Wait strategy when the script loads `--url`
458
+ - `--timeout <ms>` - read by the scripts that load a page or wait for one (`navigate.js`, `click.js`, `fill.js`, `connect-chrome.js`, `import-cookies.js`, `inject-auth.js`)
474
459
 
475
460
  `navigate.js` additionally supports:
476
461
  - `--wait-for-login <pattern>` - Interactive login: open headed, wait for URL regex match
477
462
  - `--login-timeout <ms>` - Max wait for login completion (default: 300000 = 5 min)
478
463
 
479
464
  ## Troubleshooting
480
- Skills can exist in **project-scope** or **user-scope**. Priority: project-scope > user-scope.
481
-
482
465
  | Error | Solution |
483
466
  |-------|----------|
484
467
  | `Cannot find package 'puppeteer'` | Run `npm install` in scripts directory |
485
468
  | `libnss3.so` missing (Linux) | Run `./install-deps.sh` |
486
469
  | Element not found | Use `snapshot.js` to find correct selector |
487
- | Script hangs | Use `--timeout 60000` or `--wait-until load` |
470
+ | Script hangs | Use `--wait-until load`, or `--timeout 60000` on a script that reads it |
488
471
  | Screenshot >5MB | Auto-compressed; use `--max-size 3` for lower |
489
472
  | Session stale | Delete `.browser-session.json` and retry |
490
473