@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,789 @@
1
+ ---
2
+ name: specgen-react-mui
3
+ model: claude-opus-4-8
4
+ effort: high
5
+ description: >
6
+ Generate a detailed specification document for building a React SPA (Single Page
7
+ Application) using React 19, TypeScript 5, Vite 6, Material UI (MUI) v6, React Router v7,
8
+ TanStack Query v5, Zustand v5, React Hook Form v7, and Zod v3. Authentication (Keycloak
9
+ OAuth2/OIDC PKCE, generic OIDC, or none), API integration (REST via Axios), and optional
10
+ features (WebSocket, i18n, MUI X Data Grid, MUI X Charts) are configurable based on user
11
+ input.
12
+ Standardized input: application name (mandatory), version (mandatory), module (optional).
13
+ Use this skill whenever the user asks to create a spec, specification, blueprint, or
14
+ technical design document for a new React SPA or frontend application.
15
+ Also trigger when the user says things like "spec out a new React project",
16
+ "design a React SPA", "write a technical spec for my new frontend app",
17
+ "scaffold spec for a React MUI app", or any request for a specification document
18
+ describing a React + MUI + TypeScript application. Even if the user only mentions
19
+ a subset of the stack (e.g., "React SPA" or "React with Keycloak" or "React MUI dashboard"),
20
+ this skill likely applies — ask and confirm.
21
+ ---
22
+
23
+ # React SPA Specification Generator
24
+
25
+ This skill generates a comprehensive specification document (Markdown) that serves as a
26
+ blueprint for building a React Single Page Application. The spec is intended to be followed
27
+ by a developer or a coding agent to produce a fully functional project scaffold.
28
+
29
+ The specification does NOT generate code. It produces a detailed, opinionated technical
30
+ document describing every layer of the application — from Vite configuration to MUI theme
31
+ to React Query patterns — so that implementation becomes a mechanical exercise.
32
+
33
+ ## Technology Stack
34
+
35
+ ### Core Stack (Always Included)
36
+
37
+ These are the fixed versions the spec targets. Do not deviate unless the user explicitly
38
+ requests different versions.
39
+
40
+ | Component | Version |
41
+ |----------------------|-----------|
42
+ | React | 19.x |
43
+ | TypeScript | 5.x |
44
+ | Vite | 6.x |
45
+ | Material UI (MUI) | 6.x |
46
+ | MUI Icons | 6.x |
47
+ | MUI System | 6.x |
48
+ | React Router | 7.x |
49
+ | TanStack Query | 5.x |
50
+ | Zustand | 5.x |
51
+ | React Hook Form | 7.x |
52
+ | Zod | 3.x |
53
+ | Axios | 1.x |
54
+ | Node.js | 22.x LTS |
55
+
56
+ ### Optional Integration Versions
57
+
58
+ Include in the version table only when the corresponding integration is selected.
59
+
60
+ | Component | Version | When Selected |
61
+ |----------------------|-----------|------------------------|
62
+ | Keycloak | 26.x | Auth = Keycloak |
63
+ | oidc-client-ts | 3.x | Auth = Keycloak or OIDC|
64
+ | react-oidc-context | 3.x | Auth = Keycloak or OIDC|
65
+ | MUI X Data Grid | 7.x | DataGrid = yes |
66
+ | MUI X Charts | 7.x | Charts = yes |
67
+ | MUI X Date Pickers | 7.x | DatePickers = yes |
68
+ | Socket.io Client | 4.x | WebSocket = yes |
69
+ | react-i18next | 15.x | i18n = yes |
70
+ | i18next | 24.x | i18n = yes |
71
+ | React Quill (or similar rich text editor) | latest | RichText = yes |
72
+
73
+ ## Core Dependencies (package.json)
74
+
75
+ The spec must include these in the npm configuration section (always):
76
+
77
+ **Production dependencies:**
78
+ - `react` + `react-dom` — Core React
79
+ - `@mui/material` + `@mui/icons-material` — MUI component library and icons
80
+ - `@emotion/react` + `@emotion/styled` — MUI v6 styling engine
81
+ - `react-router-dom` — Client-side routing
82
+ - `@tanstack/react-query` — Server state and data fetching
83
+ - `zustand` — Global client state management
84
+ - `react-hook-form` — Form state management
85
+ - `@hookform/resolvers` — Zod integration for React Hook Form
86
+ - `zod` — Schema validation
87
+ - `axios` — HTTP client
88
+
89
+ **Development dependencies:**
90
+ - `typescript` — Type checking
91
+ - `@types/react` + `@types/react-dom` — React type definitions
92
+ - `vite` + `@vitejs/plugin-react` — Build tooling
93
+ - `eslint` + `@typescript-eslint/*` — Linting
94
+
95
+ ### Conditional Dependencies
96
+
97
+ **If Auth = Keycloak or OIDC:**
98
+ - `oidc-client-ts` — OAuth2/OIDC PKCE client
99
+ - `react-oidc-context` — React context wrapper for oidc-client-ts
100
+
101
+ **If DataGrid = yes:**
102
+ - `@mui/x-data-grid` — Advanced data grid component
103
+
104
+ **If Charts = yes:**
105
+ - `@mui/x-charts` — Chart components
106
+
107
+ **If DatePickers = yes:**
108
+ - `@mui/x-date-pickers` — Date/time picker components
109
+ - `date-fns` — Date manipulation library
110
+
111
+ **If WebSocket = yes:**
112
+ - `socket.io-client` — WebSocket client
113
+
114
+ **If i18n = yes:**
115
+ - `react-i18next` + `i18next` — Internationalization
116
+ - `i18next-browser-languagedetector` — Auto language detection
117
+ - `i18next-http-backend` — Lazy translation loading
118
+
119
+ **If RichText = yes:**
120
+ - `react-quill-new` — Rich text editor (Quill-based, React 19 compatible)
121
+ - `dompurify` + `@types/dompurify` — HTML sanitization for rich text content
122
+
123
+ **If Reporting = yes:**
124
+ - `xlsx` — Client-side XLSX file generation
125
+ - `papaparse` + `@types/papaparse` — Client-side CSV generation
126
+ - Report service (Node.js companion): `puppeteer`, `express`, `cors` — server-side HTML-to-PDF via headless Chrome
127
+
128
+ ## When the Skill Triggers
129
+
130
+ Generate the spec when the user provides an **application name** and **version** that
131
+ corresponds to one of the custom applications defined in `CLAUDE.md`. The skill
132
+ reads all required inputs from the project's context files — no interactive Q&A is needed
133
+ for the core inputs.
134
+
135
+ The user invokes this skill by specifying the target application and version, for example:
136
+ - `/specgen-react-mui admin v1.0.4`
137
+ - `/specgen-react-mui admin v1.0.4 module:Hero Section`
138
+ - `/specgen-react-mui "Admin Portal" v1.0.4`
139
+
140
+ The skill then locates the matching context folder and reads all input files automatically.
141
+
142
+ ## Version Gate
143
+
144
+ Before starting any work, resolve the application folder first (see Input Resolution below), then check `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
145
+
146
+ 1. If `<app_folder>/CHANGELOG.md` does not exist, skip this check (first-ever execution for this application).
147
+ 2. If `<app_folder>/CHANGELOG.md` exists, scan all `## vX.Y.Z` headings and determine the **highest version** using semantic versioning comparison.
148
+ 3. Compare the requested version against the highest version:
149
+ - If requested version **>=** highest version: proceed normally.
150
+ - If requested version **<** highest version: **STOP immediately**. Print: `"Version {requested} is lower than the current application version {highest} recorded in <app_folder>/CHANGELOG.md. Execution rejected."` Do NOT proceed with any work.
151
+
152
+ ## Input Resolution
153
+
154
+ This skill uses standardized input resolution. Provide:
155
+
156
+ | Argument | Required | Example | Description |
157
+ |----------|----------|---------|-------------|
158
+ | `<application>` | Yes | `admin` | Application name to locate the context folder |
159
+ | `<version>` | Yes | `v1.0.4` | Version to scope processing |
160
+ | `module:<name>` | No | `module:Hero Section` | Limit generation to a single module |
161
+
162
+ ### Application Folder Resolution
163
+
164
+ The application name is matched against root-level application folders:
165
+ 1. Strip any leading `<number>_` prefix from folder names (e.g., `1_admin` → `admin`)
166
+ 2. Match case-insensitively against the provided application name
167
+ 3. Accept snake_case, kebab-case, or title-case input (all match the same folder)
168
+ 4. If no match found, list available applications and stop
169
+
170
+ ### Auto-Resolved Paths
171
+
172
+ | File | Resolved Path |
173
+ |------|---------------|
174
+ | PRD.md | `<app_folder>/context/PRD.md` |
175
+ | Module Models | `<app_folder>/context/model/` |
176
+ | HTML Mockups | `<app_folder>/context/mockup/` |
177
+ | Output (specification) | `<app_folder>/context/specification/` |
178
+
179
+ ### Version Filtering
180
+
181
+ When a version is provided, only include user stories, NFRs, and constraints from versions
182
+ <= the provided version. For example, if `v1.0.4` is specified:
183
+ - Include items tagged `[v1.0.0]`, `[v1.0.1]`, `[v1.0.2]`, `[v1.0.3]`, `[v1.0.4]`
184
+ - Exclude items tagged `[v1.0.5]` or later
185
+ - Version comparison uses semantic versioning order
186
+
187
+ ### Module Filtering
188
+
189
+ When `module:<name>` is provided:
190
+ - Only generate the `SPEC.md` for that specific module
191
+ - Other existing module spec files remain untouched
192
+ - `SPECIFICATION.md` (root) gets a partial update — only that module's entry in the TOC
193
+ is added or updated; all other TOC entries are preserved as-is
194
+
195
+ ## Gathering Input
196
+
197
+ The specification is driven by **six input sources** read from the project's context files.
198
+ The skill does NOT ask the user for auth, API backend URL, or optional component choices —
199
+ it **determines** these automatically from the context.
200
+
201
+ ### Input 1: Application Name (from CLAUDE.md)
202
+
203
+ From CLAUDE.md (already loaded in context), locate the target application under the
204
+ **Custom Applications** section. Extract:
205
+
206
+ - **Application name**: The section heading (e.g., "Admin Portal", "Landing Page")
207
+ - **Application description**: The description paragraph below the heading
208
+ - **Dependencies**: The "Depends on" list — primary source for determining backend API
209
+ base URL, authentication provider, and optional components
210
+
211
+ The application name is used to derive:
212
+ - **Project slug**: Kebab-case of the application name (e.g., `admin-portal`)
213
+ - **Vite env prefix**: `VITE_` (standard Vite convention)
214
+ - **App title**: Title-case of application name (e.g., "Admin Portal")
215
+
216
+ ### Input 2: User Stories (from PRD.md)
217
+
218
+ Read `<app_folder>/context/PRD.md`. This file contains all user stories organized by
219
+ module. Extract:
220
+
221
+ - **System modules**: Modules under `# System Module` heading (e.g., Authentication,
222
+ User Management). These become system-level features.
223
+ - **Business modules**: Modules under `# Business Module` heading (e.g., Hero Section,
224
+ Product and Service). These become business-level features.
225
+ - **User stories per module**: Each `### User Story` section contains tagged items.
226
+ These define the functional requirements for each feature's API hooks, form schemas,
227
+ and page components.
228
+
229
+ The user stories directly inform:
230
+ - Which API calls each feature's hooks must expose
231
+ - Which pages and routes are needed
232
+ - Which form fields and validation schemas apply
233
+ - Which MUI components best match the described UI
234
+
235
+ **Important:** Items with strikethrough (`~~text~~`) are deprecated — do NOT include them
236
+ as active requirements. List them in the "Removed / Replaced" subsection of the
237
+ traceability table.
238
+
239
+ - **Version tags per item**: Each `### User Story`, `### Non Functional Requirement`,
240
+ and `### Constraint` section contains one or more version blocks formatted as `[v1.0.x]`.
241
+ The skill must track the version tag for each item and carry it through to the
242
+ generated specification's traceability section.
243
+
244
+ ### Input 3: Non-Functional Requirements (from PRD.md)
245
+
246
+ Within the same `PRD.md`, each module has a `### Non Functional Requirement` section.
247
+ These inform:
248
+
249
+ - UI layout choices (grid columns, card sizes, image dimensions)
250
+ - Data fetching strategies (pagination, filtering, real-time)
251
+ - Validation rules (character limits, format requirements)
252
+ - Performance constraints (lazy loading, caching)
253
+
254
+ NFRs should be mapped to specific technical decisions in the spec — for example, an NFR
255
+ stating "paginated with 10 items per page" confirms which React Query pagination pattern
256
+ to use, while "must support filtering" confirms which Zustand slice manages filter state.
257
+
258
+ ### Input 4: Constraints (from PRD.md)
259
+
260
+ Within the same `PRD.md`, each module has a `### Constraint` section. These define
261
+ hard boundaries that the spec must enforce:
262
+
263
+ - Status enum values (e.g., "DRAFT, ACTIVE, EXPIRED")
264
+ - Business rules (e.g., "category must exist before creating content")
265
+ - Access control (e.g., "only ADMIN role can access user management")
266
+
267
+ Constraints are embedded directly into the relevant module blueprint — they inform
268
+ Zod validation schemas, API call parameters, and route guard configurations.
269
+
270
+ ### Input 5: Module Model (from model/ folder)
271
+
272
+ Read `<app_folder>/context/model/MODEL.md` first as the index, then read the
273
+ individual module model files in each module subfolder.
274
+
275
+ **MODEL.md** provides:
276
+ - Summary table of all modules with table/collection counts and design decisions
277
+ - Links to each module's detailed model files
278
+
279
+ **Per-module files** (e.g., `model/hero-section/model.md`):
280
+ - Complete field definitions with types and constraints
281
+ - Relationships and references
282
+ - Table/collection names
283
+
284
+ **Per-module schema** (e.g., `model/hero-section/schemas.json`):
285
+ - JSON schemas defining exact field types, required fields, and validation rules
286
+
287
+ The module model directly maps to:
288
+ - TypeScript interface/type definitions (field-for-field, not placeholder)
289
+ - Zod validation schemas
290
+ - React Hook Form field configurations
291
+ - TanStack Query response type annotations
292
+ - API request/response DTOs
293
+
294
+ ### Input 6: HTML Mockup Screens (from mockup/ folder)
295
+
296
+ Read `<app_folder>/context/mockup/MOCKUP.html` first as the index page, then read the
297
+ HTML files organized by role in subfolders.
298
+
299
+ **MOCKUP.html** provides:
300
+ - Application identity (name, version, short name)
301
+ - Design tokens: fonts, colors from Tailwind/CSS config or inline styles
302
+ - List of user roles and their screen sets
303
+
304
+ **Role-specific subfolders** (e.g., `mockup/admin/content/`):
305
+ - Individual HTML screens for each page in the application
306
+ - Screen layout: which components are used (tables, forms, cards, modals, grids)
307
+ - Navigation structure from sidebar/header HTML files
308
+ - Data display patterns (list pages, detail pages, create/edit forms)
309
+
310
+ **IMPORTANT — Role folders inform access control, NOT URL paths.** The role-specific
311
+ folder structure (e.g., `mockup/admin/content/hero-section.html`) determines:
312
+ 1. Which role can access the page → `<ProtectedRoute requiredRole="ADMIN" />`
313
+ 2. Which navigation items appear for each role
314
+ It does NOT determine the URL path. The URL path is always module-based:
315
+ - `<Route path="/hero-section" />` — NOT `<Route path="/admin/hero-section" />`
316
+
317
+ The mockup screens directly map to:
318
+ - React page components (one per HTML screen)
319
+ - React Router route definitions
320
+ - MUI component selections (DataGrid vs Table, Dialog vs Drawer, etc.)
321
+ - Form field layouts
322
+ - Navigation items per role
323
+ - MUI theme color tokens (extract from mockup CSS/styles)
324
+
325
+ ## PRD.md Extended Sections
326
+
327
+ Before determining optional components, check PRD.md for the following extended sections:
328
+
329
+ ### Architecture Principle Extraction
330
+
331
+ If PRD.md contains an `# Architecture Principle` section, extract patterns that affect frontend decisions:
332
+
333
+ | Pattern to Extract | How It Influences the Specification |
334
+ |---|---|
335
+ | "Stateless REST API" | Confirms Axios + TanStack Query pattern for API calls |
336
+ | "Event-driven" / "WebSocket" / "real-time" | Include Socket.io client integration and real-time notification component |
337
+ | "API gateway" | Configure base URL to point to gateway rather than individual services |
338
+ | Backend framework mention | Validate API response format assumptions |
339
+
340
+ If the section is absent, proceed with existing CLAUDE.md-only detection.
341
+
342
+ ### Design System Extraction
343
+
344
+ If PRD.md contains a `# Design System` section with a file reference:
345
+ 1. Resolve and read the referenced file
346
+ 2. Map design tokens to MUI `createTheme()` configuration: palette, typography variants, component style overrides
347
+ 3. Include a complete MUI theme configuration in SPECIFICATION.md derived from the design system tokens
348
+
349
+ If the section is absent, use default MUI theme (existing behavior).
350
+
351
+ ### High Level Process Flow Extraction
352
+
353
+ If PRD.md contains a `# High Level Process Flow` section:
354
+ 1. Process flows with user-visible states inform which status values appear in MUI DataGrid filter dropdowns
355
+ 2. Process flows with real-time updates inform WebSocket subscription patterns
356
+ 3. Multi-step user flows inform React Router nested route design
357
+
358
+ If the section is absent, derive UI flow from user stories only (existing behavior).
359
+
360
+ ---
361
+
362
+ ## Determining Optional Components
363
+
364
+ Instead of asking the user, the skill determines optional components by analyzing the
365
+ dependencies listed in `CLAUDE.md`, the `# Architecture Principle` section in PRD.md (if present),
366
+ and cross-referencing with PRD.md NFRs and constraints.
367
+
368
+ ### Backend API Detection
369
+
370
+ Examine the "Depends on" list in CLAUDE.md for the target application:
371
+
372
+ | Dependency Pattern | API Configuration |
373
+ |---|---|
374
+ | References another application's REST API | `VITE_API_BASE_URL` set to that app's base URL |
375
+ | References a Spring Boot backend | Include Spring Boot CORS headers note |
376
+ | No explicit backend | Include mock API / json-server note for development |
377
+
378
+ ### Authentication Detection
379
+
380
+ | Dependency / PRD Pattern | Auth Selection |
381
+ |---|---|
382
+ | References "Single Sign On" or "Keycloak" in CLAUDE.md dependencies | Auth = Keycloak |
383
+ | PRD.md has login user stories with email/password | Auth = Local (local JWT from API) |
384
+ | PRD.md constraint says "public access, no auth required" | Auth = none |
385
+ | PRD.md has only public-facing content (landing page) | Auth = none |
386
+
387
+ If Auth = Keycloak, also extract from CLAUDE.md:
388
+ - Keycloak version
389
+ - Keycloak realm: Default derived from project name
390
+ - Keycloak client ID: Default `<project-slug>-spa`
391
+ - Keycloak issuer URI: Default `http://localhost:8180/realms/<realm>`
392
+ - Keycloak roles: Infer from mockup role folders (e.g., `admin` → `ADMIN`, `editor` → `EDITOR`)
393
+
394
+ If Auth = Local (API-managed JWT):
395
+ - Login/logout handled by API calls to the backend
396
+ - JWT stored in memory (not localStorage) for XSS protection
397
+ - Axios interceptor attaches Authorization header
398
+ - Zustand auth store manages token and user info
399
+
400
+ ### Optional Component Detection
401
+
402
+ | PRD.md Pattern | Component Selection |
403
+ |---|---|
404
+ | NFRs mention "grid", "sortable columns", "bulk select", "export CSV" | DataGrid = yes |
405
+ | NFRs mention "chart", "bar chart", "pie chart", "graph", "statistics" | Charts = yes |
406
+ | NFRs mention "date picker", "date range", "calendar" | DatePickers = yes |
407
+ | NFRs mention "real-time", "live updates", "push notification", "WebSocket" | WebSocket = yes |
408
+ | PRD.md mentions multiple languages or localization | i18n = yes |
409
+ | User stories mention "rich text", "WYSIWYG", "formatted content", "HTML content" | RichText = yes |
410
+ | NFRs mention "report", "generate report", "report generation", "PDF report" | Reporting = yes |
411
+ | User stories describe generating/downloading PDF, Excel, or CSV reports | Reporting = yes |
412
+ | A "Report" module exists in PRD.md with NFRs defining a Report interface | Reporting = yes |
413
+
414
+ ### Summary of Determination
415
+
416
+ After analyzing all inputs, produce a determination summary before generating the spec.
417
+ Present it to the user for confirmation:
418
+
419
+ ```
420
+ Optional Component Determination:
421
+ - Backend API: http://localhost:<port>/api (from CLAUDE.md Port Allocation table → depends on backend app)
422
+ - Authentication: Keycloak PKCE (from CLAUDE.md → depends on Single Sign On)
423
+ - DataGrid: yes (from PRD.md → NFR mentions sortable user list with bulk actions)
424
+ - Charts: no
425
+ - DatePickers: yes (from PRD.md → hero section effective/expiration date fields)
426
+ - WebSocket: no
427
+ - i18n: no
428
+ - RichText: yes (from PRD.md → blog content editor requires rich text)
429
+ - Reporting: yes (from PRD.md → Report module with Report interface NFR)
430
+ ```
431
+
432
+ If the user disagrees with any determination, allow them to override before proceeding.
433
+
434
+ ## Required Inputs
435
+
436
+ After determination, these values are needed. Most are derived automatically:
437
+
438
+ **Auto-derived from context files:**
439
+ - **Application name**: From CLAUDE.md section heading
440
+ - **Project slug**: Kebab-case of application name
441
+ - **App title**: Title-case used in `<title>` and MUI theme
442
+ - **Application description**: From CLAUDE.md description
443
+ - **Backend API base URL**: From CLAUDE.md dependencies
444
+ - **Modules / Features**: From PRD.md module headings + model/MODEL.md
445
+ - **Auth type**: Auto-determined (see above)
446
+ - **Optional components**: Auto-determined (see above)
447
+ - **User roles**: From mockup role folders
448
+ - **Design tokens**: MUI theme colors extracted from mockup CSS/inline styles
449
+
450
+ **Auto-derived from CLAUDE.md (Port Allocation table):**
451
+ - **Backend API base URL**: Look up the backend application's port from the `Port Allocation` table in the `Custom Applications` section of `CLAUDE.md`. Construct the base URL as `http://localhost:<port>/api/v1`. Do NOT hardcode `8080` — the port MUST match the allocated port for the backend application this SPA depends on.
452
+
453
+ **Optional (use sensible defaults if not found in context):**
454
+ - **Dev server port**: Default `3000`
455
+ - **Default locale**: Default `en`
456
+ - **Page size**: Default `10` (from NFRs, or fallback)
457
+
458
+ ## Generating the Specification
459
+
460
+ Once inputs are gathered from context files and optional components are determined,
461
+ generate the specification as a **multi-file output split by module**. Read the spec
462
+ template at `references/spec-template.md` for the exact structure and content of each
463
+ section. The template is the authoritative guide — follow it closely.
464
+
465
+ The specification is split into two categories:
466
+
467
+ 1. **Root `SPECIFICATION.md`** — Table of Contents, shared infrastructure, MUI theme,
468
+ routing, auth configuration, and application-level sections that apply across all modules.
469
+ 2. **Per-module `<module-name>/SPEC.md`** — Each module gets its own folder with a
470
+ self-contained specification covering that module's complete blueprint.
471
+
472
+ This split enables a coding agent to:
473
+ - First, scaffold the shared infrastructure from `SPECIFICATION.md`
474
+ - Then, implement each module independently by picking up its `<module>/SPEC.md`
475
+
476
+ **Important:** The generated spec must use **real module data** from the context files,
477
+ not generic placeholders. Specifically:
478
+
479
+ - **Modules** must use the actual module names from PRD.md and MODEL.md
480
+ (e.g., `heroSection`, `productService`, `blog` — not `module1`, `module2`)
481
+ - **TypeScript types** must match the actual fields defined in the module model files,
482
+ not placeholder `fieldOne`/`fieldTwo`
483
+ - **API hooks** must expose functions matching the actual user stories (e.g., if a story
484
+ says "view list of hero sections", the hook needs `useHeroSections()`)
485
+ - **Page components** must map to the actual mockup screens (e.g., if
486
+ `admin/content/hero_section.html` exists, there must be a matching route and page
487
+ component). The route path is module-based (e.g., `/hero-section`), NOT role-prefixed
488
+ (e.g., NOT `/admin/hero-section`).
489
+ - **Form fields** must match what the mockup screens display
490
+ - **Zod schemas** must enforce the constraints from PRD.md (character limits, URL format, etc.)
491
+ - **MUI theme** must use the design tokens extracted from the mockup (colors, border-radius, font)
492
+ - **Version tags**: Every user story ID, NFR ID, constraint ID, and mockup screen in the
493
+ traceability section must include its version tag (e.g., `USA000030 [v1.0.4]`).
494
+ **ALL traceability sub-tables (User Stories, NFRs, AND Constraints) MUST include the
495
+ `| Version |` column.**
496
+ - **Removed / Replaced items**: The traceability section must include a "Removed / Replaced"
497
+ subsection listing deprecated items — showing the removed ID, the version that removed it,
498
+ the replacement ID (if any), and a brief reason.
499
+
500
+ ### Output Structure
501
+
502
+ ```
503
+ <app_folder>/context/specification/
504
+ ├── SPECIFICATION.md ← TOC + shared/application-level specs
505
+ ├── hero-section/
506
+ │ └── SPEC.md ← Module blueprint for Hero Section
507
+ ├── product-service/
508
+ │ └── SPEC.md ← Module blueprint for Product and Service
509
+ ├── blog/
510
+ │ └── SPEC.md ← Module blueprint for Blog
511
+ ├── ... ← One folder per module from PRD.md
512
+ ```
513
+
514
+ ### What Goes in `SPECIFICATION.md` (Root)
515
+
516
+ The root file contains the TOC and all shared/application-level sections. These are
517
+ sections a coding agent implements **first** before any module work:
518
+
519
+ #### 1. Project Overview
520
+ Project metadata, application description, technology stack summary, user roles, module
521
+ index table linking to each module's SPEC.md.
522
+
523
+ #### 2. Package Configuration
524
+ Complete `package.json` with all dependencies (core + selected conditional), npm scripts
525
+ (`dev`, `build`, `preview`, `lint`, `type-check`), and Vite configuration.
526
+
527
+ #### 3. Application Configuration
528
+ Vite `vite.config.ts` (with proxy for backend API), TypeScript `tsconfig.json`, ESLint
529
+ config. All environment-sensitive values use `VITE_` prefix in environment files.
530
+
531
+ #### 3a. Application Version Configuration
532
+ The application MUST include a version value exposed via Vite environment variable with a
533
+ default derived from the version argument provided during skill invocation. If multiple
534
+ versions were provided, use the highest one.
535
+
536
+ In `.env.development` and `.env.production`:
537
+ ```properties
538
+ VITE_APP_VERSION=1.0.3
539
+ ```
540
+
541
+ The application MUST expose this version in the **footer** of the layout. The shared layout
542
+ component (e.g., `src/components/Layout/Footer.tsx`) must read `import.meta.env.VITE_APP_VERSION`
543
+ and render it as: `v{version}` (e.g., `v1.0.3`).
544
+
545
+ The `package.json` `version` field MUST also be set to the version value (e.g., `1.0.3`).
546
+
547
+ #### 3b. `.env.development` File Generation from ENVIRONMENT.md
548
+ Generate `.env.development` and `.env.production` files at the project root.
549
+ The `.env.development` file is populated by reading `ENVIRONMENT.md` from the project root,
550
+ mapping credential and platform values to `VITE_`-prefixed environment variable names.
551
+ The `.env.production` file uses placeholder values for production deployment.
552
+
553
+ **Process:**
554
+ 1. Read `ENVIRONMENT.md` from the project root
555
+ 2. Extract credential values from `ENVIRONMENT.md` (`# Supporting 3rd Party Applications`
556
+ for Keycloak host/realm/client); the backend API host/port comes from the
557
+ `# Port Allocation` table in `CLAUDE.md`. Read any toolchain paths (e.g., Node.js) from `DEVTOOL.md`
558
+ 3. Map each value to the corresponding `VITE_` environment variable name
559
+ 4. Generate `.env.development` with actual local values
560
+ 5. Generate `.env.production` with production placeholder values
561
+
562
+ **Example `.env.development` output (derived from ENVIRONMENT.md):**
563
+ ```properties
564
+ # Backend API
565
+ VITE_API_BASE_URL=http://localhost:<port from CLAUDE.md Port Allocation table>/api/v1
566
+
567
+ # Authentication (Keycloak)
568
+ VITE_KEYCLOAK_URL=http://localhost:8180
569
+ VITE_KEYCLOAK_REALM=urp
570
+ VITE_KEYCLOAK_CLIENT_ID=sc-worker-mobile-spa
571
+ ```
572
+
573
+ **Rules:**
574
+ - Only include variables that are actually used in the application code via `import.meta.env`
575
+ - Use actual values from ENVIRONMENT.md — never use placeholders or `TODO`
576
+ - If ENVIRONMENT.md does not exist or a value is not found, use sensible defaults for local
577
+ development (e.g., `localhost`, default ports)
578
+ - Both `.env.development` and `.env.production` are gitignored
579
+
580
+ #### 4. Directory Structure
581
+ The complete source tree under `src/`. The structure follows feature-based architecture
582
+ where each PRD module maps to a `src/features/<module>/` folder.
583
+ Read `references/routing-patterns.md` for the module folder layout.
584
+
585
+ #### 5. MUI Theme Configuration
586
+ Custom MUI theme built from design tokens extracted from mockup screens. Includes color
587
+ palette (primary, secondary, error, warning, success), typography (font family, sizes),
588
+ shape (border-radius), and component overrides.
589
+ Read `references/component-patterns.md` for theme setup patterns.
590
+
591
+ #### 6. Authentication Configuration *(conditional — include only if Auth != none)*
592
+ **If Auth = Keycloak:** PKCE Authorization Code flow using `oidc-client-ts` +
593
+ `react-oidc-context`. `AuthProvider` wraps the app, `useAuth()` hook exposes user and
594
+ tokens, Axios interceptor attaches Bearer token, protected route component checks
595
+ authentication. Read `references/security-patterns.md` for the full auth architecture.
596
+
597
+ **If Auth = Local (API JWT):** Login form submits to backend API, JWT stored in Zustand
598
+ auth store (memory only, not localStorage), Axios interceptor attaches Authorization
599
+ header, token refresh interceptor handles 401 responses, protected route component
600
+ redirects unauthenticated users.
601
+
602
+ #### 7. Router Configuration
603
+ React Router v7 route tree — lazy-loaded page components, protected routes with role
604
+ guards, public routes, 404 fallback.
605
+ Read `references/routing-patterns.md` for route patterns.
606
+
607
+ #### 8. API Client Configuration
608
+ Axios instance with `baseURL` from `VITE_API_BASE_URL`, request/response interceptors
609
+ for auth token injection, global error handling (toast notifications for 4xx/5xx),
610
+ request timeout.
611
+
612
+ #### 9. Global State (Zustand)
613
+ App-level Zustand stores: auth store (user info, token, login/logout actions), UI store
614
+ (sidebar open/closed, theme mode, global loading). Feature-level stores defined in each
615
+ module's SPEC.md.
616
+
617
+ #### 10. TanStack Query Setup
618
+ `QueryClient` configuration with sensible defaults (staleTime, gcTime, retry logic),
619
+ `QueryClientProvider` wrapping the app, React Query DevTools for development,
620
+ global error handler for failed queries.
621
+
622
+ #### 11. Shared Layouts
623
+ `DashboardLayout` (sidebar navigation + topbar + content area for authenticated pages),
624
+ `PublicLayout` (minimal header/footer for public pages), `AuthLayout` (centered card
625
+ for login/callback pages). Each layout uses MUI components.
626
+
627
+ #### 12. Shared Components
628
+ Reusable MUI-based components used across multiple modules: `PageHeader`, `DataTable`
629
+ (wrapper around MUI Table or X DataGrid), `ConfirmDialog`, `StatusChip`, `FormDialog`,
630
+ `ImageUpload`, `LoadingOverlay`, `EmptyState`, `ErrorBoundary`, `SearchInput`,
631
+ `FilterBar`. Each with TypeScript props interface.
632
+
633
+ #### 13. Navigation Configuration
634
+ Sidebar navigation items derived from mockup sidebar files, organized by role. Each item
635
+ has label, icon (MUI icon), path, and required role. Navigation is rendered dynamically
636
+ based on the authenticated user's roles.
637
+
638
+ #### 14. Form Infrastructure
639
+ `FormProvider` usage pattern from React Hook Form, Zod schema integration via
640
+ `zodResolver`, reusable controlled input components (`TextFieldController`,
641
+ `SelectController`, `DatePickerController`, `SwitchController`, `AutocompleteController`)
642
+ that wrap MUI inputs with RHF `Controller`.
643
+
644
+ #### 15. Error Handling Strategy
645
+ React `ErrorBoundary` component for rendering errors, Axios response interceptor for
646
+ API errors, TanStack Query `onError` callback for query failures, Zod validation error
647
+ message extraction utility, MUI Snackbar/Alert for user-facing error messages.
648
+
649
+ #### 16. Notification System
650
+ MUI Snackbar + Alert stack for toast notifications. Zustand notification store with
651
+ `push(type, message)` and `dismiss(id)` actions. `NotificationProvider` renders the
652
+ active queue at the bottom of the viewport.
653
+
654
+ #### 17. Theming & Dark Mode
655
+ MUI `ThemeProvider` with `CssBaseline`. Theme mode (`light`/`dark`) toggled via UI
656
+ control, persisted to `localStorage`. `useColorMode()` hook wraps the toggle action.
657
+ MUI `createTheme()` called with the extracted design tokens.
658
+
659
+ #### 18. Testing Strategy
660
+ Overview: Vitest + React Testing Library for unit/component tests, MSW (Mock Service
661
+ Worker) for API mocking in tests, Playwright for E2E tests. Per-feature test conventions
662
+ matching the module spec.
663
+
664
+ #### 19. Build & Deployment
665
+ Vite production build (`npm run build`), chunk splitting strategy (vendor chunk, per-
666
+ feature lazy chunks), environment variable injection, static hosting notes (nginx config
667
+ for SPA routing).
668
+
669
+ #### 20. Internationalisation *(conditional — include only if i18n = yes)*
670
+ `react-i18next` setup, `I18nextProvider` wrapping the app, lazy-loaded translation
671
+ namespaces per module (e.g., `heroSection.json`), `useTranslation()` hook usage pattern,
672
+ language switcher component.
673
+
674
+ #### 21. WebSocket Integration *(conditional — include only if WebSocket = yes)*
675
+ `socket.io-client` setup, connection management Zustand store, custom `useSocket()`
676
+ hook, event subscription patterns, reconnection handling.
677
+
678
+ #### 22. Reporting (Puppeteer) *(conditional — include only if Reporting = yes)*
679
+ Client-side report UI components and server-side Puppeteer PDF generation service.
680
+ Includes report list page (MUI DataGrid or Card grid grouped by domain), report parameter
681
+ form page (React Hook Form + Zod + MUI), report preview dialog (iframe-based HTML preview),
682
+ `useReportGeneration()` hook orchestrating PDF/XLSX/CSV generation, `renderReportHtml()`
683
+ utility using `ReactDOMServer.renderToStaticMarkup()` to produce self-contained HTML with
684
+ Tailwind CDN for Puppeteer rendering, report layout components (React components rendering
685
+ tabular/summary reports as HTML), client-side XLSX export via `xlsx` library, client-side
686
+ CSV export via `PapaParse`, lightweight Node.js Express report service using Puppeteer for
687
+ HTML-to-PDF conversion (deployed as sidecar or microservice), Vite proxy configuration for
688
+ development. Report layouts are fully AI-agent-developed React components — no visual
689
+ designers needed. Read `references/reporting-patterns.md` for the full reporting
690
+ architecture.
691
+
692
+ ### What Goes in Each `<module>/SPEC.md` (Per-Module)
693
+
694
+ For EACH module from PRD.md and MODEL.md, create a folder named after the module
695
+ (kebab-case, e.g., `hero-section/`) and generate a `SPEC.md` inside it.
696
+
697
+ Each module `SPEC.md` is a **self-contained** blueprint that a coding agent can pick up
698
+ and implement independently (after the shared infrastructure is in place). It must include:
699
+
700
+ - **Header** with module name and back-reference to root `SPECIFICATION.md`
701
+ - **Traceability**: User story IDs, NFR IDs, constraint IDs, table/collection names,
702
+ mockup screen filenames, all with version tags
703
+ - **TypeScript Types** — interfaces/types matching the module model fields (field-for-field)
704
+ - **Zod Schemas** — validation schemas for create/update forms, derived from PRD constraints
705
+ - **API Functions** — Axios-based API calls matching user story data operations
706
+ - **TanStack Query Hooks** — `useQuery` and `useMutation` hooks wrapping API functions
707
+ - **Zustand Feature Store** (if the module has complex client state beyond server cache)
708
+ - **Page Components** — one per mockup screen, using MUI components matching the mockup layout
709
+ - **Form Components** — create/edit forms with React Hook Form + Zod + MUI controllers
710
+ - **Route Definitions** — React Router routes for this module
711
+ - **Navigation Items** — sidebar nav entries for each role that can access this module
712
+ - **Complete code samples** for every component — continuous and copy-pasteable
713
+
714
+ See `references/spec-template.md` for the exact per-module template structure.
715
+
716
+ ## Changelog Append
717
+
718
+ After all specification files are successfully generated, append an entry to `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
719
+
720
+ 1. Read `<app_folder>/CHANGELOG.md`. If it does not exist, create it with:
721
+ ```markdown
722
+ # Changelog
723
+
724
+ - This file tracks all skill executions by version for this application.
725
+ - The highest version recorded here is the current application version.
726
+ - Skills MUST NOT execute for a version lower than the highest version in this file.
727
+
728
+ ---
729
+ ```
730
+ 2. Search for a `## {version}` heading matching the current version.
731
+ 3. If the section **exists**: append a new row to its table.
732
+ 4. If the section **does not exist**: insert a new section after the `---` below the context header and before any existing `## vX.Y.Z` section (newest-first ordering), with a new table header and the first row.
733
+ 5. Row format: `| {YYYY-MM-DD} | {application_name} | specgen-react-mui | {module or "All"} | Generated React SPA technical specification |`
734
+ 6. **Never modify or delete existing rows.**
735
+
736
+ ## Output Format
737
+
738
+ The generated specification is a **folder of files**, not a single document:
739
+
740
+ ```
741
+ <app_folder>/context/specification/
742
+ ├── SPECIFICATION.md ← Root: TOC + shared/application-level specs
743
+ ├── <module-1>/
744
+ │ └── SPEC.md ← Module blueprint (self-contained)
745
+ ├── <module-2>/
746
+ │ └── SPEC.md
747
+ ├── <module-N>/
748
+ │ └── SPEC.md
749
+ ```
750
+
751
+ ## Constraints (Non-Negotiable)
752
+
753
+ These constraints apply to every code sample in the generated spec:
754
+
755
+ **TypeScript everywhere.** All files use `.tsx` or `.ts` extensions. No `.js` or `.jsx`.
756
+ No `any` type — use `unknown` with type narrowing, or proper type inference.
757
+
758
+ **Feature-based architecture.** Every module maps to `src/features/<module>/`. Nothing
759
+ module-specific leaks into `src/shared/` or `src/lib/`. Shared utilities must be
760
+ genuinely reusable across at least two modules.
761
+
762
+ **No localStorage for tokens.** JWT access tokens are stored in Zustand memory store
763
+ only. Refresh tokens may use `httpOnly` cookies (handled by backend). This prevents XSS
764
+ token theft.
765
+
766
+ **TanStack Query for all server state.** Do not use Zustand or component state to cache
767
+ API responses. TanStack Query manages all server-side data (fetching, caching, invalidation).
768
+ Zustand manages only client-side UI state (filters, selections, modal open/closed).
769
+
770
+ **React Hook Form + Zod for all forms.** Do not use uncontrolled inputs or manual
771
+ `useState` for form fields. Every form uses `useForm()` with `zodResolver()`.
772
+
773
+ **MUI components only.** Do not mix component libraries. If a component is not
774
+ natively available in MUI, build it using MUI primitives (`Box`, `Stack`, `Typography`,
775
+ `Paper`). No Tailwind CSS in this skill (unlike the Spring Boot / Laravel skills).
776
+
777
+ **Named exports for components.** Use named exports (not default exports) for all
778
+ component files to improve tree-shaking and refactoring.
779
+
780
+ **Lazy loading for all page components.** All route page components use `React.lazy()`
781
+ for code splitting. The router uses `<Suspense>` with a loading fallback.
782
+
783
+ **Consistent file naming:**
784
+ - Components: `PascalCase.tsx` (e.g., `HeroSectionList.tsx`)
785
+ - Hooks: `camelCase.ts` with `use` prefix (e.g., `useHeroSections.ts`)
786
+ - API functions: `camelCase.ts` (e.g., `heroSectionApi.ts`)
787
+ - Types: `camelCase.types.ts` (e.g., `heroSection.types.ts`)
788
+ - Zod schemas: `camelCase.schema.ts` (e.g., `heroSection.schema.ts`)
789
+ - Zustand stores: `camelCase.store.ts` (e.g., `heroSection.store.ts`)