@rashidee/co2 1.2.5

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 (190) hide show
  1. package/dist/index.js +25449 -0
  2. package/drizzle/0000_remarkable_charles_xavier.sql +210 -0
  3. package/drizzle/0001_wise_wolf_cub.sql +13 -0
  4. package/drizzle/0002_secret_spyke.sql +16 -0
  5. package/drizzle/0003_workspace_config_singleton.sql +16 -0
  6. package/drizzle/0004_terminal_claim_v120.sql +11 -0
  7. package/drizzle/0005_brainstorm_v124.sql +10 -0
  8. package/drizzle/0006_project_v140.sql +6 -0
  9. package/drizzle/0007_prd_wizard_v124.sql +14 -0
  10. package/drizzle/0008_workflow_artifact_v126.sql +24 -0
  11. package/drizzle/0009_project_import_v150.sql +7 -0
  12. package/drizzle/0010_quality_v151.sql +3 -0
  13. package/drizzle/meta/0000_snapshot.json +1335 -0
  14. package/drizzle/meta/0001_snapshot.json +1416 -0
  15. package/drizzle/meta/0002_snapshot.json +1510 -0
  16. package/drizzle/meta/_journal.json +83 -0
  17. package/package.json +41 -0
  18. package/plugin/.claude-plugin/marketplace.json +36 -0
  19. package/plugin/.claude-plugin/plugin.json +22 -0
  20. package/plugin/README.md +625 -0
  21. package/plugin/SKILLS.md +350 -0
  22. package/plugin/co2.svg +5 -0
  23. package/plugin/commands/brainstorm-loop.md +129 -0
  24. package/plugin/skills/conductor-defect/SKILL.md +898 -0
  25. package/plugin/skills/conductor-feature-develop/SKILL.md +1383 -0
  26. package/plugin/skills/conductor-feature-develop/references/implementation-domain-template.md +131 -0
  27. package/plugin/skills/conductor-feature-develop/references/implementation-master-template.md +89 -0
  28. package/plugin/skills/conductor-feature-develop/references/playwright-setup.md +224 -0
  29. package/plugin/skills/conductor-feature-prepare/SKILL.md +604 -0
  30. package/plugin/skills/depgen-k8s/SKILL.md +468 -0
  31. package/plugin/skills/depgen-k8s/references/dockerfile-laravel.md +197 -0
  32. package/plugin/skills/depgen-k8s/references/dockerfile-nodejs.md +163 -0
  33. package/plugin/skills/depgen-k8s/references/dockerfile-spring-boot.md +174 -0
  34. package/plugin/skills/depgen-k8s/references/k8s-patterns.md +869 -0
  35. package/plugin/skills/mockgen-shadcn/SKILL.md +1067 -0
  36. package/plugin/skills/mockgen-shadcn/references/admin-layout-template.md +1467 -0
  37. package/plugin/skills/mockgen-shadcn/references/mockup-hub-template.md +498 -0
  38. package/plugin/skills/mockgen-shadcn/references/mockup-index-template.md +216 -0
  39. package/plugin/skills/mockgen-tailwind/SKILL.md +904 -0
  40. package/plugin/skills/mockgen-tailwind/references/admin-layout-template.md +720 -0
  41. package/plugin/skills/mockgen-tailwind/references/mockup-hub-template.md +498 -0
  42. package/plugin/skills/mockgen-tailwind/references/mockup-index-template.md +190 -0
  43. package/plugin/skills/modelgen-nosql/SKILL.md +617 -0
  44. package/plugin/skills/modelgen-nosql/references/model-extraction-methodology.md +497 -0
  45. package/plugin/skills/modelgen-nosql/references/nosql-design-guide.md +258 -0
  46. package/plugin/skills/modelgen-relational/SKILL.md +707 -0
  47. package/plugin/skills/modelgen-relational/references/model-extraction-methodology.md +499 -0
  48. package/plugin/skills/specgen-flutter-riverpod/SKILL.md +898 -0
  49. package/plugin/skills/specgen-flutter-riverpod/references/component-patterns.md +971 -0
  50. package/plugin/skills/specgen-flutter-riverpod/references/notification-patterns.md +457 -0
  51. package/plugin/skills/specgen-flutter-riverpod/references/routing-patterns.md +362 -0
  52. package/plugin/skills/specgen-flutter-riverpod/references/security-patterns.md +709 -0
  53. package/plugin/skills/specgen-flutter-riverpod/references/spec-template.md +1566 -0
  54. package/plugin/skills/specgen-flutter-riverpod/references/state-patterns.md +518 -0
  55. package/plugin/skills/specgen-flutter-riverpod/references/storage-patterns.md +370 -0
  56. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/SKILL.md +984 -0
  57. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/batch-patterns.md +359 -0
  58. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/messaging-patterns.md +468 -0
  59. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/modulith-patterns.md +461 -0
  60. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/reporting-patterns.md +803 -0
  61. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/security-patterns.md +501 -0
  62. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/spec-template.md +1268 -0
  63. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/web-patterns.md +301 -0
  64. package/plugin/skills/specgen-node-cli-web/SKILL.md +561 -0
  65. package/plugin/skills/specgen-node-cli-web/references/auth-patterns.md +293 -0
  66. package/plugin/skills/specgen-node-cli-web/references/cli-packaging-patterns.md +250 -0
  67. package/plugin/skills/specgen-node-cli-web/references/server-patterns.md +247 -0
  68. package/plugin/skills/specgen-node-cli-web/references/spec-template.md +401 -0
  69. package/plugin/skills/specgen-node-cli-web/references/testing-patterns.md +174 -0
  70. package/plugin/skills/specgen-react-mui/SKILL.md +789 -0
  71. package/plugin/skills/specgen-react-mui/references/component-patterns.md +1077 -0
  72. package/plugin/skills/specgen-react-mui/references/reporting-patterns.md +1998 -0
  73. package/plugin/skills/specgen-react-mui/references/routing-patterns.md +461 -0
  74. package/plugin/skills/specgen-react-mui/references/security-patterns.md +599 -0
  75. package/plugin/skills/specgen-react-mui/references/spec-template.md +1030 -0
  76. package/plugin/skills/specgen-react-mui/references/state-patterns.md +327 -0
  77. package/plugin/skills/specgen-react-tailwind/SKILL.md +859 -0
  78. package/plugin/skills/specgen-react-tailwind/references/component-patterns.md +1212 -0
  79. package/plugin/skills/specgen-react-tailwind/references/reporting-patterns.md +1529 -0
  80. package/plugin/skills/specgen-react-tailwind/references/routing-patterns.md +669 -0
  81. package/plugin/skills/specgen-react-tailwind/references/security-patterns.md +656 -0
  82. package/plugin/skills/specgen-react-tailwind/references/spec-template.md +1237 -0
  83. package/plugin/skills/specgen-react-tailwind/references/state-patterns.md +327 -0
  84. package/plugin/skills/specgen-sdk-java/SKILL.md +933 -0
  85. package/plugin/skills/specgen-sdk-java/references/api-extraction-patterns.md +247 -0
  86. package/plugin/skills/specgen-sdk-java/references/http-client-patterns.md +495 -0
  87. package/plugin/skills/specgen-sdk-java/references/packaging-patterns.md +366 -0
  88. package/plugin/skills/specgen-sdk-java/references/spec-template.md +956 -0
  89. package/plugin/skills/specgen-spring-jpa-jtehtmx/SKILL.md +1284 -0
  90. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/batch-patterns.md +1224 -0
  91. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/jasper-patterns.md +1638 -0
  92. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/messaging-patterns.md +512 -0
  93. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/modulith-patterns.md +354 -0
  94. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/security-patterns.md +551 -0
  95. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/spec-template.md +2502 -0
  96. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/web-patterns.md +503 -0
  97. package/plugin/skills/specgen-spring-jpa-restapi/SKILL.md +990 -0
  98. package/plugin/skills/specgen-spring-jpa-restapi/references/batch-patterns.md +1224 -0
  99. package/plugin/skills/specgen-spring-jpa-restapi/references/messaging-patterns.md +512 -0
  100. package/plugin/skills/specgen-spring-jpa-restapi/references/modulith-patterns.md +279 -0
  101. package/plugin/skills/specgen-spring-jpa-restapi/references/reporting-patterns.md +1536 -0
  102. package/plugin/skills/specgen-spring-jpa-restapi/references/restapi-patterns.md +722 -0
  103. package/plugin/skills/specgen-spring-jpa-restapi/references/security-patterns.md +351 -0
  104. package/plugin/skills/specgen-spring-jpa-restapi/references/spec-template.md +553 -0
  105. package/plugin/skills/specgen-ts-cli/SKILL.md +861 -0
  106. package/plugin/skills/specgen-ts-cli/references/async-patterns.md +1101 -0
  107. package/plugin/skills/specgen-ts-cli/references/command-patterns.md +383 -0
  108. package/plugin/skills/specgen-ts-cli/references/config-patterns.md +430 -0
  109. package/plugin/skills/specgen-ts-cli/references/database-patterns.md +750 -0
  110. package/plugin/skills/specgen-ts-cli/references/packaging-patterns.md +426 -0
  111. package/plugin/skills/specgen-ts-cli/references/spec-template.md +1391 -0
  112. package/plugin/skills/specgen-ts-cli/references/testing-patterns.md +909 -0
  113. package/plugin/skills/testgen-functional/SKILL.md +1381 -0
  114. package/plugin/skills/tracegen-matrix/SKILL.md +243 -0
  115. package/plugin/skills/util-preparek8senv/SKILL.md +422 -0
  116. package/plugin/skills/util-projectinit/SKILL.md +307 -0
  117. package/plugin/skills/util-projectinit/reference/brainstorm-loop.md +129 -0
  118. package/plugin/skills/util-projectinit/reference/brainstorm-protocol.md +144 -0
  119. package/plugin/skills/util-projectinit/reference/brainstorm-setup-guide.md +153 -0
  120. package/plugin/skills/util-projectinit/reference/brainstorm-template-appdev.md +87 -0
  121. package/plugin/skills/util-projectinit/reference/co2-context-generation-guide.md +761 -0
  122. package/plugin/skills/util-projectsync/SKILL.md +501 -0
  123. package/plugin/skills/util-updprd/SKILL.md +324 -0
  124. package/plugin/skills/util-usanalyzer/SKILL.md +307 -0
  125. package/plugin/skills/util-ustagger/SKILL.md +154 -0
  126. package/static/assets/abnfDiagram-VRR7QNED-DvPuwyCV.js +1 -0
  127. package/static/assets/arc-DRKw7sjs.js +1 -0
  128. package/static/assets/architectureDiagram-ZJ3FMSHR-CaNcxUbC.js +36 -0
  129. package/static/assets/blockDiagram-677ZJIJ3-Demd4AOK.js +132 -0
  130. package/static/assets/c4Diagram-LMCZKHZV-PVKUfc2x.js +10 -0
  131. package/static/assets/channel-C2nVbuwv.js +1 -0
  132. package/static/assets/chunk-2Q5K7J3B-CExf8ww_.js +1 -0
  133. package/static/assets/chunk-32BRIVSS-CFPaoONF.js +1 -0
  134. package/static/assets/chunk-5VM5RSS4-DE2esM67.js +15 -0
  135. package/static/assets/chunk-EX3LRPZG-SON_YdDG.js +231 -0
  136. package/static/assets/chunk-JWPE2WC7-Qxah8LNr.js +1 -0
  137. package/static/assets/chunk-MOJQB5TN-BcWGQV3j.js +88 -0
  138. package/static/assets/chunk-RYQCIY6F-DkDj-OR5.js +1 -0
  139. package/static/assets/chunk-V7JOEXUC-BlI1Mrah.js +206 -0
  140. package/static/assets/chunk-VR4S4FIN-Agf__duj.js +1 -0
  141. package/static/assets/chunk-XXDRQBXY-B5CfAh85.js +1 -0
  142. package/static/assets/classDiagram-OUVF2IWQ-DXJIljsR.js +1 -0
  143. package/static/assets/classDiagram-v2-EOCWNBFH-DXJIljsR.js +1 -0
  144. package/static/assets/cose-bilkent-JH36ORCC-DO0cQkcy.js +1 -0
  145. package/static/assets/cynefin-VYW2F7L2-CfOnsnXc.js +178 -0
  146. package/static/assets/cynefinDiagram-TSTJHNR4-BJ8tULAv.js +62 -0
  147. package/static/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
  148. package/static/assets/dagre-VKFMJZFB-DfjwzHqP.js +4 -0
  149. package/static/assets/defaultLocale-DX6XiGOO.js +1 -0
  150. package/static/assets/diagram-FQU43EPY-CndSOIIM.js +3 -0
  151. package/static/assets/diagram-G47NLZAW-Czf5hN0Z.js +24 -0
  152. package/static/assets/diagram-NH7WQ7WH-COAyojGh.js +24 -0
  153. package/static/assets/diagram-OA4YK3LP-H8PoiN2m.js +30 -0
  154. package/static/assets/diagram-WEI45ONY-DzcaVzjp.js +41 -0
  155. package/static/assets/ebnfDiagram-CCIWWBDH-DPazGYLJ.js +1 -0
  156. package/static/assets/erDiagram-Q63AITRT-Bo-fubgF.js +85 -0
  157. package/static/assets/flowDiagram-23GEKE2U-CSvxUDwh.js +156 -0
  158. package/static/assets/ganttDiagram-NO4QXBWP-DnBveWX6.js +292 -0
  159. package/static/assets/gitGraphDiagram-IHSO6WYX-B3rVL8c-.js +106 -0
  160. package/static/assets/graph-C9eacEi8.js +1 -0
  161. package/static/assets/index-LZSQkLE2.css +41 -0
  162. package/static/assets/index-y7XDSgMG.js +495 -0
  163. package/static/assets/infoDiagram-FWYZ7A6U-CvWV9yy2.js +2 -0
  164. package/static/assets/init-Gi6I4Gst.js +1 -0
  165. package/static/assets/ishikawaDiagram-FXEZZL3T-DF28a1N6.js +70 -0
  166. package/static/assets/journeyDiagram-5HDEW3XC-CB6CugYk.js +139 -0
  167. package/static/assets/kanban-definition-HUTT4EX6-ResSLF6d.js +89 -0
  168. package/static/assets/katex-C5jXJg4s.js +257 -0
  169. package/static/assets/layout-DEXfKzaS.js +1 -0
  170. package/static/assets/linear-CLO--ryk.js +1 -0
  171. package/static/assets/map-Czzmt4hB.js +1 -0
  172. package/static/assets/mindmap-definition-LN4V7U3C-BvW3EbxX.js +96 -0
  173. package/static/assets/ordinal-Cboi1Yqb.js +1 -0
  174. package/static/assets/pegDiagram-2B236MQR-BHCgqrrM.js +1 -0
  175. package/static/assets/pieDiagram-ENE6RG2P-DVmCQ5FA.js +39 -0
  176. package/static/assets/quadrantDiagram-ABIIQ3AL-B3e5KR52.js +7 -0
  177. package/static/assets/railroadDiagram-RFXS5EU6-Csv5ysLc.js +1 -0
  178. package/static/assets/requirementDiagram-TGXJPOKE-DOMVzvnB.js +84 -0
  179. package/static/assets/sankeyDiagram-HTMAVEWB-B1dcTOvy.js +40 -0
  180. package/static/assets/sequenceDiagram-DBY2YBRQ-BY414yeO.js +162 -0
  181. package/static/assets/sizeCapture-X5ZJPWSS-CuJfrfBN.js +1 -0
  182. package/static/assets/stateDiagram-2N3HPSRC-FX4rJkzV.js +1 -0
  183. package/static/assets/stateDiagram-v2-6OUMAXLB-BVufbO_H.js +1 -0
  184. package/static/assets/swimlanes-5IMT3BWC-Sfy58mmv.js +2 -0
  185. package/static/assets/swimlanesDiagram-G3AALYLV-wDCDw08H.js +8 -0
  186. package/static/assets/timeline-definition-FHXFAJF6-CmV7by8p.js +120 -0
  187. package/static/assets/vennDiagram-L72KCM5P-FqIyFZFt.js +34 -0
  188. package/static/assets/wardleyDiagram-EHGQE667-BZ06O45i.js +78 -0
  189. package/static/assets/xychartDiagram-FW5EYKEG-BOkffR06.js +7 -0
  190. package/static/index.html +24 -0
@@ -0,0 +1,761 @@
1
+ # CO2 Context Generation Guide (v2.0)
2
+
3
+ > **Purpose.** Instructions for an AI Agent participating in a brainstorming
4
+ > session whose objective is to turn an application idea into a complete **CO2
5
+ > project context tree**: a root `CLAUDE.md` plus one `PRD.md` per custom
6
+ > application. This single document governs the whole flow — it supersedes and
7
+ > combines the former `co2_claude_md.md` (CLAUDE.md brainstorming guide) and
8
+ > `co2-artifact-generation-spec.md` (artifact generation specification).
9
+ >
10
+ > It is referenced from a brainstorm session document's `## References` and
11
+ > governs both the content of the artifacts and how they are drafted round by
12
+ > round under the brainstorm session protocol (`brainstorm-protocol.md`).
13
+
14
+ ---
15
+
16
+ ## 1. Your role in the brainstorm
17
+
18
+ You are the second brain in a brainstorm. The Human has an idea — possibly
19
+ half-formed. The brainstorm is **iterative**: you produce drafts early and
20
+ **refine them round by round** as the conversation surfaces more detail. The
21
+ drafts are the working artifacts — every round leaves them more complete, more
22
+ accurate, and with fewer `[TODO]` markers than the round before.
23
+
24
+ Your job each round:
25
+
26
+ 1. **Draft / refine** — write the current best-guess artifacts (full files, not
27
+ snippets) to the destination tree at the end of every agent turn.
28
+ 2. **Surface** infrastructure, applications and modules the Human has not yet
29
+ named but the idea clearly implies — put them in the draft, tagged
30
+ `[TODO: confirm]` when uncertain.
31
+ 3. **Challenge** under-specification — especially around bounded contexts. A
32
+ vague module list produces a vague codebase. Show the challenge as a `[TODO]`
33
+ in the draft and a focused question in the round.
34
+ 4. **Probe** — ask 1–5 focused questions per round, scoped to whatever part of
35
+ the current phase's draft is weakest. Do not interrogate; let the draft do
36
+ most of the talking.
37
+
38
+ ### 1.1 Round shape (under the session protocol)
39
+
40
+ Each agent turn follows the same rhythm:
41
+
42
+ - **(files)** Full draft of every in-scope artifact written to the destination
43
+ tree — CLAUDE.md from the very first turn; all PRDs from inventory lock.
44
+ - **(session doc, `Output` section)** The dashboard — overridden every round
45
+ (see §8), including 1–3 diff bullets naming what changed since the previous
46
+ round (additions, splits, merges, deletions) so the Human can track drift.
47
+ - **(session doc, `Round N` questions)** 1–5 focused questions targeting the
48
+ weakest area.
49
+
50
+ ### 1.2 First turn (Round 1 / "round 0 draft")
51
+
52
+ Even when the Human gives a one-sentence idea, your first turn must already
53
+ include a full draft CLAUDE.md skeleton in the destination tree — every
54
+ top-level section present, populated with whatever the sentence implies, the
55
+ rest as `[TODO]`. Never respond with questions alone. The draft is the
56
+ conversation.
57
+
58
+ ### 1.3 Round-by-round refinement principles
59
+
60
+ - **Never delete a draft and restart.** Refine in place. A module that survived
61
+ three rounds has earned its place; don't churn it without reason.
62
+ - **Diff visibility.** Every round, name what changed since the prior round.
63
+ - **Convergence over completeness.** Aim to reduce `[TODO]` count and module
64
+ churn each round. A round that adds five new `[TODO]`s without resolving any
65
+ old ones is a regression — flag it.
66
+ - **Stop conditions are Human-owned.** The inventory lock (§3) and session
67
+ completion are the Human's calls. Present convergence evidence and ask; never
68
+ auto-advance.
69
+
70
+ ---
71
+
72
+ ## 2. Output artifact tree
73
+
74
+ The final deliverable is a folder tree at the destination declared in the
75
+ session's `Output Specification` (format: `co2-tree`):
76
+
77
+ ```
78
+ <destination>/ ← project root
79
+ ├── CLAUDE.md ← project context (§7)
80
+ ├── <app_folder_1>/
81
+ │ └── context/
82
+ │ └── PRD.md
83
+ ├── <app_folder_2>/
84
+ │ └── context/
85
+ │ └── PRD.md
86
+ └── ... ← one folder per Custom Application
87
+ ```
88
+
89
+ - `<app_folder>` = snake_case of the application name (`SkolaFund Web` →
90
+ `skolafund_web`), matching the `# Application Folder structure` section of
91
+ CLAUDE.md exactly.
92
+ - **Every** Custom Application in CLAUDE.md gets a PRD.md — including middleware,
93
+ adapters, CLIs and SDK libraries (library PRDs simply omit the UI-oriented
94
+ sections; see §11.3).
95
+ - Generate **nothing else**: no DEVTOOL.md, no ENVIRONMENT.md, no source code,
96
+ no mockups, no DESIGN_SYSTEM.md (reference it as `[TODO]` where relevant), no
97
+ `.gitignore`. Those are downstream or per-developer concerns.
98
+ - **Never write credentials** into any artifact. Use
99
+ `<to be filled by developer>` or the project standard from `# Rules`
100
+ (`bestrnd` / `B3st1n3t@2025`) — never invent secrets.
101
+
102
+ ---
103
+
104
+ ## 3. Two-phase flow with inventory lock
105
+
106
+ PRD content is keyed by the **application × module matrix** derived from
107
+ CLAUDE.md. Churn in that matrix after PRDs exist multiplies rework across every
108
+ PRD file. Therefore:
109
+
110
+ ### Phase A — CLAUDE.md convergence
111
+ - Rounds produce and refine **CLAUDE.md only**, per §4–§7 below (draft from the
112
+ first turn, diff bullets, `[TODO]` discipline, business-module pushback).
113
+ - **Phase A additions beyond CLAUDE.md content:**
114
+ 1. **App Codes** — assign every Custom Application a unique 2–3 letter
115
+ uppercase code derived from its name initials (`SkolaFund Web` → `SW`,
116
+ `SkolaFund Middleware` → `SM`). Codes seed requirement IDs (§11.5).
117
+ Resolve collisions by extending to 3 letters, confirmed with the Human.
118
+ 2. **App × Module matrix** — maintain, in the session dashboard (§8), a
119
+ matrix of Custom Applications (rows) × Modules (columns) marking which
120
+ modules each application's PRD will contain. Every module must appear in
121
+ at least one application; every application must have at least one module.
122
+ An unmarked column is an orphan module — challenge it.
123
+ - **Inventory lock gate.** When Phase A convergence checks pass (§9.1),
124
+ explicitly ask the Human to lock the inventory (applications + modules +
125
+ matrix). Phase B must not start before the Human answers "lock" (or
126
+ equivalent) in a round answer or feedback. Identity details, Rules,
127
+ Terminology and 3rd-party fine print may continue to evolve after lock —
128
+ only the app/module inventory freezes.
129
+
130
+ ### Phase B — PRD generation and refinement
131
+ - On lock, scaffold every application folder and generate all PRD.md first
132
+ drafts in the same agent turn, then refine round by round.
133
+ - Post-lock inventory changes are allowed **only** on explicit Human
134
+ instruction; when they happen, re-sync the matrix and cascade the change to
135
+ every affected PRD in the same turn (add/remove module sections, never
136
+ renumber existing IDs).
137
+ - Round focus: rather than touching all PRDs shallowly each round, go deep on
138
+ the applications/modules the Human's answers targeted, and say which PRDs
139
+ changed in the diff bullets.
140
+
141
+ ---
142
+
143
+ # PHASE A — CLAUDE.md
144
+
145
+ ## 4. The four lists you must produce
146
+
147
+ Every CLAUDE.md ultimately answers four questions. Treat them as the spine of
148
+ Phase A:
149
+
150
+ | List | What it captures | Where in CLAUDE.md |
151
+ |------|------------------|--------------------|
152
+ | **3rd Party Services** | Infrastructure the project deploys (DBs, queues, caches, SSO) + External Services it consumes (SaaS APIs) | `# Supporting 3rd Party Applications` (+ `## External Services` sub-section) |
153
+ | **Custom Applications** | Apps the team will build (backends, portals, adapters, SDKs, frontends) | `# Custom Applications` |
154
+ | **System Modules** | Cross-cutting framework concerns (auth, audit, notification, …) | `# Modules` → `## System Module` → `### <Module>` |
155
+ | **Business Modules** | Domain bounded contexts | `# Modules` → `## Business Module` → `### <Module>` |
156
+
157
+ Business Modules are the hardest and the highest-leverage. Spend most of the
158
+ brainstorm there.
159
+
160
+ ## 5. Probing checklist — what to ask the Human
161
+
162
+ Ask these in roughly this order. Skip questions the Human has already answered.
163
+ Loop back when an answer reveals a new branch.
164
+
165
+ ### 5.1 Framing
166
+ - What problem does this solve? Who feels the pain today?
167
+ - Who are the **actors** (every distinct user type, internal and external)?
168
+ - What are the **outcomes** for each actor? (Convert "features" to outcomes.)
169
+ - What is explicitly **out of scope**? (Boundaries by negation.)
170
+
171
+ ### 5.2 Channels & surfaces
172
+ - Web portal? Mobile app? Public API? CLI? Embedded widget? Each is a candidate
173
+ custom application.
174
+ - Is there a separate **admin / operator** interface? (Almost always yes — make
175
+ it explicit.)
176
+ - Does anyone consume the system **programmatically** (partners, third-party
177
+ devs)? → SDK candidate.
178
+
179
+ ### 5.3 Data
180
+ - What are the **major entities** (nouns the Human keeps repeating)?
181
+ - For each: is it transactional/structured (relational) or
182
+ document-shaped/profile-like (NoSQL)?
183
+ - What entities have **independent lifecycles** (created/updated/deleted on a
184
+ different cadence)?
185
+ - What entities cross an **organizational boundary** (owned by a different
186
+ team / party)?
187
+ - Is any data **regulated** (PII, payment, health, location)?
188
+
189
+ ### 5.4 Workflows
190
+ - Walk the Human through the **happy path** for each actor. Note where one
191
+ actor hands off to another.
192
+ - Where does the system **wait** for something (approval, payment, external
193
+ response)? Each wait is a candidate async boundary.
194
+ - Are there **scheduled** workflows (nightly sync, monthly report, expiry
195
+ sweep)? → Batch Job module.
196
+ - Are there **broadcast** flows (announcements, notifications)? → Notification
197
+ module + possibly News/Announcement business module.
198
+
199
+ ### 5.5 Integrations
200
+ - Does the system integrate with **external** parties (banks, government,
201
+ partners, SaaS)?
202
+ - Each integration: synchronous API, async event, batch file? Inbound,
203
+ outbound, or both?
204
+ - Is there a **two-sided** integration (Country A ↔ Country B, Buyer ↔
205
+ Seller)? → adapter pair pattern.
206
+
207
+ ### 5.6 Non-functional cues (cheap to ask, expensive to retrofit)
208
+ - Expected scale (users / requests / records)?
209
+ - Compliance / region constraints (GDPR, PDPA, HIPAA, on-prem requirements)?
210
+ - SSO required? Multi-tenancy? Audit trail requirements?
211
+
212
+ If the Human cannot answer any of these, **don't invent a number** — mark it
213
+ `[TODO]` in the draft.
214
+
215
+ ## 6. Deriving the four lists
216
+
217
+ ### 6.1 3rd Party Services — capability → service map
218
+
219
+ You discover infrastructure by listening for capabilities, then mapping them.
220
+ Apply the table below, but only pick what the conversation actually surfaced —
221
+ **not picking** infrastructure is also a valid answer.
222
+
223
+ | Signal you heard | Add this |
224
+ |------------------|----------|
225
+ | "users log in" / "SSO" / "roles" | **Single Sign On** — Keycloak |
226
+ | "send email" / "notify" | **SMTP Server** — Mailcatcher (dev) |
227
+ | "push notification" | External Service — **Firebase Cloud Messaging** |
228
+ | "upload" / "attach" / "documents" / "files" | **File Storage** — MinIO |
229
+ | "fast lookup" / "session" / "rate limit" | **Cache** — Redis |
230
+ | "profiles" / "JSON-shaped data" / "flexible schema" | **Document Database** — MongoDB |
231
+ | "transactions" / "orders" / "invoices" / "relational" | **Relational Database** — MySQL or PostgreSQL |
232
+ | "events between services" / "fire and forget" / "fan-out" | **Message Queue** — RabbitMQ |
233
+ | "full-text search" / "fuzzy match" / "autocomplete" | **Search** — Meilisearch |
234
+ | "rate limit at edge" / "API key" / "throttle" | **API Gateway** — Kong |
235
+ | "maps" / "geocoding" / "directions" | External Service — Google Maps / Mapbox |
236
+ | "AI" / "LLM" / "embedding" | External Service — OpenAI / Anthropic |
237
+ | "payments" | External Service — Stripe / PayPal |
238
+
239
+ ### 6.2 Grouping infrastructure by bounded context
240
+
241
+ When the system has multiple bounded contexts (e.g., Hub vs HC vs SC, or Public
242
+ vs Admin), give each **its own database / queue / cache** rather than one shared
243
+ instance:
244
+
245
+ - `Hub Core Database`, `Hub Support Database`, `HC Database`, `SC Database`
246
+ - `HC Adapter Message Queue`, `SC Adapter Message Queue`
247
+ - `Hub Cache`, `HC Cache`
248
+
249
+ This is intentional. It reinforces the bounded context boundary at the
250
+ infrastructure layer and prevents "shared DB" coupling later. **Ask the Human**
251
+ whether contexts share storage — default to "no" unless they say yes.
252
+
253
+ ### 6.3 External Services vs 3rd Party Applications
254
+
255
+ | Type | Definition | Goes under |
256
+ |------|------------|------------|
257
+ | **3rd Party Application** | The project deploys it (Docker container, K8s pod). You own the credentials and the data. | `# Supporting 3rd Party Applications` |
258
+ | **External Service** | SaaS or remote API. The project only consumes it. Someone else operates it. | `## External Services` (sub-section) |
259
+
260
+ If none are implied, omit `## External Services` entirely — do not insert a stub.
261
+
262
+ ### 6.4 Per-service detail to capture
263
+
264
+ For each 3rd Party Application, the draft should list:
265
+ - Technology + major version (`MongoDB version 8.x`)
266
+ - Databases / Buckets / Vhosts as sub-bullets (one line each) — names follow
267
+ `<project-code-lower>_<context>_<purpose>` (e.g., `urp_hub_kc`, `urp_hub_main`)
268
+ - `Depends on:` only when one infrastructure piece depends on another (rare —
269
+ usually only Keycloak depends on its DB)
270
+
271
+ ### 6.5 Custom Applications — common shapes
272
+
273
+ A custom application is a deployable unit with its own lifecycle. Heuristics:
274
+
275
+ | Shape | When to include | Naming pattern |
276
+ |-------|-----------------|----------------|
277
+ | **Middleware / Core service** | Almost always — the primary backend | `<Domain> Middleware` or `<Domain> Core` |
278
+ | **Support / Admin portal** | Internal operators need a UI distinct from end-user UI | `<Domain> Support Portal` |
279
+ | **Public-facing frontend** | End users hit a web UI | `<Domain> Web` or `<Domain> Portal` |
280
+ | **Mobile app** | Native iOS/Android channel mentioned | `<Domain> Mobile` |
281
+ | **Adapter** (pair) | Two-party integration (Country A ↔ Country B, Buyer ↔ Seller) | `<Side> Adapter` (e.g., `HC Adapter`, `SC Adapter`) |
282
+ | **SDK library** | Third-party developers integrate with you | `<Side> Adapter SDK` |
283
+ | **CLI / batch tool** | Devops or scheduled operations need an executable | `<Domain> CLI` |
284
+ | **API Gateway / BFF** | Multiple frontends consume an aggregated API | `<Domain> Gateway` |
285
+
286
+ ### 6.6 Custom Application decision rules
287
+
288
+ A new custom application is justified when **at least two** of these are true:
289
+ - Different deployment cadence (releases at a different rhythm)
290
+ - Different runtime profile (latency, scale, security posture)
291
+ - Different audience (end user vs operator vs partner)
292
+ - Different technology stack (mobile native vs web vs JVM service)
293
+ - Different team ownership
294
+
295
+ If only one is true, it is probably a **module inside an existing application**,
296
+ not a new application. Push back on the Human before adding it.
297
+
298
+ ### 6.7 Dependency list per app
299
+
300
+ Every custom application gets a `Depends on:` bullet list naming:
301
+ - Each 3rd party application it consumes (DB, queue, cache, SSO)
302
+ - Each external service it consumes
303
+ - Each other custom application it calls
304
+
305
+ Names must match the `## <Name>` heading they refer to **exactly**. This is
306
+ what enables dependency validation later.
307
+
308
+ ### 6.8 Port allocation
309
+
310
+ One port per **server-style** custom app (skip SDK libraries — they are
311
+ libraries, not servers).
312
+
313
+ | Tier | Port range |
314
+ |------|-----------|
315
+ | Public Layer | 8080 |
316
+ | Tier 1 / Hub | 9001–9019 |
317
+ | Tier 2 / HC (or "side A") | 9020–9039 |
318
+ | Tier 3 / SC (or "side B") | 9040–9059 |
319
+
320
+ Sub-domain pattern: `<type-abbr>-<tier-abbr>-<project-code-lower>`
321
+ (`mw-hub-urp`, `sup-hub-urp`, `ad-hc-urp`). Untiered projects: allocate
322
+ sequentially from `8080`.
323
+
324
+ ### 6.9 System Modules
325
+
326
+ System modules are **cross-cutting framework concerns** — present in almost
327
+ every project. Default to all seven below. Drop one only when the brief makes
328
+ it clearly inapplicable, and ask the Human to confirm the drop.
329
+
330
+ | Module | Drop when… |
331
+ |--------|------------|
332
+ | **Authentication and Authorization** | No users at all (rare — usually a one-off script) |
333
+ | **User** | No users at all |
334
+ | **Notification** | Human explicitly says "no email, no push, no in-app alerts" |
335
+ | **Activities** | Human explicitly says "we don't track user activity feeds" |
336
+ | **Audit Trail** | Human explicitly says "no audit / compliance need" — push back hard, this is almost always needed |
337
+ | **Document Management** | No file/document upload anywhere in the system |
338
+ | **Batch Job** | No scheduled work and no on-demand background processing |
339
+
340
+ Each module is a `### <Module Name>` heading (three hashes) under
341
+ `## System Module`, with **one** descriptive line. Keep it short — PRDs expand
342
+ it in Phase B.
343
+
344
+ > Use these names **verbatim**. Downstream skills (`util-projectsync`,
345
+ > `specgen-*`) match on these exact strings.
346
+
347
+ ## 7. Deriving Business Modules — the hard part
348
+
349
+ > **This is where bounded contexts are designed.** A weak business module list
350
+ > produces a weak codebase, regardless of how good the rest of CLAUDE.md is.
351
+ > Spend disproportionate effort here.
352
+
353
+ ### 7.1 What a Business Module is
354
+
355
+ A business module is a **bounded context** — a region of the system with:
356
+ - A **cohesive ubiquitous language** (the words inside it have a single agreed
357
+ meaning)
358
+ - A **distinct lifecycle** (its entities are created/updated/deleted on their
359
+ own rhythm)
360
+ - A **clear owner** (one actor or team is primarily responsible)
361
+ - A **transactional or eventual-consistency boundary** (atomic operations stay
362
+ within it; cross-context work goes through events or APIs)
363
+
364
+ If two candidate modules share all four properties, they are **one** module,
365
+ not two. Merge them.
366
+
367
+ If one candidate module violates any of the four (e.g., entity X is talked
368
+ about two different ways by two different actors), it is probably **two**
369
+ modules wearing one name. Split it.
370
+
371
+ ### 7.2 Signals that justify a separate Business Module
372
+
373
+ Add a new module when **at least two** of these signals are present:
374
+
375
+ | Signal | Example |
376
+ |--------|---------|
377
+ | Distinct primary actor | "Employer" managed by employers; "Candidate" managed by candidates |
378
+ | Distinct lifecycle | Job posts expire weekly; user profiles update yearly |
379
+ | Distinct ubiquitous language | A "Demand" in HR ≠ a "Demand" in supply chain |
380
+ | Distinct regulatory regime | Payment data (PCI) vs profile data (GDPR) |
381
+ | Crosses an organizational boundary | Hub-side employers vs source-country agents |
382
+ | Distinct consistency requirement | Order placement is strongly consistent; analytics is eventually consistent |
383
+ | Distinct integration surface | One module exposes an API to partners; another is internal-only |
384
+ | Distinct read/write ratio | Read-heavy catalog vs write-heavy transaction log |
385
+
386
+ A single signal alone is usually not enough — that's a sub-aggregate inside a
387
+ larger module.
388
+
389
+ ### 7.3 Common Business Module archetypes
390
+
391
+ Watch for these patterns in the conversation:
392
+
393
+ | Archetype | Triggered by | Example names |
394
+ |-----------|--------------|---------------|
395
+ | **Dashboard** | Any portal mentions a landing/summary screen | `Dashboard` |
396
+ | **Reference data / taxonomies** | "list of countries", "industry codes", "occupation categories" | `Location Information`, `Industrial Classification`, `Occupation Classification` |
397
+ | **Primary entity management** | A noun the Human repeats — the thing the system is *about* | `Employer`, `Candidate Profile`, `Job Demand`, `Order`, `Booking`, `Patient` |
398
+ | **Workflow / process** | A multi-step procedure with state transitions | `Recruitment Step`, `Onboarding`, `Claim Processing` |
399
+ | **Cross-system sync** | Data must mirror between two contexts | `Employer Sync`, `Recruitment Agent Sync` |
400
+ | **Marketplace / matching** | Two-sided platform with matching logic | `Job Matching`, `Talent Search` |
401
+ | **Broadcast / announcement** | Operators publish content to many users | `News and Announcement` |
402
+ | **Support / help desk** | Users can report issues, raise tickets, get help | `Support Ticket` |
403
+ | **Reporting / analytics** | Operators view aggregated KPIs (distinct from ops dashboards) | `Reporting`, `Analytics` |
404
+ | **Billing / payment** | Money changes hands | `Billing`, `Subscription` |
405
+ | **Settings / configuration** | Tenant- or system-level configuration that is non-trivial | `Tenant Configuration`, `Feature Toggle` |
406
+
407
+ You do **not** need all of these. Pick the ones the conversation actually
408
+ surfaced.
409
+
410
+ ### 7.4 Anti-patterns to push back on
411
+
412
+ When the Human proposes a module, run this checklist before accepting:
413
+
414
+ | Anti-pattern | How it looks | How to fix |
415
+ |--------------|--------------|-----------|
416
+ | **CRUD-named module** | "User CRUD", "Order CRUD" | Drop the CRUD suffix. The module name is the noun. |
417
+ | **Database-named module** | "Postgres Module", "Mongo Module" | Storage is not a context. Name by domain concept. |
418
+ | **Layer-named module** | "Frontend Module", "API Module" | Layers are not contexts. Split by domain. |
419
+ | **Catch-all module** | "Common", "Misc", "Utilities" | Force a name. If it can't be named, it doesn't exist yet. |
420
+ | **One module per screen** | "Login Module", "Signup Module", "Forgot Password Module" | Collapse into `Authentication and Authorization` (system module). |
421
+ | **Tech-named module** | "GraphQL Module", "Kafka Module" | Same as database-named. Rename by domain. |
422
+ | **Adjective-only name** | "Premium Module", "Free Module" | Adjective ≠ context. Rename by what it *does*. |
423
+ | **Two-noun glue module** | "Employer-and-Candidate Module" | Split into two. The "and" is a relationship, not a context. |
424
+
425
+ ### 7.5 Bounded context map (optional but recommended)
426
+
427
+ For non-trivial projects, ask the Human to sketch the **context map** — how
428
+ modules relate. The four relationship types worth naming:
429
+
430
+ - **Upstream / Downstream** — module A's data flows into module B (B depends on A)
431
+ - **Partnership** — two modules co-design a shared interface and evolve together
432
+ - **Customer / Supplier** — module A consumes module B's API as-is; B owns the contract
433
+ - **Anti-corruption layer** — module A translates module B's model to protect
434
+ itself from B's churn (typical between custom apps and external partners)
435
+
436
+ The context map does **not** go into CLAUDE.md verbatim, but it should inform:
437
+ - Custom application dependency lists (`Depends on:`)
438
+ - Whether two candidates collapse into one module or stay split
439
+ - Which 3rd-party infrastructure is grouped under which context
440
+
441
+ ### 7.6 Naming conventions
442
+
443
+ | Rule | Example |
444
+ |------|---------|
445
+ | Title Case | `Recruitment Agent`, not `recruitment agent` |
446
+ | Singular noun, not plural | `Employer`, not `Employers` |
447
+ | Domain language, not tech | `Job Demand`, not `Job Posting Service` |
448
+ | Avoid prefixes / suffixes | `Candidate Profile`, not `Module Candidate Profile` |
449
+ | Match the ubiquitous language | If the Human says "Demand", do not write "Job Request" |
450
+
451
+ ### 7.7 CLAUDE.md draft structure
452
+
453
+ When you draft, use **this exact top-level section order**. The downstream CO2
454
+ skills depend on it.
455
+
456
+ ```
457
+ # Context
458
+ # Project Detail
459
+ # Goals
460
+ # Terminology
461
+ # Development Tool ← link to DEVTOOL.md (one line)
462
+ # Environment ← link to ENVIRONMENT.md (one line)
463
+ # Supporting 3rd Party Applications
464
+ ## <each 3rd party app>
465
+ ## External Services (omit entirely if none)
466
+ ### <each external service>
467
+ # Custom Applications
468
+ ## <each custom app>
469
+ # Port Allocation (omit entirely if no custom apps)
470
+ # Modules
471
+ ## System Module
472
+ ### <each system module>
473
+ ## Business Module
474
+ ### <each business module>
475
+ # Application Folder structure
476
+ # Rules
477
+ ```
478
+
479
+ #### Heading-level invariants
480
+
481
+ | Level | Used for |
482
+ |-------|----------|
483
+ | `#` | Top-level CLAUDE.md sections (12 sections, fixed order above) |
484
+ | `##` | Items within a section: each 3rd party app, each custom app, **and** the System/Business module *tier* headings |
485
+ | `###` | Individual modules under `## System Module` / `## Business Module`, and each external service under `## External Services` |
486
+
487
+ Modules at `###` (three hashes) is **mandatory** — `util-projectsync` matches
488
+ modules by exactly this level. If you flatten modules to `##`, the sync skill
489
+ silently drops them.
490
+
491
+ #### Empty-section sentences
492
+
493
+ Never leave a section body empty. Use the matching sentence:
494
+
495
+ | Section empty | Sentence |
496
+ |---------------|----------|
497
+ | `# Supporting 3rd Party Applications` | `**No Supporting 3rd Party Applications for this project**` |
498
+ | `## External Services` | Omit the heading entirely |
499
+ | `# Custom Applications` | `**No Custom Applications for this project**` (and omit `# Port Allocation`) |
500
+ | `## System Module` | `**There is no System Module for this project**` |
501
+ | `## Business Module` | `**There is no Business Module for this project**` |
502
+
503
+ #### Naming invariants across the file
504
+
505
+ - **Project Code** is UPPERCASE (`URP`). The lowercase form (`urp`) is used
506
+ everywhere downstream — sub-domain suffixes, default bucket names, Keycloak
507
+ realm, database name prefixes.
508
+ - Every name referenced in a `Depends on:` list **must** be an exact
509
+ case-sensitive match to a `## <Name>` heading elsewhere in CLAUDE.md.
510
+ - Database / bucket / vhost names use `<project-code-lower>_<context>_<purpose>`
511
+ (e.g., `urp_hub_main`).
512
+
513
+ #### [TODO] markers are first-class
514
+
515
+ When the brainstorm leaves a question unanswered, write the best default you
516
+ can and tag it `[TODO: <what to confirm>]` on its own line directly above the
517
+ affected bullet or heading. Do **not** silently invent facts.
518
+
519
+ ---
520
+
521
+ # PHASE B — PRD.md per application
522
+
523
+ ## 8. Draft materialization and the session dashboard
524
+
525
+ - **Files are the draft channel.** On every agent turn (CLAUDE.md from the first
526
+ turn; all PRDs from inventory lock), write the current drafts directly to the
527
+ destination tree, overwriting previous drafts. The Human reviews the real
528
+ files in their editor — the same surface they will polish later.
529
+ - **The session document's `Output` section holds the dashboard, not the
530
+ content** (overridden every round, points form):
531
+ 1. Phase indicator (A / A-lock-pending / B) and current round
532
+ 2. Inventory summary: project code/name, app list with App Codes and ports,
533
+ module counts
534
+ 3. The App × Module matrix
535
+ 4. `[TODO]` ledger: count per artifact + the list, so convergence is visible
536
+ 5. Diff bullets: what changed since the previous round, per artifact
537
+ - On session completion (`Session completion = COMPLETED`), write the final
538
+ tree, then place the hand-off summary (§13) under `Output > ## Final Artifact`
539
+ together with the destination path.
540
+
541
+ ## 9. Convergence gates
542
+
543
+ ### 9.1 Phase A → inventory lock
544
+
545
+ Present these as evidence when asking the Human to lock. Until all pass, keep
546
+ iterating Phase A:
547
+
548
+ | Check | Pass condition |
549
+ |-------|----------------|
550
+ | **Identity** | Project Code + Project Name + one-paragraph description present and confirmed by the Human (no `[TODO]`). |
551
+ | **Actors & channels** | Every actor named in the conversation maps to at least one Custom Application (or is explicitly out of scope). No actor without a surface; no surface without an actor. |
552
+ | **Business modules** | Every business module has survived a round of pushback (§7.2 signals + §7.4 anti-patterns). The Human has acknowledged any modules you flagged. |
553
+ | **TODOs** | Every remaining CLAUDE.md `[TODO]` is either (a) resolved, or (b) explicitly accepted by the Human as something to fill during polishing. |
554
+ | **App Codes** | Assigned, collision-free. |
555
+ | **Matrix** | Complete — no orphan modules, no module-less applications. |
556
+
557
+ The Human owns the lock. Do not auto-advance even when all checks pass —
558
+ present them and ask.
559
+
560
+ ### 9.2 Phase B → session completion
561
+
562
+ All must pass before final hand-off:
563
+
564
+ 1. Every Custom Application folder + PRD exists; every matrix cell is realized
565
+ as a module section in the right PRD; no PRD contains an unmatrixed module.
566
+ 2. Every module section carries all five facets, each version-tagged; no
567
+ `### Bug` anywhere.
568
+ 3. Every User Story names an actor from CLAUDE.md's audience/actor language and
569
+ has at least one covering Test scenario.
570
+ 4. ID lint passes: format, widths, step-of-3, app-wide uniqueness per type,
571
+ app code matches the PRD's declared code.
572
+ 5. Cross-PRD consistency spot-check done (§11.4) — named in the final diff
573
+ bullets.
574
+ 6. Remaining `[TODO]`s are enumerated in the hand-off summary and explicitly
575
+ accepted by the Human.
576
+
577
+ Session completion itself is signalled only by the Human via the session's
578
+ Status table — never self-declare.
579
+
580
+ ## 10. Phase B round questioning — what to probe per PRD
581
+
582
+ The five requirement facets have distinct purposes. Aim questions accordingly:
583
+
584
+ | Facet | Determines | Probe for |
585
+ |-------|-----------|-----------|
586
+ | **User Story** | UI and UX | Actor-by-actor journeys per module: entry point, screens, actions, what the actor sees on success/failure. Format: "As a <actor>, I want <capability> so that <outcome>" — outcome mandatory. |
587
+ | **Non Functional Requirement** | Validation and business logic | Field-level validation, business rules, calculations, limits, latency/pagination expectations, security posture per module. |
588
+ | **Constraint** | Scope | What is fixed, excluded, or deferred: phase boundaries, immutable identifiers, single-provider decisions, "no hard delete", regulatory gates. |
589
+ | **Reference** | Supporting material | Links to sibling-app model docs (`../../<backend_app>/context/model/<module-slug>/model.md` — mark `[TODO: generated later]` at brainstorm time), external API docs, standards. |
590
+ | **Test** | Test spec design | End-to-end observable scenarios in arrange→act→assert narrative form, covering each User Story's happy path plus the highest-risk NFR/Constraint violations. |
591
+
592
+ ## 11. PRD.md content rules
593
+
594
+ ### 11.1 Canonical structure (fixed order)
595
+
596
+ ```
597
+ # Context ← boilerplate, §11.2
598
+ # Design System ← UI apps only; link + ## Layout
599
+ # Assets ← UI apps only; may be a [TODO] stub at brainstorm time
600
+ # Architecture Principle
601
+ ## Technology Stack
602
+ ## API Reference ← apps that expose or consume APIs
603
+ # High Level Process Flow
604
+ # System Module
605
+ ## <Module> ← only modules marked for this app in the matrix
606
+ ### User Story
607
+ ### Non Functional Requirement
608
+ ### Constraint
609
+ ### Reference
610
+ ### Test
611
+ # Business Module
612
+ ## <Module> ← same five ### facets
613
+ ```
614
+
615
+ Heading-level invariants: facets at `###`, modules at `##`, top sections at
616
+ `#`. Separate modules with `---` horizontal rules.
617
+
618
+ ### 11.2 Context boilerplate (standard intent, adapted per app)
619
+
620
+ Every PRD opens with the standard Context bullets:
621
+ - The document contains user stories, NFRs, constraints and references by
622
+ module for this application; the application name is inferred from the root
623
+ folder name.
624
+ - The section-versioning contract: each facet heading carries
625
+ `[v{major}.{minor}.{patch}]`; major = change affecting overall understanding,
626
+ minor = detail-level change, patch = typo/formatting; invalidated items are
627
+ struck through, never deleted.
628
+ - One bullet declaring the application's requirement-ID app code, e.g.
629
+ `- Requirement ID app code: SW`.
630
+
631
+ ### 11.3 Module inclusion and per-shape emphasis
632
+
633
+ - Include **only** the modules marked for this application in the locked matrix.
634
+ - Module names and their System/Business classification are copied **verbatim**
635
+ from CLAUDE.md `###` headings — never renamed, never re-tiered.
636
+ - Every included module carries **all five facet headings**, each tagged
637
+ `[v1.0.0]` at generation, **even when empty** — empty facets are a legitimate
638
+ state meaning "nothing app-specific yet".
639
+ - **Never generate a `### Bug` facet.** Bug is a development-lifecycle section
640
+ appended later by other CO2 skills.
641
+
642
+ | App shape | Emphasize | Omit / stub |
643
+ |-----------|-----------|-------------|
644
+ | Frontend (Web/Portal/Mobile) | Design System + Layout, Assets, User Stories, client-side validation NFRs, screen-level Tests | — |
645
+ | Middleware / Core / Adapter | Architecture Principle, API Reference, business-logic NFRs, data Constraints, integration Tests | Design System, Assets (omit sections entirely) |
646
+ | SDK / library | API Reference (the contract), Constraints (compat/versioning), consumer-perspective Stories ("As an integrating developer…") | Design System, Assets, Port entries |
647
+ | CLI / batch | Operator-perspective Stories, scheduling NFRs, idempotency Constraints | Design System, Assets |
648
+
649
+ ### 11.4 Cross-application consistency
650
+
651
+ - The same business rule stated in two PRDs must not contradict; state the rule
652
+ authoritatively in the owning backend's PRD (as NFR/Constraint) and reference
653
+ it from frontend PRDs (Reference facet) rather than restating divergent
654
+ copies.
655
+ - Frontend User Stories must be servable by some backend capability implied in
656
+ the backend PRD for the same module; when the backend side is missing, add it
657
+ in the same turn.
658
+ - Architecture Principle and Technology Stack must agree with CLAUDE.md
659
+ `# Application Folder structure` stack declarations exactly.
660
+
661
+ ### 11.5 Requirement ID scheme
662
+
663
+ - Format: `<TYPE><APPCODE><NUMBER>` inside square brackets, e.g. `[USSW00003]`.
664
+ - Types and zero-padded widths:
665
+ `US` = 5 digits · `NFR` = 4 · `CONS` = 3 · `REF` = 4 · `TST` = 4.
666
+ - Numbering starts at 3 and **steps by 3** (`00003, 00006, 00009 …`), leaving
667
+ insertion room between existing items.
668
+ - **Uniqueness scope is the whole application (per type)** — numbering runs
669
+ continuously across all modules in a PRD, never resetting per module.
670
+ - IDs are immutable once assigned: refinement edits an item's text and bumps
671
+ the facet version; it never renumbers. Removed items are struck through, ID
672
+ retained.
673
+
674
+ ### 11.6 [TODO] discipline (extends §7.7)
675
+
676
+ - Never invent facts; write the best default and tag `[TODO: what to confirm]`
677
+ on its own line above the affected item.
678
+ - PRD-specific values that must be `[TODO]` unless the Human supplied them:
679
+ latency numbers, pagination sizes, file-size/duration limits, retention
680
+ periods, external-provider choices, locale lists.
681
+
682
+ ---
683
+
684
+ ## 12. Integration with the brainstorm session protocol
685
+
686
+ - The session's `Output Specification` uses `format: co2-tree`;
687
+ `destination` = the project root folder to scaffold; `versioning: overwrite`
688
+ applies to draft turns (finals inherit the same tree). When `co2-tree` is the
689
+ format, **this guide governs output handling** — the protocol's single-file
690
+ rendering step is delegated here.
691
+ - The generated tree lives under the scan root but never matches
692
+ `*.brainstorm.md`, so agent writes to it do not wake the watcher.
693
+ - All other protocol mechanics (rounds, statuses, feedback, error handling)
694
+ apply unchanged.
695
+
696
+ ## 13. Output: hand-off summary
697
+
698
+ After writing the final tree, print this summary under
699
+ `Output > ## Final Artifact` so the Human can scan-review before polishing:
700
+
701
+ ```
702
+ ## Final Artifact
703
+ - Destination: ./output/<project-code-lower>/
704
+
705
+ ### Project
706
+ - Code: URP
707
+ - Name: Universal Recruitment Platform
708
+ - One-liner: …
709
+
710
+ ### Inferred Inventory
711
+ | Category | Count | Names |
712
+ |------------------------|-------|-------|
713
+ | 3rd Party Applications | N | … |
714
+ | External Services | N | … |
715
+ | Custom Applications | N | … |
716
+ | System Modules | 7 | (standard set) |
717
+ | Business Modules | N | … |
718
+
719
+ ### PRD Inventory
720
+ | Application (Code) | Modules | Stories | NFRs | Constraints | Tests | [TODO]s |
721
+ |--------------------|---------|---------|------|-------------|-------|---------|
722
+ | … one row per app …| | | | | | |
723
+
724
+ ### Open Questions ([TODO] markers across the tree)
725
+ - [TODO] …
726
+
727
+ ### Recommended Next Step
728
+ - Polish the tree, then move it into the actual project location.
729
+ - Run `util-projectsync` to reconcile per-application folders.
730
+ ```
731
+
732
+ ## 14. Mandatory rules (do not skip)
733
+
734
+ - **Draft from the first turn, refine every round.** Write full artifact drafts
735
+ to the destination tree at the end of every agent turn — never respond with
736
+ questions alone.
737
+ - **Diff each round.** The dashboard opens with 1–3 bullets naming what changed
738
+ since the previous round. The Human must be able to track drift.
739
+ - **Two phases, one lock.** No PRD content before the Human locks the
740
+ inventory; no inventory churn after lock without explicit Human instruction
741
+ (and full cascade when it happens).
742
+ - **Stop only on Human signal.** Inventory lock and session completion are the
743
+ Human's calls — present convergence evidence and ask.
744
+ - **Push back on weak modules.** A business module failing §7.2 (fewer than two
745
+ signals) or matching §7.4 (anti-patterns) gets challenged before it is
746
+ written.
747
+ - **No fabricated infrastructure.** Pick only what the conversation surfaced.
748
+ Smaller is better.
749
+ - **No fabricated numbers.** Missing scale / SLA / version / limit → sensible
750
+ default + `[TODO: confirm]`.
751
+ - **Module heading levels are non-negotiable**: `###` under
752
+ `## System Module` / `## Business Module` in CLAUDE.md; `##` modules with
753
+ `###` facets in PRDs.
754
+ - **Names match exactly across every file.** Dependency strings, module
755
+ strings, application strings — copy-paste, do not retype.
756
+ - **IDs are immutable, unique app-wide per type, step-of-3.**
757
+ - **No `### Bug` at generation time.**
758
+ - **No credentials anywhere.** Placeholders or the `# Rules` project standard
759
+ only.
760
+ - **Scope of generation**: CLAUDE.md + application folders + PRD.md files only.
761
+ No DEVTOOL.md, no ENVIRONMENT.md, no source code, no mockups.