@istmx/skills 2.0.0 → 2.1.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 (230) hide show
  1. package/README.md +141 -51
  2. package/RELEASE_v2.1.0.md +68 -0
  3. package/bin/cli.js +64 -86
  4. package/context/conversation_transcript.md +786 -0
  5. package/context/progress.md +129 -0
  6. package/istm/SKILL.md +20 -11
  7. package/istm-animate/SKILL.md +19 -11
  8. package/istm-architecture/SKILL.md +70 -14
  9. package/istm-architecture/templates/agents.md +21 -2
  10. package/istm-awwward-designer/SKILL.md +31 -7
  11. package/istm-design/SKILL.md +26 -12
  12. package/istm-design/anti-laziness/architectural-patterns.md +55 -0
  13. package/istm-design/anti-laziness/parameter-tuning.md +44 -0
  14. package/istm-design/anti-laziness/prompt-engineering.md +52 -0
  15. package/istm-design/anti-laziness/reference-prompts.md +79 -0
  16. package/istm-design/archetypes/brandkit/SKILL.md +798 -0
  17. package/istm-design/archetypes/brutalist/SKILL.md +92 -0
  18. package/istm-design/archetypes/minimalist/SKILL.md +85 -0
  19. package/istm-design/archetypes/soft/SKILL.md +98 -0
  20. package/istm-design/core/ui-ux-pro-max/data/stacks/wpf.csv +1 -1
  21. package/istm-design/core/ui-ux-pro-max/scripts/design_system.py +1 -1
  22. package/istm-design/image-to-code/SKILL.md +1228 -0
  23. package/istm-design/imagegen/SKILL.md +987 -0
  24. package/istm-design/presets/airbnb/DESIGN.md +545 -0
  25. package/istm-design/presets/airbnb/README.md +5 -0
  26. package/istm-design/presets/airtable/DESIGN.md +554 -0
  27. package/istm-design/presets/airtable/README.md +5 -0
  28. package/istm-design/presets/apple/DESIGN.md +562 -0
  29. package/istm-design/presets/apple/README.md +5 -0
  30. package/istm-design/presets/binance/DESIGN.md +634 -0
  31. package/istm-design/presets/binance/README.md +5 -0
  32. package/istm-design/presets/bmw/DESIGN.md +544 -0
  33. package/istm-design/presets/bmw/README.md +5 -0
  34. package/istm-design/presets/bmw-m/DESIGN.md +503 -0
  35. package/istm-design/presets/bmw-m/README.md +5 -0
  36. package/istm-design/presets/bugatti/DESIGN.md +454 -0
  37. package/istm-design/presets/bugatti/README.md +5 -0
  38. package/istm-design/presets/cal/DESIGN.md +542 -0
  39. package/istm-design/presets/cal/README.md +5 -0
  40. package/istm-design/presets/catalog.md +127 -0
  41. package/istm-design/presets/claude/DESIGN.md +589 -0
  42. package/istm-design/presets/claude/README.md +5 -0
  43. package/istm-design/presets/clay/DESIGN.md +541 -0
  44. package/istm-design/presets/clay/README.md +5 -0
  45. package/istm-design/presets/clickhouse/DESIGN.md +544 -0
  46. package/istm-design/presets/clickhouse/README.md +5 -0
  47. package/istm-design/presets/cohere/DESIGN.md +451 -0
  48. package/istm-design/presets/cohere/README.md +5 -0
  49. package/istm-design/presets/coinbase/DESIGN.md +570 -0
  50. package/istm-design/presets/coinbase/README.md +5 -0
  51. package/istm-design/presets/composio/DESIGN.md +506 -0
  52. package/istm-design/presets/composio/README.md +5 -0
  53. package/istm-design/presets/cursor/DESIGN.md +537 -0
  54. package/istm-design/presets/cursor/README.md +5 -0
  55. package/istm-design/presets/dell-1996/DESIGN.md +632 -0
  56. package/istm-design/presets/dell-1996/README.md +5 -0
  57. package/istm-design/presets/elevenlabs/DESIGN.md +504 -0
  58. package/istm-design/presets/elevenlabs/README.md +5 -0
  59. package/istm-design/presets/expo/DESIGN.md +526 -0
  60. package/istm-design/presets/expo/README.md +5 -0
  61. package/istm-design/presets/ferrari/DESIGN.md +531 -0
  62. package/istm-design/presets/ferrari/README.md +5 -0
  63. package/istm-design/presets/figma/DESIGN.md +578 -0
  64. package/istm-design/presets/figma/README.md +5 -0
  65. package/istm-design/presets/framer/DESIGN.md +544 -0
  66. package/istm-design/presets/framer/README.md +5 -0
  67. package/istm-design/presets/hashicorp/DESIGN.md +575 -0
  68. package/istm-design/presets/hashicorp/README.md +5 -0
  69. package/istm-design/presets/hp/DESIGN.md +670 -0
  70. package/istm-design/presets/hp/README.md +5 -0
  71. package/istm-design/presets/ibm/DESIGN.md +550 -0
  72. package/istm-design/presets/ibm/README.md +5 -0
  73. package/istm-design/presets/intercom/DESIGN.md +546 -0
  74. package/istm-design/presets/intercom/README.md +5 -0
  75. package/istm-design/presets/kraken/DESIGN.md +125 -0
  76. package/istm-design/presets/kraken/README.md +5 -0
  77. package/istm-design/presets/lamborghini/DESIGN.md +288 -0
  78. package/istm-design/presets/lamborghini/README.md +5 -0
  79. package/istm-design/presets/linear/DESIGN.md +548 -0
  80. package/istm-design/presets/linear/README.md +5 -0
  81. package/istm-design/presets/lovable/DESIGN.md +298 -0
  82. package/istm-design/presets/lovable/README.md +5 -0
  83. package/istm-design/presets/mastercard/DESIGN.md +365 -0
  84. package/istm-design/presets/mastercard/README.md +5 -0
  85. package/istm-design/presets/meta/DESIGN.md +683 -0
  86. package/istm-design/presets/meta/README.md +5 -0
  87. package/istm-design/presets/minimax/DESIGN.md +746 -0
  88. package/istm-design/presets/minimax/README.md +5 -0
  89. package/istm-design/presets/mintlify/DESIGN.md +852 -0
  90. package/istm-design/presets/mintlify/README.md +5 -0
  91. package/istm-design/presets/miro/DESIGN.md +825 -0
  92. package/istm-design/presets/miro/README.md +5 -0
  93. package/istm-design/presets/mistral/DESIGN.md +773 -0
  94. package/istm-design/presets/mistral/README.md +5 -0
  95. package/istm-design/presets/mongodb/DESIGN.md +767 -0
  96. package/istm-design/presets/mongodb/README.md +5 -0
  97. package/istm-design/presets/nike/DESIGN.md +575 -0
  98. package/istm-design/presets/nike/README.md +5 -0
  99. package/istm-design/presets/nintendo-2001/DESIGN.md +649 -0
  100. package/istm-design/presets/nintendo-2001/README.md +5 -0
  101. package/istm-design/presets/notion/DESIGN.md +821 -0
  102. package/istm-design/presets/notion/README.md +5 -0
  103. package/istm-design/presets/nvidia/DESIGN.md +640 -0
  104. package/istm-design/presets/nvidia/README.md +5 -0
  105. package/istm-design/presets/ollama/DESIGN.md +539 -0
  106. package/istm-design/presets/ollama/README.md +5 -0
  107. package/istm-design/presets/opencode/DESIGN.md +521 -0
  108. package/istm-design/presets/opencode/README.md +5 -0
  109. package/istm-design/presets/pinterest/DESIGN.md +597 -0
  110. package/istm-design/presets/pinterest/README.md +5 -0
  111. package/istm-design/presets/playstation/DESIGN.md +661 -0
  112. package/istm-design/presets/playstation/README.md +5 -0
  113. package/istm-design/presets/posthog/DESIGN.md +690 -0
  114. package/istm-design/presets/posthog/README.md +5 -0
  115. package/istm-design/presets/raycast/DESIGN.md +669 -0
  116. package/istm-design/presets/raycast/README.md +5 -0
  117. package/istm-design/presets/renault/DESIGN.md +589 -0
  118. package/istm-design/presets/renault/README.md +5 -0
  119. package/istm-design/presets/replicate/DESIGN.md +616 -0
  120. package/istm-design/presets/replicate/README.md +5 -0
  121. package/istm-design/presets/resend/DESIGN.md +585 -0
  122. package/istm-design/presets/resend/README.md +5 -0
  123. package/istm-design/presets/revolut/DESIGN.md +636 -0
  124. package/istm-design/presets/revolut/README.md +5 -0
  125. package/istm-design/presets/runwayml/DESIGN.md +244 -0
  126. package/istm-design/presets/runwayml/README.md +5 -0
  127. package/istm-design/presets/sanity/DESIGN.md +357 -0
  128. package/istm-design/presets/sanity/README.md +5 -0
  129. package/istm-design/presets/sentry/DESIGN.md +551 -0
  130. package/istm-design/presets/sentry/README.md +5 -0
  131. package/istm-design/presets/shopify/DESIGN.md +516 -0
  132. package/istm-design/presets/shopify/README.md +5 -0
  133. package/istm-design/presets/slack/DESIGN.md +482 -0
  134. package/istm-design/presets/spacex/DESIGN.md +363 -0
  135. package/istm-design/presets/spacex/README.md +5 -0
  136. package/istm-design/presets/spotify/DESIGN.md +246 -0
  137. package/istm-design/presets/spotify/README.md +5 -0
  138. package/istm-design/presets/starbucks/DESIGN.md +580 -0
  139. package/istm-design/presets/starbucks/README.md +5 -0
  140. package/istm-design/presets/stripe/DESIGN.md +487 -0
  141. package/istm-design/presets/stripe/README.md +5 -0
  142. package/istm-design/presets/supabase/DESIGN.md +462 -0
  143. package/istm-design/presets/supabase/README.md +5 -0
  144. package/istm-design/presets/superhuman/DESIGN.md +448 -0
  145. package/istm-design/presets/superhuman/README.md +5 -0
  146. package/istm-design/presets/tesla/DESIGN.md +286 -0
  147. package/istm-design/presets/tesla/README.md +5 -0
  148. package/istm-design/presets/theverge/DESIGN.md +339 -0
  149. package/istm-design/presets/theverge/README.md +5 -0
  150. package/istm-design/presets/together/DESIGN.md +633 -0
  151. package/istm-design/presets/together/README.md +5 -0
  152. package/istm-design/presets/uber/DESIGN.md +636 -0
  153. package/istm-design/presets/uber/README.md +5 -0
  154. package/istm-design/presets/vercel/DESIGN.md +736 -0
  155. package/istm-design/presets/vercel/README.md +5 -0
  156. package/istm-design/presets/vodafone/DESIGN.md +538 -0
  157. package/istm-design/presets/vodafone/README.md +5 -0
  158. package/istm-design/presets/voltagent/DESIGN.md +521 -0
  159. package/istm-design/presets/voltagent/README.md +5 -0
  160. package/istm-design/presets/warp/DESIGN.md +526 -0
  161. package/istm-design/presets/warp/README.md +5 -0
  162. package/istm-design/presets/webflow/DESIGN.md +588 -0
  163. package/istm-design/presets/webflow/README.md +5 -0
  164. package/istm-design/presets/wired/DESIGN.md +497 -0
  165. package/istm-design/presets/wired/README.md +5 -0
  166. package/istm-design/presets/wise/DESIGN.md +544 -0
  167. package/istm-design/presets/wise/README.md +5 -0
  168. package/istm-design/presets/xai/DESIGN.md +465 -0
  169. package/istm-design/presets/xai/README.md +5 -0
  170. package/istm-design/presets/zapier/DESIGN.md +537 -0
  171. package/istm-design/presets/zapier/README.md +5 -0
  172. package/istm-design/references/pick-ui-library.md +1 -1
  173. package/istm-design/semantic-design/DESIGN.md +121 -0
  174. package/istm-design/semantic-design/SKILL.md +184 -0
  175. package/istm-system-design/SKILL.md +12 -5
  176. package/istm-workflow/istm-autoplan/SKILL.md +1905 -0
  177. package/istm-workflow/istm-autoplan/SKILL.md.tmpl +923 -0
  178. package/istm-workflow/istm-craft/SKILL.md +12 -6
  179. package/istm-workflow/istm-cso/ACKNOWLEDGEMENTS.md +14 -0
  180. package/istm-workflow/istm-cso/SKILL.md +1313 -0
  181. package/istm-workflow/istm-cso/SKILL.md.tmpl +407 -0
  182. package/istm-workflow/istm-cso/sections/audit-phases.md +253 -0
  183. package/istm-workflow/istm-cso/sections/audit-phases.md.tmpl +251 -0
  184. package/istm-workflow/istm-cso/sections/manifest.json +14 -0
  185. package/istm-workflow/istm-debt/SKILL.md +44 -0
  186. package/istm-workflow/istm-debug/SKILL.md +12 -3
  187. package/istm-workflow/istm-design-review/SKILL.md +2053 -0
  188. package/istm-workflow/istm-design-review/SKILL.md.tmpl +312 -0
  189. package/istm-workflow/istm-develop/SKILL.md +10 -4
  190. package/istm-workflow/istm-eng-review/SKILL.md +1112 -0
  191. package/istm-workflow/istm-eng-review/SKILL.md.tmpl +163 -0
  192. package/istm-workflow/istm-eng-review/sections/manifest.json +14 -0
  193. package/istm-workflow/istm-eng-review/sections/review-sections.md +942 -0
  194. package/istm-workflow/istm-eng-review/sections/review-sections.md.tmpl +225 -0
  195. package/istm-workflow/istm-gain/SKILL.md +50 -0
  196. package/istm-workflow/istm-health/SKILL.md +1104 -0
  197. package/istm-workflow/istm-health/SKILL.md.tmpl +320 -0
  198. package/istm-workflow/istm-qa/BROWSER.md +1468 -0
  199. package/istm-workflow/istm-qa/SKILL.md +1743 -0
  200. package/istm-workflow/istm-qa/SKILL.md.tmpl +354 -0
  201. package/istm-workflow/istm-qa/references/issue-taxonomy.md +85 -0
  202. package/istm-workflow/istm-qa/templates/qa-report-template.md +126 -0
  203. package/istm-workflow/istm-release/SKILL.md +989 -0
  204. package/istm-workflow/istm-release/SKILL.md.tmpl +160 -0
  205. package/istm-workflow/istm-release/sections/manifest.json +14 -0
  206. package/istm-workflow/istm-release/sections/release-body.md +547 -0
  207. package/istm-workflow/istm-release/sections/release-body.md.tmpl +420 -0
  208. package/istm-workflow/istm-review/SKILL.md +57 -0
  209. package/istm-workflow/istm-ship/SKILL.md +1504 -0
  210. package/istm-workflow/istm-ship/SKILL.md.tmpl +582 -0
  211. package/istm-workflow/istm-ship/sections/adversarial.md +218 -0
  212. package/istm-workflow/istm-ship/sections/adversarial.md.tmpl +19 -0
  213. package/istm-workflow/istm-ship/sections/apple-release.md +58 -0
  214. package/istm-workflow/istm-ship/sections/apple-release.md.tmpl +56 -0
  215. package/istm-workflow/istm-ship/sections/changelog.md +45 -0
  216. package/istm-workflow/istm-ship/sections/changelog.md.tmpl +3 -0
  217. package/istm-workflow/istm-ship/sections/greptile.md +51 -0
  218. package/istm-workflow/istm-ship/sections/greptile.md.tmpl +49 -0
  219. package/istm-workflow/istm-ship/sections/manifest.json +62 -0
  220. package/istm-workflow/istm-ship/sections/plan-completion.md +329 -0
  221. package/istm-workflow/istm-ship/sections/plan-completion.md.tmpl +31 -0
  222. package/istm-workflow/istm-ship/sections/pr-body.md +209 -0
  223. package/istm-workflow/istm-ship/sections/pr-body.md.tmpl +207 -0
  224. package/istm-workflow/istm-ship/sections/review-army.md +406 -0
  225. package/istm-workflow/istm-ship/sections/review-army.md.tmpl +56 -0
  226. package/istm-workflow/istm-ship/sections/test-coverage.md +264 -0
  227. package/istm-workflow/istm-ship/sections/test-coverage.md.tmpl +23 -0
  228. package/istm-workflow/istm-ship/sections/tests.md +403 -0
  229. package/istm-workflow/istm-ship/sections/tests.md.tmpl +116 -0
  230. package/package.json +6 -3
@@ -0,0 +1,320 @@
1
+ ---
2
+ name: health
3
+ preamble-tier: 2
4
+ version: 1.0.0
5
+ description: |
6
+ Code quality dashboard. Wraps existing project tools (type checker, linter,
7
+ test runner, dead code detector, shell linter), computes a weighted composite
8
+ 0-10 score, and tracks trends over time. Use when: "health check",
9
+ "code quality", "how healthy is the codebase", "run all checks",
10
+ "quality score". (istm-workflow)
11
+ triggers:
12
+ - code health check
13
+ - quality dashboard
14
+ - how healthy is codebase
15
+ allowed-tools:
16
+ - Bash
17
+ - Read
18
+ - Write
19
+ - Edit
20
+ - Glob
21
+ - Grep
22
+ - AskUserQuestion
23
+ ---
24
+
25
+ {{PREAMBLE}}
26
+
27
+ # /health -- Code Quality Dashboard
28
+
29
+ You are a **Staff Engineer who owns the CI dashboard**. You know that code quality
30
+ isn't one metric -- it's a composite of type safety, lint cleanliness, test coverage,
31
+ dead code, and script hygiene. Your job is to run every available tool, score the
32
+ results, present a clear dashboard, and track trends so the team knows if quality
33
+ is improving or slipping.
34
+
35
+ **HARD GATE:** Do NOT fix any issues. Produce the dashboard and recommendations only.
36
+ The user decides what to act on.
37
+
38
+ ## User-invocable
39
+ When the user types `/health`, run this skill.
40
+
41
+ ---
42
+
43
+ ## Step 1: Detect Health Stack
44
+
45
+ Read CLAUDE.md and look for a `## Health Stack` section. If found, parse the tools
46
+ listed there and skip auto-detection.
47
+
48
+ If no `## Health Stack` section exists, auto-detect available tools:
49
+
50
+ ```bash
51
+ # Type checker
52
+ [ -f tsconfig.json ] && echo "TYPECHECK: tsc --noEmit"
53
+
54
+ # Linter
55
+ [ -f biome.json ] || [ -f biome.jsonc ] && echo "LINT: biome check ."
56
+ setopt +o nomatch 2>/dev/null || true
57
+ ls eslint.config.* .eslintrc.* .eslintrc 2>/dev/null | head -1 | xargs -I{} echo "LINT: eslint ."
58
+ [ -f .pylintrc ] || [ -f pyproject.toml ] && grep -q "pylint\|ruff" pyproject.toml 2>/dev/null && echo "LINT: ruff check ."
59
+
60
+ # Test runner
61
+ [ -f package.json ] && grep -q '"test"' package.json 2>/dev/null && echo "TEST: $(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).scripts.test)" 2>/dev/null)"
62
+ [ -f pyproject.toml ] && grep -q "pytest" pyproject.toml 2>/dev/null && echo "TEST: pytest"
63
+ [ -f Cargo.toml ] && echo "TEST: cargo test"
64
+ [ -f go.mod ] && echo "TEST: go test ./..."
65
+
66
+ # Dead code
67
+ command -v knip >/dev/null 2>&1 && echo "DEADCODE: knip"
68
+ [ -f package.json ] && grep -q '"knip"' package.json 2>/dev/null && echo "DEADCODE: npx knip"
69
+
70
+ # Shell linting
71
+ command -v shellcheck >/dev/null 2>&1 && ls *.sh scripts/*.sh bin/*.sh 2>/dev/null | head -1 | xargs -I{} echo "SHELL: shellcheck"
72
+
73
+ # GBrain presence (D6) — only report as a dimension if istm-brain is actually
74
+ # set up; otherwise skip so machines without istm-brain aren't penalized.
75
+ if command -v istm-brain >/dev/null 2>&1 && [ -f "$HOME/.istm-brain/config.json" ]; then
76
+ echo "ISTM_BRAIN: istm-brain doctor --json (wrapped in timeout 5s)"
77
+ fi
78
+ ```
79
+
80
+ Use Glob to search for shell scripts:
81
+ - `**/*.sh` (shell scripts in the repo)
82
+
83
+ After auto-detection, present the detected tools via AskUserQuestion:
84
+
85
+ "I detected these health check tools for this project:
86
+
87
+ - Type check: `tsc --noEmit`
88
+ - Lint: `biome check .`
89
+ - Tests: `bun test`
90
+ - Dead code: `knip`
91
+ - Shell lint: `shellcheck *.sh`
92
+
93
+ A) Looks right -- persist to CLAUDE.md and continue
94
+ B) I need to adjust some tools (tell me which)
95
+ C) Skip persistence -- just run these"
96
+
97
+ If the user chooses A or B (after adjustments), append or update a `## Health Stack`
98
+ section in CLAUDE.md:
99
+
100
+ ```markdown
101
+ ## Health Stack
102
+
103
+ - typecheck: tsc --noEmit
104
+ - lint: biome check .
105
+ - test: bun test
106
+ - deadcode: knip
107
+ - shell: shellcheck *.sh scripts/*.sh
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Step 2: Run Tools
113
+
114
+ Run each detected tool. For each tool:
115
+
116
+ 1. Record the start time
117
+ 2. Run the command, capturing both stdout and stderr
118
+ 3. Record the exit code
119
+ 4. Record the end time
120
+ 5. Capture the last 50 lines of output for the report
121
+
122
+ ```bash
123
+ # Example for each tool — run each independently
124
+ START=$(date +%s)
125
+ tsc --noEmit 2>&1 | tail -50
126
+ EXIT_CODE=$?
127
+ END=$(date +%s)
128
+ echo "TOOL:typecheck EXIT:$EXIT_CODE DURATION:$((END-START))s"
129
+ ```
130
+
131
+ Run tools sequentially (some may share resources or lock files). If a tool is not
132
+ installed or not found, record it as `SKIPPED` with reason, not as a failure.
133
+
134
+ ---
135
+
136
+ ## Step 3: Score Each Category
137
+
138
+ Score each category on a 0-10 scale using this rubric:
139
+
140
+ | Category | Weight | 10 | 7 | 4 | 0 |
141
+ |-----------|--------|------|-----------|------------|-----------|
142
+ | Type check | 22% | Clean (exit 0) | <10 errors | <50 errors | >=50 errors |
143
+ | Lint | 18% | Clean (exit 0) | <5 warnings | <20 warnings | >=20 warnings |
144
+ | Tests | 28% | All pass (exit 0) | >95% pass | >80% pass | <=80% pass |
145
+ | Dead code | 13% | Clean (exit 0) | <5 unused exports | <20 unused | >=20 unused |
146
+ | Shell lint | 9% | Clean (exit 0) | <5 issues | >=5 issues | N/A (skip) |
147
+ | GBrain (D6) | 10% | doctor=ok, queue<10, pushed <24h | doctor=warnings OR queue<100 OR pushed <72h | doctor broken OR queue>=100 OR pushed >=72h | N/A (istm-brain not installed) |
148
+
149
+ **Parsing tool output for counts:**
150
+ - **tsc:** Count lines matching `error TS` in output.
151
+ - **biome/eslint/ruff:** Count lines matching error/warning patterns. Parse the summary line if available.
152
+ - **Tests:** Parse pass/fail counts from the test runner output. If the runner only reports exit code, use: exit 0 = 10, exit non-zero = 4 (assume some failures).
153
+ - **knip:** Count lines reporting unused exports, files, or dependencies.
154
+ - **shellcheck:** Count distinct findings (lines starting with "In ... line").
155
+
156
+ **Composite score:**
157
+ ```
158
+ composite = (typecheck_score * 0.22) + (lint_score * 0.18) + (test_score * 0.28) + (deadcode_score * 0.13) + (shell_score * 0.09) + (gbrain_score * 0.10)
159
+ ```
160
+
161
+ If a category is skipped (tool not available — includes GBrain when istm-brain
162
+ is not installed), redistribute its weight proportionally among the
163
+ remaining categories.
164
+
165
+ **GBrain sub-score computation (D6):**
166
+
167
+ ```
168
+ doctor_component: 10 if `istm-brain doctor --json | jq -r .status` == "ok";
169
+ 7 if "warnings"; 0 otherwise (or command times out after 5s).
170
+ queue_component: 10 if ~/.istm-workflow/.brain-queue.jsonl has <10 lines;
171
+ 7 if 10-100; 0 if >=100 (suggests secret-scan rejections
172
+ piling up). N/A if artifacts_sync_mode == off.
173
+ push_component: 10 if (now - mtime of ~/.istm-workflow/.brain-last-push) < 24h;
174
+ 7 if <72h; 0 if >=72h. N/A if artifacts_sync_mode == off.
175
+ gbrain_score = 0.5 * doctor_component + 0.3 * queue_component + 0.2 * push_component
176
+ (redistribute 0.3 + 0.2 into doctor when sync_mode is off:
177
+ gbrain_score = doctor_component in that case)
178
+ ```
179
+
180
+ The `istm-brain doctor --json` call MUST be wrapped in `timeout 5s` so a hung
181
+ or misconfigured istm-brain doesn't stall the entire /health dashboard.
182
+
183
+ ---
184
+
185
+ ## Step 4: Present Dashboard
186
+
187
+ Present results as a clear table:
188
+
189
+ ```
190
+ CODE HEALTH DASHBOARD
191
+ =====================
192
+
193
+ Project: <project name>
194
+ Branch: <current branch>
195
+ Date: <today>
196
+
197
+ Category Tool Score Status Duration Details
198
+ ---------- ---------------- ----- -------- -------- -------
199
+ Type check tsc --noEmit 10/10 CLEAN 3s 0 errors
200
+ Lint biome check . 8/10 WARNING 2s 3 warnings
201
+ Tests bun test 10/10 CLEAN 12s 47/47 passed
202
+ Dead code knip 7/10 WARNING 5s 4 unused exports
203
+ Shell lint shellcheck 10/10 CLEAN 1s 0 issues
204
+ GBrain istm-brain doctor 10/10 CLEAN <1s doctor=ok, queue=3, pushed 2h ago
205
+
206
+ COMPOSITE SCORE: 9.1 / 10
207
+
208
+ Duration: 23s total
209
+ ```
210
+
211
+ Use these status labels:
212
+ - 10: `CLEAN`
213
+ - 7-9: `WARNING`
214
+ - 4-6: `NEEDS WORK`
215
+ - 0-3: `CRITICAL`
216
+
217
+ If any category scored below 7, list the top issues from that tool's output:
218
+
219
+ ```
220
+ DETAILS: Lint (3 warnings)
221
+ biome check . output:
222
+ src/utils.ts:42 — lint/complexity/noForEach: Prefer for...of
223
+ src/api.ts:18 — lint/style/useConst: Use const instead of let
224
+ src/api.ts:55 — lint/suspicious/noExplicitAny: Unexpected any
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Step 5: Persist to Health History
230
+
231
+ ```bash
232
+ {{SLUG_SETUP}}
233
+ ```
234
+
235
+ Append one JSONL line to `~/.istm-workflow/projects/$SLUG/health-history.jsonl`:
236
+
237
+ ```json
238
+ {"ts":"2026-03-31T14:30:00Z","branch":"main","score":9.1,"typecheck":10,"lint":8,"test":10,"deadcode":7,"shell":10,"istm-brain":10,"duration_s":23}
239
+ ```
240
+
241
+ Fields:
242
+ - `ts` -- ISO 8601 timestamp
243
+ - `branch` -- current git branch
244
+ - `score` -- composite score (one decimal)
245
+ - `typecheck`, `lint`, `test`, `deadcode`, `shell`, `istm-brain` -- individual category scores (integer 0-10)
246
+ - `duration_s` -- total time for all tools in seconds
247
+
248
+ If a category was skipped, set its value to `null`. Pre-D6 history entries
249
+ won't have a `istm-brain` field — treat them as `null` for trend comparison
250
+ and start new tracking from the first post-D6 run.
251
+
252
+ ---
253
+
254
+ ## Step 6: Trend Analysis + Recommendations
255
+
256
+ Read the last 10 entries from `~/.istm-workflow/projects/$SLUG/health-history.jsonl` (if the
257
+ file exists and has prior entries).
258
+
259
+ ```bash
260
+ {{SLUG_SETUP}}
261
+ tail -10 ~/.istm-workflow/projects/$SLUG/health-history.jsonl 2>/dev/null || echo "NO_HISTORY"
262
+ ```
263
+
264
+ **If prior entries exist, show the trend:**
265
+
266
+ ```
267
+ HEALTH TREND (last 5 runs)
268
+ ==========================
269
+ Date Branch Score TC Lint Test Dead Shell GBrain
270
+ ---------- ----------- ----- -- ---- ---- ---- ----- ------
271
+ 2026-03-28 main 9.4 10 9 10 8 10 10
272
+ 2026-03-29 feat/auth 8.8 10 7 10 7 10 10
273
+ 2026-03-30 feat/auth 8.2 10 6 9 7 10 7
274
+ 2026-03-31 feat/auth 9.1 10 8 10 7 10 10
275
+
276
+ Trend: IMPROVING (+0.9 since last run)
277
+ ```
278
+
279
+ **If score dropped vs the previous run:**
280
+ 1. Identify WHICH categories declined
281
+ 2. Show the delta for each declining category
282
+ 3. Correlate with tool output -- what specific errors/warnings appeared?
283
+
284
+ ```
285
+ REGRESSIONS DETECTED
286
+ Lint: 9 -> 6 (-3) — 12 new biome warnings introduced
287
+ Most common: lint/complexity/noForEach (7 instances)
288
+ Tests: 10 -> 9 (-1) — 2 test failures
289
+ FAIL src/auth.test.ts > should validate token expiry
290
+ FAIL src/auth.test.ts > should reject malformed JWT
291
+ ```
292
+
293
+ **Health improvement suggestions (always show these):**
294
+
295
+ Prioritize suggestions by impact (weight * score deficit):
296
+
297
+ ```
298
+ RECOMMENDATIONS (by impact)
299
+ ============================
300
+ 1. [HIGH] Fix 2 failing tests (Tests: 9/10, weight 30%)
301
+ Run: bun test --verbose to see failures
302
+ 2. [MED] Address 12 lint warnings (Lint: 6/10, weight 20%)
303
+ Run: biome check . --write to auto-fix
304
+ 3. [LOW] Remove 4 unused exports (Dead code: 7/10, weight 15%)
305
+ Run: knip --fix to auto-remove
306
+ ```
307
+
308
+ Rank by `weight * (10 - score)` descending. Only show categories below 10.
309
+
310
+ ---
311
+
312
+ ## Important Rules
313
+
314
+ 1. **Wrap, don't replace.** Run the project's own tools. Never substitute your own analysis for what the tool reports.
315
+ 2. **Read-only.** Never fix issues. Present the dashboard and let the user decide.
316
+ 3. **Respect CLAUDE.md.** If `## Health Stack` is configured, use those exact commands. Do not second-guess.
317
+ 4. **Skipped is not failed.** If a tool isn't available, skip it gracefully and redistribute weight. Do not penalize the score.
318
+ 5. **Show raw output for failures.** When a tool reports errors, include the actual output (tail -50) so the user can act on it without re-running.
319
+ 6. **Trends require history.** On first run, say "First health check -- no trend data yet. Run /health again after making changes to track progress."
320
+ 7. **Be honest about scores.** A codebase with 100 type errors and all tests passing is not healthy. The composite score should reflect reality.