@erclx/aitk 0.8.0

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 (359) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -0
  3. package/claude/.claude-plugin/plugin.json +19 -0
  4. package/claude/skills/bash-script/SKILL.md +96 -0
  5. package/claude/skills/bash-script/references/patterns.md +349 -0
  6. package/claude/skills/ci-workflow/SKILL.md +52 -0
  7. package/claude/skills/ci-workflow/references/workflows.md +74 -0
  8. package/claude/skills/claude-address-review/SKILL.md +107 -0
  9. package/claude/skills/claude-autoship/SKILL.md +137 -0
  10. package/claude/skills/claude-design-extract/SKILL.md +69 -0
  11. package/claude/skills/claude-design-propose/SKILL.md +75 -0
  12. package/claude/skills/claude-diagram/SKILL.md +126 -0
  13. package/claude/skills/claude-docs/SKILL.md +204 -0
  14. package/claude/skills/claude-feature/REQUIREMENT.md +35 -0
  15. package/claude/skills/claude-feature/SKILL.md +148 -0
  16. package/claude/skills/claude-groundwork/SKILL.md +148 -0
  17. package/claude/skills/claude-groundwork/references/folder-format.md +107 -0
  18. package/claude/skills/claude-memory-capture/SKILL.md +80 -0
  19. package/claude/skills/claude-memory-review/REQUIREMENT.md +37 -0
  20. package/claude/skills/claude-memory-review/SKILL.md +206 -0
  21. package/claude/skills/claude-orchestrate/SKILL.md +125 -0
  22. package/claude/skills/claude-pr-review/SKILL.md +150 -0
  23. package/claude/skills/claude-review/SKILL.md +136 -0
  24. package/claude/skills/claude-roadmap/SKILL.md +61 -0
  25. package/claude/skills/claude-roadmap/references/roadmap.md +52 -0
  26. package/claude/skills/claude-screencast/SKILL.md +160 -0
  27. package/claude/skills/claude-seed-sync/SKILL.md +141 -0
  28. package/claude/skills/claude-slides-draft/SKILL.md +62 -0
  29. package/claude/skills/claude-standards-audit/REQUIREMENT.md +33 -0
  30. package/claude/skills/claude-standards-audit/SKILL.md +79 -0
  31. package/claude/skills/claude-standards-audit/references/branch.md +49 -0
  32. package/claude/skills/claude-standards-audit/references/pr.md +124 -0
  33. package/claude/skills/claude-tasks/SKILL.md +123 -0
  34. package/claude/skills/claude-ui-test/SKILL.md +75 -0
  35. package/claude/skills/claude-ux-audit/SKILL.md +78 -0
  36. package/claude/skills/claude-worktree/SKILL.md +79 -0
  37. package/claude/skills/cli-script/SKILL.md +47 -0
  38. package/claude/skills/cli-script/references/template.md +43 -0
  39. package/claude/skills/create-rule/SKILL.md +68 -0
  40. package/claude/skills/create-skill/REQUIREMENT.md +30 -0
  41. package/claude/skills/create-skill/SKILL.md +24 -0
  42. package/claude/skills/create-snippet/SKILL.md +28 -0
  43. package/claude/skills/create-snippet/references/snippets.md +57 -0
  44. package/claude/skills/create-standard/SKILL.md +31 -0
  45. package/claude/skills/create-standard/references/standard.md +52 -0
  46. package/claude/skills/docs-sync/SKILL.md +87 -0
  47. package/claude/skills/git-branch/REQUIREMENT.md +38 -0
  48. package/claude/skills/git-branch/SKILL.md +60 -0
  49. package/claude/skills/git-branch/references/branch.md +49 -0
  50. package/claude/skills/git-commit/REQUIREMENT.md +33 -0
  51. package/claude/skills/git-commit/SKILL.md +51 -0
  52. package/claude/skills/git-commit/references/commit.md +63 -0
  53. package/claude/skills/git-followup/REQUIREMENT.md +38 -0
  54. package/claude/skills/git-followup/SKILL.md +35 -0
  55. package/claude/skills/git-issue/REQUIREMENT.md +38 -0
  56. package/claude/skills/git-issue/SKILL.md +69 -0
  57. package/claude/skills/git-issue/references/issue.md +84 -0
  58. package/claude/skills/git-pr/REQUIREMENT.md +37 -0
  59. package/claude/skills/git-pr/SKILL.md +119 -0
  60. package/claude/skills/git-pr/references/branch.md +49 -0
  61. package/claude/skills/git-pr/references/pr.md +124 -0
  62. package/claude/skills/git-ship/REQUIREMENT.md +34 -0
  63. package/claude/skills/git-ship/SKILL.md +39 -0
  64. package/claude/skills/git-split/REQUIREMENT.md +38 -0
  65. package/claude/skills/git-split/SKILL.md +160 -0
  66. package/claude/skills/git-split/references/branch.md +49 -0
  67. package/claude/skills/git-split/references/pr.md +124 -0
  68. package/claude/skills/git-stage/REQUIREMENT.md +36 -0
  69. package/claude/skills/git-stage/SKILL.md +74 -0
  70. package/claude/skills/git-stage/references/commit.md +63 -0
  71. package/claude/skills/git-worktree/REQUIREMENT.md +37 -0
  72. package/claude/skills/git-worktree/SKILL.md +120 -0
  73. package/claude/skills/migration-claude-md/SKILL.md +74 -0
  74. package/claude/skills/migration-context/SKILL.md +93 -0
  75. package/claude/skills/migration-standards/SKILL.md +75 -0
  76. package/claude/skills/project-commands/SKILL.md +73 -0
  77. package/claude/skills/session-resume/SKILL.md +36 -0
  78. package/claude/skills/setup-gov/SKILL.md +71 -0
  79. package/claude/skills/setup-indexes/SKILL.md +148 -0
  80. package/claude/skills/setup-init/SKILL.md +114 -0
  81. package/claude/skills/setup-plugins/SKILL.md +81 -0
  82. package/claude/skills/setup-plugins/references/plugin-catalog.md +53 -0
  83. package/claude/skills/setup-verify/SKILL.md +51 -0
  84. package/claude/skills/systematic-debugging/SKILL.md +70 -0
  85. package/claude/skills/toolkit-cli/SKILL.md +38 -0
  86. package/claude/skills/toolkit-feedback/SKILL.md +80 -0
  87. package/claude/skills/toolkit-operator/SKILL.md +45 -0
  88. package/claude/skills/toolkit-triage/SKILL.md +63 -0
  89. package/claude/skills/youtube-transcripts/SKILL.md +34 -0
  90. package/docs/agents.md +371 -0
  91. package/docs/ai-workflow.md +157 -0
  92. package/docs/index.md +20 -0
  93. package/docs/operating-model.md +106 -0
  94. package/docs/target-projects.md +183 -0
  95. package/docs/visual-design-workflow.md +136 -0
  96. package/docs/zshrc-aliases.md +65 -0
  97. package/governance/rules/claude/500-prose.md +12 -0
  98. package/governance/rules/claude/510-context.md +16 -0
  99. package/governance/rules/claude/520-wireframes.md +12 -0
  100. package/governance/rules/claude/530-requirements.md +11 -0
  101. package/governance/rules/claude/540-architecture.md +11 -0
  102. package/governance/rules/claude/550-design.md +11 -0
  103. package/governance/rules/claude/555-tasks.md +12 -0
  104. package/governance/rules/claude/560-diagrams.md +11 -0
  105. package/governance/rules/claude/570-skill.md +18 -0
  106. package/governance/rules/claude/580-readme.md +11 -0
  107. package/governance/rules/claude/590-rule-authoring.md +12 -0
  108. package/governance/rules/core/000-constitution.md +30 -0
  109. package/governance/rules/core/010-testing.md +35 -0
  110. package/governance/rules/core/020-concurrency.md +22 -0
  111. package/governance/rules/core/030-error-handling.md +31 -0
  112. package/governance/rules/core/040-performance.md +20 -0
  113. package/governance/rules/core/050-logging.md +20 -0
  114. package/governance/rules/core/060-naming.md +19 -0
  115. package/governance/rules/core/070-planning.md +13 -0
  116. package/governance/rules/core/080-config-comments.md +22 -0
  117. package/governance/rules/framework/200-react.md +51 -0
  118. package/governance/rules/framework/210-astro.md +41 -0
  119. package/governance/rules/framework/220-fastapi.md +43 -0
  120. package/governance/rules/framework/230-nextjs.md +48 -0
  121. package/governance/rules/framework/250-tailwind.md +32 -0
  122. package/governance/rules/framework/260-shadcn.md +34 -0
  123. package/governance/rules/lang/100-typescript.md +40 -0
  124. package/governance/rules/lang/110-python.md +42 -0
  125. package/governance/rules/lib/300-testing-ts.md +38 -0
  126. package/governance/rules/lib/310-zod.md +25 -0
  127. package/governance/rules/lib/320-tanstack-query.md +32 -0
  128. package/governance/rules/lib/330-testing-py.md +44 -0
  129. package/governance/rules/lib/340-pydantic.md +38 -0
  130. package/governance/rules/lib/350-security-web.md +31 -0
  131. package/governance/rules/ui/400-ui.md +34 -0
  132. package/governance/rules/ui/410-a11y.md +44 -0
  133. package/governance/rules/ui/420-forms.md +34 -0
  134. package/governance/rules/ui/430-ux-completeness.md +62 -0
  135. package/governance/stacks/astro.toml +2 -0
  136. package/governance/stacks/base.toml +2 -0
  137. package/governance/stacks/node.toml +2 -0
  138. package/governance/stacks/python-fastapi.toml +2 -0
  139. package/governance/stacks/python.toml +2 -0
  140. package/governance/stacks/react.toml +2 -0
  141. package/package.json +67 -0
  142. package/scripts/config.sh +11 -0
  143. package/scripts/core/bootstrap.sh +81 -0
  144. package/scripts/core/check-plugin-boundary.sh +45 -0
  145. package/scripts/core/check-skill-paths.sh +25 -0
  146. package/scripts/core/clean.sh +36 -0
  147. package/scripts/core/install-check.sh +93 -0
  148. package/scripts/core/regen-claude-copies.sh +26 -0
  149. package/scripts/core/regen-indexes.sh +10 -0
  150. package/scripts/core/regen-skill-references.sh +27 -0
  151. package/scripts/core/snapshot.sh +132 -0
  152. package/scripts/core/update.sh +35 -0
  153. package/scripts/core/verify.sh +201 -0
  154. package/scripts/docs/list.sh +129 -0
  155. package/scripts/gov/list.sh +234 -0
  156. package/scripts/lib/frontmatter.sh +30 -0
  157. package/scripts/lib/gov.sh +14 -0
  158. package/scripts/lib/sandbox-fixtures.sh +109 -0
  159. package/scripts/lib/sandbox-git.sh +73 -0
  160. package/scripts/lib/tooling.sh +24 -0
  161. package/scripts/lib/ui.sh +173 -0
  162. package/scripts/lib/worktree.sh +20 -0
  163. package/scripts/manage-sandbox.sh +453 -0
  164. package/scripts/snippets/create.sh +156 -0
  165. package/scripts/standards/list.sh +91 -0
  166. package/scripts/tooling/create.sh +109 -0
  167. package/scripts/tooling/ref.sh +141 -0
  168. package/scripts/tooling/verify.sh +179 -0
  169. package/snippets/claude/decision-memo.md +39 -0
  170. package/snippets/claude/feature-recap.md +19 -0
  171. package/snippets/claude/figma-steps.md +18 -0
  172. package/snippets/claude/orchestrator-resume.md +23 -0
  173. package/snippets/claude/orchestrator-sweep.md +10 -0
  174. package/snippets/compact-summary.md +5 -0
  175. package/snippets/create-snippet.md +7 -0
  176. package/snippets/decision-help.md +6 -0
  177. package/snippets/meta-prompt.md +14 -0
  178. package/snippets/research-prompt.md +7 -0
  179. package/snippets/session-notes.md +11 -0
  180. package/snippets/snippets.toml +6 -0
  181. package/snippets/step-by-step.md +10 -0
  182. package/snippets/web-research.md +21 -0
  183. package/src/claude/gitignore.ts +51 -0
  184. package/src/claude/seeds-list.ts +47 -0
  185. package/src/claude/seeds.ts +124 -0
  186. package/src/claude/settings.ts +151 -0
  187. package/src/cli-run.ts +43 -0
  188. package/src/cli.ts +111 -0
  189. package/src/commands/claude.ts +349 -0
  190. package/src/commands/design.ts +39 -0
  191. package/src/commands/docs.ts +59 -0
  192. package/src/commands/feedback-format.ts +23 -0
  193. package/src/commands/feedback.ts +103 -0
  194. package/src/commands/gov.ts +268 -0
  195. package/src/commands/indexes.ts +182 -0
  196. package/src/commands/init.ts +117 -0
  197. package/src/commands/pass-through.ts +39 -0
  198. package/src/commands/sandbox.ts +315 -0
  199. package/src/commands/slides.ts +106 -0
  200. package/src/commands/snippets.ts +236 -0
  201. package/src/commands/standards.ts +89 -0
  202. package/src/commands/sync.ts +211 -0
  203. package/src/commands/tasks.ts +185 -0
  204. package/src/commands/tooling.ts +432 -0
  205. package/src/commands/transcripts.ts +48 -0
  206. package/src/commands/wiki.ts +101 -0
  207. package/src/copy.ts +30 -0
  208. package/src/design/parse.ts +79 -0
  209. package/src/design/render.ts +170 -0
  210. package/src/docs/read.ts +59 -0
  211. package/src/exec.ts +17 -0
  212. package/src/frontmatter.ts +13 -0
  213. package/src/github-format.ts +13 -0
  214. package/src/github.ts +20 -0
  215. package/src/gov/adapter.ts +73 -0
  216. package/src/gov/install.ts +103 -0
  217. package/src/gov/payload.ts +39 -0
  218. package/src/gov/stacks.ts +124 -0
  219. package/src/indexes/frontmatter.ts +46 -0
  220. package/src/indexes/regen.ts +84 -0
  221. package/src/indexes/render.ts +181 -0
  222. package/src/indexes/walk.ts +111 -0
  223. package/src/init/flags.ts +66 -0
  224. package/src/init/plan.ts +128 -0
  225. package/src/init/run.ts +46 -0
  226. package/src/init/steps.ts +91 -0
  227. package/src/sandbox/coverage.ts +115 -0
  228. package/src/sandbox/expect.ts +412 -0
  229. package/src/slides/layouts.ts +391 -0
  230. package/src/slides/open.ts +18 -0
  231. package/src/slides/parse.ts +84 -0
  232. package/src/slides/render.ts +88 -0
  233. package/src/slides/styles.ts +44 -0
  234. package/src/snippets/adapter.ts +34 -0
  235. package/src/snippets/categories.ts +59 -0
  236. package/src/snippets/install.ts +125 -0
  237. package/src/snippets/list.ts +32 -0
  238. package/src/snippets/presets.ts +50 -0
  239. package/src/standards/adapter.ts +51 -0
  240. package/src/standards/index-refresh.ts +44 -0
  241. package/src/standards/install.ts +52 -0
  242. package/src/sync/check.ts +269 -0
  243. package/src/sync/engine.ts +416 -0
  244. package/src/sync/git.ts +204 -0
  245. package/src/sync/stamp.ts +202 -0
  246. package/src/sync/target.ts +79 -0
  247. package/src/sync/workflow.ts +201 -0
  248. package/src/target.ts +43 -0
  249. package/src/tasks/archive.ts +304 -0
  250. package/src/tooling/gitignore.ts +122 -0
  251. package/src/tooling/inject.ts +214 -0
  252. package/src/tooling/list.ts +39 -0
  253. package/src/tooling/manifest.ts +178 -0
  254. package/src/tooling/package.ts +166 -0
  255. package/src/tooling/scan.ts +186 -0
  256. package/src/transcripts/fetch.ts +156 -0
  257. package/src/transcripts/metadata.ts +54 -0
  258. package/src/transcripts/vtt.ts +114 -0
  259. package/src/ui.ts +187 -0
  260. package/src/wiki/init.ts +85 -0
  261. package/standards/architecture.md +41 -0
  262. package/standards/bundled/branch.md +49 -0
  263. package/standards/bundled/commit.md +63 -0
  264. package/standards/bundled/issue.md +84 -0
  265. package/standards/bundled/pr.md +124 -0
  266. package/standards/bundled/roadmap.md +52 -0
  267. package/standards/bundled/snippets.md +57 -0
  268. package/standards/bundled/standard.md +52 -0
  269. package/standards/context.md +132 -0
  270. package/standards/design.md +31 -0
  271. package/standards/diagrams.md +55 -0
  272. package/standards/index.md +21 -0
  273. package/standards/prose.md +122 -0
  274. package/standards/readme.md +163 -0
  275. package/standards/requirements.md +61 -0
  276. package/standards/rule.md +79 -0
  277. package/standards/skill.md +257 -0
  278. package/standards/tasks.md +140 -0
  279. package/standards/versioning.md +47 -0
  280. package/standards/wireframes.md +67 -0
  281. package/tooling/astro/configs/astro.config.mjs +17 -0
  282. package/tooling/astro/configs/eslint.config.js +79 -0
  283. package/tooling/astro/configs/playwright.config.ts +25 -0
  284. package/tooling/astro/configs/tsconfig.json +12 -0
  285. package/tooling/astro/configs/vitest.config.ts +22 -0
  286. package/tooling/astro/manifest.toml +32 -0
  287. package/tooling/astro/reference.md +60 -0
  288. package/tooling/base/configs/.editorconfig +5 -0
  289. package/tooling/base/configs/.github/pull_request_template.md +18 -0
  290. package/tooling/base/configs/.github/workflows/verify.yml +35 -0
  291. package/tooling/base/configs/.husky/commit-msg +1 -0
  292. package/tooling/base/configs/.husky/post-merge +61 -0
  293. package/tooling/base/configs/.husky/post-rewrite +21 -0
  294. package/tooling/base/configs/.husky/pre-commit +1 -0
  295. package/tooling/base/configs/.husky/pre-push +1 -0
  296. package/tooling/base/configs/.prettierrc +12 -0
  297. package/tooling/base/configs/.shellcheckrc +1 -0
  298. package/tooling/base/configs/.vscode/extensions.json +9 -0
  299. package/tooling/base/configs/.vscode/settings.json +3 -0
  300. package/tooling/base/configs/commitlint.config.js +11 -0
  301. package/tooling/base/configs/scripts/clean.sh +45 -0
  302. package/tooling/base/configs/scripts/update.sh +49 -0
  303. package/tooling/base/configs/scripts/verify.sh +64 -0
  304. package/tooling/base/manifest.toml +32 -0
  305. package/tooling/base/reference.md +114 -0
  306. package/tooling/base/seeds/.claude/context/ci.md +27 -0
  307. package/tooling/base/seeds/.claude/context/development.md +32 -0
  308. package/tooling/base/seeds/.cspell/project-terms.txt +0 -0
  309. package/tooling/base/seeds/.cspell/tech-stack.txt +19 -0
  310. package/tooling/base/seeds/.lintstagedrc +8 -0
  311. package/tooling/base/seeds/.prettierignore +0 -0
  312. package/tooling/base/seeds/cspell.json +20 -0
  313. package/tooling/claude/manifest.toml +11 -0
  314. package/tooling/claude/reference.md +62 -0
  315. package/tooling/claude/seeds/.claude/ARCHITECTURE.md +13 -0
  316. package/tooling/claude/seeds/.claude/DESIGN.md +62 -0
  317. package/tooling/claude/seeds/.claude/REQUIREMENTS.md +18 -0
  318. package/tooling/claude/seeds/.claude/context/index.md +8 -0
  319. package/tooling/claude/seeds/.claude/hooks/index-reminder.sh +43 -0
  320. package/tooling/claude/seeds/.claude/hooks/scratch-guard.sh +45 -0
  321. package/tooling/claude/seeds/.claude/hooks/standards-audit.sh +61 -0
  322. package/tooling/claude/seeds/.claude/hooks/tasks-index.sh +60 -0
  323. package/tooling/claude/seeds/.claude/settings.json +39 -0
  324. package/tooling/claude/seeds/.claude/tasks/index.md +8 -0
  325. package/tooling/claude/seeds/.claude/wireframes/index.md +8 -0
  326. package/tooling/claude/seeds/CLAUDE.md +87 -0
  327. package/tooling/claude/user/settings.template.json +10 -0
  328. package/tooling/claude/user/statusline-command.sh +53 -0
  329. package/tooling/python/configs/.coveragerc +14 -0
  330. package/tooling/python/configs/.python-version +1 -0
  331. package/tooling/python/configs/mypy.ini +6 -0
  332. package/tooling/python/configs/pytest.ini +4 -0
  333. package/tooling/python/configs/ruff.toml +15 -0
  334. package/tooling/python/configs/scripts/verify.sh +77 -0
  335. package/tooling/python/manifest.toml +16 -0
  336. package/tooling/python/reference.md +66 -0
  337. package/tooling/python/seeds/.cspell/tech-stack.txt +19 -0
  338. package/tooling/python/seeds/tests/test_smoke.py +2 -0
  339. package/tooling/vite-react/configs/playwright.config.ts +25 -0
  340. package/tooling/vite-react/configs/tsconfig.json +35 -0
  341. package/tooling/vite-react/configs/vite.config.ts +14 -0
  342. package/tooling/vite-react/configs/vitest.config.ts +26 -0
  343. package/tooling/vite-react/manifest.toml +21 -0
  344. package/tooling/vite-react/reference.md +55 -0
  345. package/tooling/vite-react/seeds/.cspell/project-terms.txt +1 -0
  346. package/tooling/vite-react/seeds/.cspell/tech-stack.txt +1 -0
  347. package/tooling/web/configs/.github/workflows/verify.yml +134 -0
  348. package/tooling/web/configs/.vscode/extensions.json +13 -0
  349. package/tooling/web/configs/.vscode/settings.json +10 -0
  350. package/tooling/web/configs/e2e/home.spec.ts +6 -0
  351. package/tooling/web/configs/e2e/screenshot.ts +41 -0
  352. package/tooling/web/configs/eslint.config.js +82 -0
  353. package/tooling/web/configs/scripts/screenshot.sh +28 -0
  354. package/tooling/web/configs/scripts/verify.sh +80 -0
  355. package/tooling/web/configs/src/test/setup.ts +8 -0
  356. package/tooling/web/manifest.toml +57 -0
  357. package/tooling/web/reference.md +95 -0
  358. package/tooling/web/seeds/.cspell/tech-stack.txt +18 -0
  359. package/tsconfig.json +14 -0
@@ -0,0 +1,74 @@
1
+ # CI workflow template
2
+
3
+ Copy this base template and adapt it to the project's stack, test commands, and build output. Add or remove jobs as needed while preserving the parallel and gated structure.
4
+
5
+ ```yaml
6
+ name: CI
7
+
8
+ on:
9
+ push:
10
+ branches: [main]
11
+ pull_request:
12
+ branches: [main]
13
+ workflow_dispatch:
14
+
15
+ jobs:
16
+ static:
17
+ name: '🛡️ Static Checks'
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: oven-sh/setup-bun@v2
22
+ with:
23
+ bun-version: latest
24
+ - run: bun install --frozen-lockfile
25
+ - run: bun run check
26
+
27
+ unit:
28
+ name: '🧪 Unit Tests'
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ - uses: oven-sh/setup-bun@v2
33
+ with:
34
+ bun-version: latest
35
+ - run: bun install --frozen-lockfile
36
+ - run: bun run test
37
+
38
+ build:
39
+ name: '📦 Build Check'
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: oven-sh/setup-bun@v2
44
+ with:
45
+ bun-version: latest
46
+ - run: bun install --frozen-lockfile
47
+ - run: bun run build
48
+ - uses: actions/upload-artifact@v4
49
+ with:
50
+ name: build-output
51
+ path: dist/
52
+
53
+ e2e:
54
+ name: '🎭 E2E Tests'
55
+ needs: build
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+ - uses: oven-sh/setup-bun@v2
60
+ with:
61
+ bun-version: latest
62
+ - run: bun install --frozen-lockfile
63
+ - uses: actions/download-artifact@v4
64
+ with:
65
+ name: build-output
66
+ path: dist/
67
+ - run: bun run test:e2e
68
+ - uses: actions/upload-artifact@v4
69
+ if: failure()
70
+ with:
71
+ name: e2e-results
72
+ path: test-results/
73
+ retention-days: 7
74
+ ```
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: claude-address-review
3
+ description: Pulls review findings and CI status on the current branch's open PR, fixes each in the working tree, refreshes any stale `.claude/` docs, replies with a summary comment, and pushes a follow-up commit. The worker's return leg after `claude-pr-review`. Use when asked to "address the review", "fix the PR comments", "respond to review", or after an orchestrator posts findings. Do NOT use to write a review. That is `claude-pr-review`.
4
+ ---
5
+
6
+ # Claude address review
7
+
8
+ The worker's half of the review channel. `claude-pr-review` posts findings to
9
+ the PR from an independent session. This skill consumes them: fix, reply, push.
10
+
11
+ ## Guards
12
+
13
+ - If no open PR resolves for the current branch via `gh pr view`, stop: `❌ No open PR. Nothing to address.`
14
+ - If the PR has no review comments or threads, stop: `✅ No review findings to address.`
15
+ - Fix findings. Do not merge.
16
+
17
+ ## Step 1: pull the review findings and CI status
18
+
19
+ Read the review comments and threads on the PR:
20
+
21
+ ```bash
22
+ gh pr view --json number,reviews,comments
23
+ ```
24
+
25
+ For inline review comments, read them via `gh api` on the PR's review comments. Collect each finding with its file, location, and body.
26
+
27
+ Also read the CI check status so the fixes cover failing checks, not only review comments:
28
+
29
+ ```bash
30
+ gh pr checks <number>
31
+ ```
32
+
33
+ Treat a failing check as a finding to resolve alongside the review comments. When no checks are configured, `gh pr checks` reports none and the flow continues on the review findings alone.
34
+
35
+ ## Step 2: address each finding
36
+
37
+ For each finding, implement the fix in the working tree. When a finding is a
38
+ question or a conscious-accept rather than a defect, note the reply text instead
39
+ of editing. Handle each finding independently. Do not let one unresolved finding
40
+ block the others.
41
+
42
+ ## Step 3: verify
43
+
44
+ Run the project check (`bun run check` or the project's documented equivalent).
45
+ Do not push a red follow-up.
46
+
47
+ ## Step 4: refresh stale docs
48
+
49
+ The fixes may have changed or added behavior that `.claude/` context entries, docs, or wireframes describe. Refresh them with the `claude-docs` skill, which maps the changed files to the entries that reference them and rewrites the stale sections. Do not reimplement that mapping here. When a fix adds a new capability with no existing entry, `claude-docs` flags it rather than creating one.
50
+
51
+ ## Step 5: push, then reply
52
+
53
+ Push the fixes before posting the reply so the comment never runs ahead of the
54
+ code it describes. Ship the fixes as a follow-up commit on the same branch with
55
+ the `git-followup` skill, invoked with `reply-owned` so it stages, commits,
56
+ pushes, and refreshes the open PR body without posting its own comment. This
57
+ skill owns the reply. Do not reimplement that flow here. For in-place fixes to
58
+ files the PR body already covers, `git-followup` leaves the body untouched and
59
+ the reply comment carries the fix log.
60
+
61
+ Then write a summary reply to `.claude/.tmp/address-review/reply-<number>.md`
62
+ mapping each finding to what changed, or to a one-line reason when it is a
63
+ conscious-accept rather than a defect. Key the filename on the PR number so two
64
+ sessions addressing different pull requests never overwrite each other between
65
+ the write and the post. Note any `.claude/` docs refreshed as a result of the
66
+ fixes. The reply is a rendered-for-human GitHub surface, so follow
67
+ `.claude/standards/prose.md` for voice, or `${CLAUDE_SKILL_DIR}/../../standards/prose.md`
68
+ when the project does not have it, and keep each mapping to a line or two.
69
+ Open the body with the `## Review response` heading so it anchors as a section
70
+ distinct from human threads and stays subordinate to the `## Review` heading the
71
+ review itself carries. Follow it with a one-line summary sentence, then one
72
+ bullet per finding, each opening with the bolded finding identifier.
73
+ Close the body with `🤖 Addressed by Claude Code` on its own line so the reply
74
+ reads as an independent machine pass, not a human sign-off.
75
+
76
+ Before posting, scan the reply for em dashes and semicolons and rewrite each,
77
+ splitting into two sentences or using a comma. The standards-audit hook skips
78
+ `.claude/.tmp/`, so this scan is the only gate on the published reply. Post it to
79
+ the PR:
80
+
81
+ ```bash
82
+ gh pr comment <number> --body-file .claude/.tmp/address-review/reply-<number>.md
83
+ ```
84
+
85
+ ## Step 6: confirm resolution
86
+
87
+ After the follow-up push, watch CI on the PR. Poll `gh pr checks <number>`
88
+ until no check is pending, then read the final status. When every finding is
89
+ addressed and all checks pass, post one closing comment so the thread has a
90
+ clear terminal state:
91
+
92
+ ```bash
93
+ gh pr comment <number> --body "✅ All review findings addressed, CI green."
94
+ ```
95
+
96
+ If any check fails, do not post the closing comment. Report the failing check
97
+ so it can be fixed first. This is a resolution signal, not a formal approval,
98
+ since the PR author cannot approve their own PR.
99
+
100
+ ## Step 7: output
101
+
102
+ ```plaintext
103
+ Addressed <N> findings on PR #<number>. Follow-up pushed.
104
+ ```
105
+
106
+ Name any finding left as a reply rather than a code change, with its one-line
107
+ reason. Do not merge. Hand back to the orchestrator for re-review.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: claude-autoship
3
+ description: Chains implement → verify → review → ship after a feature plan is approved. Reads the plan for the current branch, runs the full pipeline in one session, and stops on any failure or non-minor review finding. Use when asked to "autoship", "ship this feature end to end", or "run the chain". Do NOT auto-trigger. Requires an approved plan file.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Claude autoship
8
+
9
+ Chain the post-plan pipeline in a single run. Every step has a stop condition. State is always recoverable on stop: code lives on the branch, review output on disk, plan still linked.
10
+
11
+ ## Guards
12
+
13
+ - All `.claude/plans/` and `.claude/review/` reads resolve at the main worktree root, not the current worktree. See Worktrees in `CLAUDE.md`.
14
+ - Run `git branch --show-current` and replace `/` with `-` to derive `<slug>`. If empty, stop: `❌ Detached HEAD. Checkout the feature branch first.`
15
+ - If `.claude/plans/feature-<slug>.md` does not exist at the main worktree root, stop: `❌ No approved plan at .claude/plans/feature-<slug>.md. Run /claude-feature first.`
16
+ - If the working tree has uncommitted changes unrelated to the plan, stop: `❌ Uncommitted changes outside the plan. Commit or stash before autoshipping.`
17
+
18
+ ## Diff baseline
19
+
20
+ Step 5 classifies the changed-file list to decide whether review runs. Resolve the base ref once:
21
+
22
+ ```bash
23
+ git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null
24
+ ```
25
+
26
+ Prefer `origin/main` over local `main`. A local `main` trailing the remote pulls other people's merged commits into the list, so the classifier decides against files this branch never touched.
27
+
28
+ The baseline is unusable when no merge base resolves against either ref. Stop: `❌ No diff baseline against main. Fetch origin, then re-run autoship.`
29
+
30
+ The base equalling HEAD stays usable here, unlike in the four read-only siblings carrying this section. Step 5 runs before anything is committed, since `git-stage` commits at Step 7, so the base equals HEAD on every ordinary run. The classifier diffs the base against the working tree rather than against HEAD, which keeps the uncommitted work in the set at correct scope. Do not port the sibling `base == HEAD` stop into this skill.
31
+
32
+ ## Step 0: enter a worktree
33
+
34
+ If `git rev-parse --git-dir` equals `git rev-parse --git-common-dir`, the session is in the main worktree. Invoke `aitk:claude-worktree` before continuing. The wrapper handles name derivation and branch alignment. Do not call `EnterWorktree` directly.
35
+
36
+ If neither command resolves, stop: `❌ Not a git repository. Autoship needs git or a WorktreeCreate hook.`
37
+
38
+ If the two commands differ, the session is already in a linked worktree. Continue.
39
+
40
+ ## Step 1: read the plan
41
+
42
+ Read `.claude/plans/feature-<slug>.md` at the main worktree root. This file is the scope for this run.
43
+
44
+ ## Step 2: implement
45
+
46
+ Implement only what the plan describes. Do not expand scope. Do not refactor neighbors. Do not touch files outside the plan's "Files to touch" list without reason.
47
+
48
+ ## Step 3: verify
49
+
50
+ Run the verify commands defined in `CLAUDE.md` (lint, typecheck, tests). On failure:
51
+
52
+ - Make **one** fix attempt targeting the reported errors
53
+ - Re-run only the failing command
54
+ - If it still fails, stop: `❌ Verify failed after one fix attempt. Review logs and retry manually.`
55
+
56
+ Do not loop. Do not bypass hooks.
57
+
58
+ ## Step 4: UI test (conditional)
59
+
60
+ If the diff touches UI files (JSX, TSX, Vue, Svelte, HTML, or CSS under `src/`), invoke `aitk:claude-ui-test`.
61
+
62
+ If `claude-ui-test` produces a manual checklist, stop: `❌ UI requires visual verification. Checklist at .claude/review/ui-checklist-<slug>.md. Verify manually, then run /git-ship.`
63
+
64
+ If all UI changes are covered by e2e tests, continue.
65
+
66
+ ## Step 5: review
67
+
68
+ Classify the diff first. Take the union of `git diff --name-only <base>` and `git ls-files --others --exclude-standard`, resolving `<base>` per Diff baseline. The classifier reads names only.
69
+
70
+ An empty list stops the chain: `❌ No changed files to classify. Re-run when the plan has yet to produce its output. When the output is gitignored by design, autoship cannot ship it, so take the work out of the chain.` An empty list satisfies the prose-only test vacuously, so reading it as prose-only routes the branch past review instead of through it.
71
+
72
+ The two causes want different responses. A plan that has yet to produce its output is a re-run once it has. A plan whose output is gitignored by design, such as a read pass writing to `.claude/.tmp/`, is work the chain cannot carry at all, since `git-stage` finds nothing to commit six steps later. Never advise removing the output from `.gitignore`, which trades a stopped run for scratch committed into the repository.
73
+
74
+ If every changed file matches `*.md` or `*.txt`, skip review entirely and continue to Step 7. Prose-only changes are already gated by `docs-sync`, `claude-standards-audit`, and pre-push hooks. Running a code-style review on them burns tokens with no signal.
75
+
76
+ Otherwise invoke `aitk:claude-review`.
77
+
78
+ ## Step 6: evaluate findings
79
+
80
+ Skip this step if Step 5 was skipped (prose-only diff). Otherwise read `.claude/review/review-<slug>.md` at the main worktree root. Parse the summary line (`X critical, Y should-fix, Z minor`):
81
+
82
+ - Any critical or should-fix count greater than zero, stop: `❌ Review found non-minor issues. See .claude/review/review-<slug>.md. Fix and run /git-ship.`
83
+ - Zero critical and zero should-fix, continue. The minor findings stay in the on-disk review receipt. Fold any a reviewer needs into the PR's `## Technical Context`. Do not add a separate review-notes section to the PR body.
84
+
85
+ Do not auto-fix findings. The stop here is deliberate.
86
+
87
+ ## Step 7: ship
88
+
89
+ Invoke each sub-skill in order via the Skill tool. After each returns, invoke the next immediately. Do not output text between steps.
90
+
91
+ 1. `aitk:claude-docs`: sync `.claude/` planning docs against session decisions
92
+ 2. `aitk:docs-sync`: sync public docs against changes since main
93
+ 3. Run `git add -A` to stage files the sync skills wrote
94
+ 4. `aitk:git-stage`: group staged changes and commit by concern
95
+ 5. `aitk:git-branch`: rename the branch to conventional format
96
+ 6. `aitk:git-pr`: push and open the pull request
97
+
98
+ After the PR is created, mark it as draft:
99
+
100
+ ```bash
101
+ gh pr ready --undo
102
+ ```
103
+
104
+ After marking draft, watch CI. Poll `gh pr checks <number>` until no check is pending, then read the final status. On all-pass, continue. On any failure, stop and report the failing check with its URL. Do not auto-fix.
105
+
106
+ 7. `aitk:claude-memory-capture`: extract durable patterns from the session into `.claude/memory/`
107
+ 8. `aitk:claude-memory-review`: if `claude-memory-capture` wrote or updated at least one entry this session, propose fixes scoped to those entries, writing the decision-ready receipt while session context is fresh. Skip when capture wrote nothing.
108
+
109
+ Stop at the Propose phase. Do not run Apply. Promoting an entry to `CLAUDE.md` or a skill body mutates how the agent operates and ships as its own change, separate from this feature.
110
+
111
+ ## Output
112
+
113
+ Respond with up to four lines:
114
+
115
+ ```plaintext
116
+ ✅ Autoshipped (draft): <PR url>
117
+ <N minor findings kept in .claude/review/review-<slug>.md>
118
+ <N memories captured in .claude/memory/>
119
+ <Memory proposal at .claude/review/memory-review-<slug>.md>
120
+ ```
121
+
122
+ Omit the second line if there were no minor findings. Omit the third and fourth lines if `claude-memory-capture` wrote nothing this session, since no captures means no scoped review and no proposal.
123
+
124
+ ## Failure recovery
125
+
126
+ Every stop point leaves recoverable state. The user resumes manually from the appropriate step.
127
+
128
+ | Stop point | Recovery |
129
+ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
130
+ | No plan | Run `/claude-feature` to create one |
131
+ | No diff baseline | Fetch origin so a merge base resolves against `main`, then re-run autoship |
132
+ | Empty changed-file list | Re-run once the plan produces tracked output. Ship gitignored output outside the chain, never by tracking it. |
133
+ | Branch collision on worktree entry | `claude-worktree` Step 5 found `<slug>` already as a local branch. Resolve manually (rename or delete the stale branch), then re-run autoship. |
134
+ | Verify fails | Read logs, fix manually, run `/git-ship` |
135
+ | UI checklist | Verify visually, run `/git-ship` |
136
+ | Review findings | Fix findings, run `/git-ship` |
137
+ | git-ship fails | Inspect hook or remote error, run again |
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: claude-design-extract
3
+ description: Drafts `.claude/DESIGN.md` from a project's existing prose and shell UI surfaces using the toolkit seed template. Reads CLAUDE.md, standards, docs, and CLI UI modules to codify visual intent already implicit in the project. Use when asked to "extract the design system", "draft DESIGN.md", "bootstrap design tokens", or "capture the visual system". Do NOT use to mutate an existing `.claude/DESIGN.md`.
4
+ ---
5
+
6
+ # Design extract
7
+
8
+ ## Guards
9
+
10
+ - If `.claude/DESIGN.md` already exists and has content beyond the seed template, stop: `❌ .claude/DESIGN.md already populated. Edit directly or archive the existing file first.`
11
+ - If `aitk` is not on PATH, stop: `❌ aitk CLI not found.`
12
+
13
+ ## Step 1: read source signals in parallel
14
+
15
+ Read these from the project root, skipping any that do not exist:
16
+
17
+ - `CLAUDE.md`: voice, personality, spelling rules
18
+ - `.claude/REQUIREMENTS.md`: worldview and non-goals that shape visual intent
19
+ - `.claude/standards/prose.md`: tone constraints
20
+ - `src/ui.ts`, `src/ui.tsx`, `src/components/**`: color codes, typography, spacing constants
21
+ - `scripts/lib/ui.sh`, `scripts/lib/*.sh`: ANSI color codes, frame glyphs, spacing conventions
22
+ - `docs/agents.md`, `docs/index.md`: any output shape or framing rules already documented
23
+ - Any `*.css`, `tailwind.config.*`, or `theme.*` file at the project root
24
+
25
+ Read a standard from `${CLAUDE_SKILL_DIR}/../../standards/` instead when the project does not have it.
26
+
27
+ Run these reads in parallel. Do not speculatively recurse into every directory.
28
+
29
+ ## Step 2: fetch the seed template
30
+
31
+ Run this from the project root:
32
+
33
+ ```bash
34
+ aitk claude seeds list --json | jq -r '.[] | select(.path == ".claude/DESIGN.md") | .content'
35
+ ```
36
+
37
+ Use the returned content as the target shape. Keep every section heading and every table header intact. The `aitk design render` parser depends on them.
38
+
39
+ ## Step 3: fill the template
40
+
41
+ Walk each section once, pulling concrete signals from Step 1:
42
+
43
+ - **Personality**: one paragraph. Transcribe what `CLAUDE.md` and `.claude/REQUIREMENTS.md` say about voice, tone, and visual feeling. Do not invent rules the source does not state. Follow `.claude/standards/prose.md`: no em dashes, no semicolons, no marketing buzzwords. If nothing matches, write a one-sentence placeholder ending in `? verify`.
44
+ - **Color**: one row per role. Source hex values from the CLI UI files or stylesheets. If a role has no source signal, leave `Value` blank rather than guessing.
45
+ - **Typography**: one row per role. Source families and sizes from stylesheet or theme config. Leave cells blank when no signal exists.
46
+ - **Spacing**: fill the base unit and multipliers from stylesheet tokens or obvious repeated values in the UI code.
47
+ - **Borders**: one row per role. Source from stylesheet or CSS variables.
48
+ - **Motion** and **Iconography**: one line each. Default to `No animation.` and `No custom icons.` when no evidence exists.
49
+
50
+ Mark any inferred cell by appending ` ? verify` inside the cell value, never as a trailing column. The cell stays inside the table shape: `| display ? verify | | | | |`. A trailing `| ? verify` after the row breaks the parser.
51
+
52
+ ## Step 4: write and render
53
+
54
+ Write the filled template to `.claude/DESIGN.md` from the project root. Then run:
55
+
56
+ ```bash
57
+ aitk design render
58
+ ```
59
+
60
+ The command writes an HTML plus CSS preview to `.claude/review/design/`. Output the path in chat so the user can open it.
61
+
62
+ ## Response format
63
+
64
+ ```plaintext
65
+ 📝 Wrote .claude/DESIGN.md
66
+ 📝 Wrote .claude/review/design/index.html
67
+
68
+ N cells marked `? verify`. Open the preview and confirm before committing.
69
+ ```
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: claude-design-propose
3
+ description: Drafts `.claude/DESIGN.md` on day one of a project from `REQUIREMENTS.md`, `ARCHITECTURE.md`, and a `## Personality` section, with token values proposed by the agent. Use when asked to "propose a design system", "bootstrap DESIGN.md from scratch", "draft tokens for a greenfield project", or "replace Claude Design onboarding". Do NOT use when UI code or stylesheets already exist. Reach for `claude-design-extract` instead.
4
+ ---
5
+
6
+ # Design propose
7
+
8
+ ## Guards
9
+
10
+ - If `.claude/DESIGN.md` already exists and has content beyond the seed template, stop: `❌ .claude/DESIGN.md already populated. Edit directly or archive the existing file first.`
11
+ - If `.claude/REQUIREMENTS.md` is missing, stop: `❌ .claude/REQUIREMENTS.md not found. Write requirements before proposing a design system.`
12
+ - If `.claude/REQUIREMENTS.md` has no `## Personality` section, stop: `❌ .claude/REQUIREMENTS.md missing ## Personality section. Add a paragraph describing voice and tone before running this skill.`
13
+ - If `aitk` is not on PATH, stop: `❌ aitk CLI not found.`
14
+
15
+ ## Step 1: read source signals in parallel
16
+
17
+ Read these from the project root, skipping any that do not exist:
18
+
19
+ - `.claude/REQUIREMENTS.md`: the `## Personality` paragraph, worldview, non-goals
20
+ - `.claude/ARCHITECTURE.md`: platform, tech stack, surface type (CLI, web, desktop)
21
+ - `CLAUDE.md`: voice rules, spelling, conventions
22
+ - `.claude/standards/prose.md`: tone constraints if present
23
+
24
+ Read a standard from `${CLAUDE_SKILL_DIR}/../../standards/` instead when the project does not have it.
25
+
26
+ Do not scan `src/`, stylesheets, or UI modules. This skill runs before code exists. If those files are present, the scenario is wrong and `claude-design-extract` is the correct tool.
27
+
28
+ ## Step 2: fetch the seed template
29
+
30
+ Run this from the project root:
31
+
32
+ ```bash
33
+ aitk claude seeds list --json | jq -r '.[] | select(.path == ".claude/DESIGN.md") | .content'
34
+ ```
35
+
36
+ Use the returned content as the target shape. Keep every section heading and every table header intact. The `aitk design render` parser depends on them.
37
+
38
+ ## Step 3: propose tokens from personality and requirements
39
+
40
+ Walk each section once. Follow `.claude/standards/prose.md` throughout: no em dashes, no semicolons, no marketing buzzwords. Use commas or separate sentences instead.
41
+
42
+ Every proposed table cell is speculative, so every filled table cell gets a trailing `? verify` tag inside the cell value, never as a trailing column.
43
+
44
+ Anchor proposals to signals, not defaults. If the personality says "calm and dense", that pins muted grays and tight spacing. If the requirements say "no motion", Motion writes `No animation.` with no tag. If the architecture names a CLI-only surface, Typography leans monospaced and Borders stays minimal.
45
+
46
+ - **Personality**: transcribe the `## Personality` paragraph from `.claude/REQUIREMENTS.md` verbatim. This is the one section that is not a proposal. No tag.
47
+ - **Color**: one row per role. Rewrite the Intent cell in personality language, for example `warm off-white page canvas` instead of the seed default `page canvas`. Propose hex values that match the personality. Dense and calm → low saturation, high text contrast. Playful → saturated accents. Every Intent and Value cell gets `? verify`.
48
+ - **Typography**: one row per role. Propose families that fit the platform (system UI for web, monospaced for CLI tools, serif for editorial) and a harmonious scale. Every cell gets `? verify`.
49
+ - **Spacing**: propose a base unit that matches density intent. Dense → 4px base. Roomy → 8px base. Keep the Multiplier column as the seed ships it, no tag. Only the Value column gets `? verify`.
50
+ - **Borders**: propose radius and width per role. Sharp and technical → small radius. Soft → larger radius. Every Radius and Width cell gets `? verify`.
51
+ - **Motion**: one line. If the requirements forbid motion, write `No animation.` If motion is allowed, phrase uncertainty inline, for example `Proposed 150ms ease-out, not yet confirmed.` Do not append a trailing `? verify` tag to a prose sentence. It renders raw in the preview.
52
+ - **Iconography**: one line. Propose style and source library matching personality. Phrase uncertainty inline, for example `Proposed outline style, source library not yet chosen.` Do not append a trailing `? verify` tag.
53
+
54
+ Do not invent non-goals. If the personality paragraph does not mention motion and the requirements do not forbid it, a proposed motion line is acceptable.
55
+
56
+ A cell marked `? verify` must stay inside the table shape: `| #ffffff ? verify |`. A trailing `| ? verify` column breaks the parser.
57
+
58
+ ## Step 4: write and render
59
+
60
+ Write the filled template to `.claude/DESIGN.md` from the project root. Then run:
61
+
62
+ ```bash
63
+ aitk design render
64
+ ```
65
+
66
+ The command writes an HTML plus CSS preview to `.claude/review/design/`. Output the path in chat so the user can open it.
67
+
68
+ ## Response format
69
+
70
+ ```plaintext
71
+ 📝 Wrote .claude/DESIGN.md
72
+ 📝 Wrote .claude/review/design/index.html
73
+
74
+ N cells marked `? verify`. Open the preview, confirm the personality read as intended, then edit DESIGN.md directly to lock values.
75
+ ```
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: claude-diagram
3
+ description: Drafts `.claude/DIAGRAMS.md` with one or more Mermaid diagrams describing the project's architecture, request flow, retrieval or data pipeline, and deployment. Reads `.claude/ARCHITECTURE.md` and `REQUIREMENTS.md` when present, falls back to a code-structure scan. Use when asked to "draw the architecture", "diagram the system", "show the components", "give me a flow chart", or "visualize the project". Do NOT use for design tokens (use `claude-design-extract`) or UI audits (use `claude-ux-audit`).
4
+ ---
5
+
6
+ # Claude diagram
7
+
8
+ ## Guards
9
+
10
+ - If no `.claude/ARCHITECTURE.md`, no `.claude/REQUIREMENTS.md`, and no top-level folder structure to scan, stop: `❌ No source signal. Add .claude/ARCHITECTURE.md or run inside a project folder.`
11
+
12
+ ## Step 1: read sources in parallel
13
+
14
+ Read these from the project root, skipping any that do not exist:
15
+
16
+ - `.claude/ARCHITECTURE.md`: layered components, key technical decisions
17
+ - `.claude/REQUIREMENTS.md`: tech stack, MVP feature list
18
+ - `CLAUDE.md`: project type, conventions
19
+ - `package.json`, `pyproject.toml`, `Cargo.toml`: language and framework markers
20
+ - Top-level folder layout and root config files via `ls`: deploy targets, infrastructure config, component boundaries
21
+
22
+ Run all reads in parallel. Do not recurse speculatively.
23
+
24
+ ## Step 2: pick which diagrams to emit
25
+
26
+ Emit a diagram only when its source signal exists. Skip the rest, do not pad the file.
27
+
28
+ - **Components** (`flowchart TB` with `subgraph` boundaries): always, when any signal exists. Shows the layered structure of the system.
29
+ - **Request flow** (`sequenceDiagram`): when prose describes a request lifecycle, an agent loop, or interaction between actors
30
+ - **Data pipeline** (`flowchart TB`): when prose mentions retrieval, ranking, queues, ETL, or pipelines
31
+ - **Deployment** (`flowchart TB`): when the top-level listing contains deploy or infrastructure config, or `.claude/ARCHITECTURE.md` has a deploy section
32
+
33
+ Stay inside `flowchart` and `sequenceDiagram`. Do not emit C4, state, ER, or class diagrams. They render inconsistently across viewers.
34
+
35
+ Follow `.claude/standards/diagrams.md` for layout, budgets, accessibility, verification, labeling, narrative, and explanation rules, or `${CLAUDE_SKILL_DIR}/../../standards/diagrams.md` when the project does not have it. `flowchart TB` is the default. Reach for `flowchart LR` only when a pipeline genuinely cannot read top-to-bottom, and call it out in the explanation paragraph.
36
+
37
+ ## Step 3: write the file
38
+
39
+ Read the existing `.claude/DIAGRAMS.md` from the project root when it is present, then write to that path. Always overwrite. The prior content is what tells Step 4 which mermaid bodies this pass actually changed.
40
+
41
+ File format:
42
+
43
+ ````markdown
44
+ # Diagrams
45
+
46
+ <one-paragraph note on what this file contains and which sources drove it>
47
+
48
+ ## <Section title>
49
+
50
+ <one-line description of what this diagram shows>
51
+
52
+ ```mermaid
53
+ <diagram type>
54
+ accTitle: <what the diagram answers>
55
+ accDescr: <the structure in one sentence>
56
+ <body>
57
+ ```
58
+
59
+ ## <Next section>
60
+
61
+ ...
62
+ ````
63
+
64
+ When sources came from a code scan rather than planning prose, lead the intro paragraph with `Source: code.` and add `Fidelity is lower than prose-driven diagrams. Verify against the project's intent.`
65
+
66
+ Quote node labels containing spaces or special characters with double quotes (`A["Web shell"]`). Avoid parentheses inside labels, they break some renderers. Use `<br/>` for line breaks inside labels.
67
+
68
+ Apply the toolkit's prose bans to the entire file, including inside mermaid `subgraph` labels and node text. No em-dashes, no semicolons. Use a colon or split into two sentences instead. The standards-audit hook treats mermaid syntax as prose and will reject the file on every violation, forcing a retry per label.
69
+
70
+ ## Step 4: render what this pass changed
71
+
72
+ A source that satisfies every rule in the standard can still render as a picture that asserts something false about the system. Verification runs on the image.
73
+
74
+ Render each diagram this pass wrote or changed. Skip any whose mermaid body is unchanged from the content read in Step 3, since an untouched diagram cannot develop a new render defect and the cost is linear in diagram count.
75
+
76
+ Before the first render in a project, say what is about to block:
77
+
78
+ ```plaintext
79
+ Rendering to verify layout. The first run downloads the Mermaid CLI and takes about 15 seconds.
80
+ ```
81
+
82
+ Write each diagram's mermaid body to its own scratch file, then render it:
83
+
84
+ ```bash
85
+ mkdir -p .claude/.tmp/diagrams && bunx -y @mermaid-js/mermaid-cli -i .claude/.tmp/diagrams/<slug>.mmd -o .claude/.tmp/diagrams/<slug>.png
86
+ ```
87
+
88
+ Render to PNG. An SVG export reads back as markup with no recoverable spatial meaning, so it cannot be verified. Use `bunx` when bun is available. Fall back to `npx -y @mermaid-js/mermaid-cli ...` otherwise.
89
+
90
+ Renders are verification artifacts, not deliverables. They stay in `.claude/.tmp/diagrams/` and are never committed.
91
+
92
+ When the render fails for any reason (no browser engine, no network, no package manager), continue to Step 6 and name the skipped check in the chat output. A missing renderer degrades the loop, it does not fail it.
93
+
94
+ ## Step 5: read the render back
95
+
96
+ Read each PNG and judge the picture against what the diagram means to say. Follow the verification properties in `.claude/standards/diagrams.md`, or `${CLAUDE_SKILL_DIR}/../../standards/diagrams.md` when the project does not have it.
97
+
98
+ Fix the source and re-render. Stop after two correction passes on a diagram.
99
+
100
+ When a defect survives, write the diagram and name the defect in the chat output. A diagram whose author states the flaw is recoverable. A wrong diagram reported as verified is not.
101
+
102
+ ## Step 6: chat output
103
+
104
+ ```plaintext
105
+ 📝 Wrote .claude/DIAGRAMS.md with N diagrams.
106
+
107
+ Verified N renders. <defect or skipped check, one line each, omitted when clean>
108
+
109
+ Open in any viewer with native Mermaid support (VS Code with `bierner.markdown-mermaid`, GitHub, Cursor) to render. Ask to export if you want SVG or PNG files.
110
+ ```
111
+
112
+ Do not echo the diagram bodies in chat. Never report a clean verification when a render was skipped or a defect survived.
113
+
114
+ ## Step 7: export on request
115
+
116
+ If the user asks to export the diagrams (`export to svg`, `give me images`, `render to png`), run:
117
+
118
+ ```bash
119
+ mkdir -p .claude/review/diagrams && bunx -y @mermaid-js/mermaid-cli -i .claude/DIAGRAMS.md -o .claude/review/diagrams/diagram.png
120
+ ```
121
+
122
+ Export PNG by default. Swap `diagram.png` for `diagram.svg` only when the user asks for vector, and never for the Step 4 verification path. The CLI writes one file per `mermaid` block (`diagram-1.png`, `diagram-2.png`, ...). Output line:
123
+
124
+ ```plaintext
125
+ 📝 Wrote N files to .claude/review/diagrams/
126
+ ```