@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,990 @@
1
+ ---
2
+ name: specgen-spring-jpa-restapi
3
+ model: claude-opus-4-8
4
+ effort: high
5
+ description: >
6
+ Generate a detailed specification document for building a Spring Boot 3 REST API
7
+ application with Spring Modulith packaging. Database (MongoDB, PostgreSQL, MySQL, or none),
8
+ authentication (Keycloak OAuth2 Resource Server, Spring Security JWT, or none), scheduling
9
+ (Quartz + Spring Batch or none), and messaging (RabbitMQ pub/sub or none) are configurable
10
+ based on user input.
11
+ Standardized input: application name (mandatory), version (mandatory), module (optional).
12
+ Use this skill whenever the user asks to create a spec, specification, blueprint, or
13
+ technical design document for a new Spring Boot REST API application.
14
+ Also trigger when the user says things like "spec out a new REST API project",
15
+ "design a Spring Boot API skeleton", "write a technical spec for my new API",
16
+ "scaffold spec for a REST API", or any request for a specification document
17
+ describing a Spring Boot REST API application. Even if the user only mentions
18
+ a subset of the stack (e.g., "Spring Boot API" or "Spring REST with MySQL" or
19
+ "Spring Boot API with Keycloak"), this skill likely applies — ask and confirm.
20
+ ---
21
+
22
+ # Spring Boot REST API Specification Generator
23
+
24
+ This skill generates a comprehensive specification document (Markdown) that serves as a
25
+ blueprint for building a Spring Boot 3 REST API application. The spec is intended to be
26
+ followed by a developer or a coding agent to produce a fully functional project scaffold.
27
+
28
+ The specification does NOT generate code. It produces a detailed, opinionated technical
29
+ document describing every layer of the application — from Maven configuration to controller
30
+ endpoints to security filter chains — so that implementation becomes a mechanical exercise.
31
+
32
+ ## Technology Stack
33
+
34
+ ### Core Stack (Always Included)
35
+
36
+ These are the fixed versions the spec targets. Do not deviate unless the user explicitly
37
+ requests different versions.
38
+
39
+ | Component | Version |
40
+ |--------------------|-----------|
41
+ | Java JDK | 21 |
42
+ | Spring Boot | 3.5.7 |
43
+ | Maven | 4.0.0 |
44
+
45
+ ### Optional Integration Versions
46
+
47
+ Include in the version table only when the corresponding integration is selected.
48
+
49
+ | Component | Version | When Selected |
50
+ |--------------------|-----------|----------------------|
51
+ | MongoDB | 8.0.19 | Database = MongoDB |
52
+ | PostgreSQL | 17.x | Database = PostgreSQL|
53
+ | MySQL | 8.4.x | Database = MySQL |
54
+ | Keycloak | 26.5.3 | Auth = Keycloak |
55
+ | RabbitMQ | 4.x | Messaging = yes OR Remote Partitioning = yes |
56
+
57
+ ## Core Dependencies
58
+
59
+ The spec must include these in the Maven configuration section (always):
60
+
61
+ - Spring Web (starter-web)
62
+ - Spring Modulith (core, events-api)
63
+ - Lombok
64
+ - Spring Boot DevTools
65
+ - MapStruct (with annotation processor)
66
+ - Jackson (included via starter-web, for JSON serialization)
67
+ - SpringDoc OpenAPI (`springdoc-openapi-starter-webmvc-ui`) for API documentation
68
+
69
+ ### Conditional Dependencies
70
+
71
+ **If Database = MongoDB:**
72
+ - Spring Data MongoDB (`spring-boot-starter-data-mongodb`)
73
+ - MongoDB Driver
74
+ - Spring Modulith starter-mongodb (`spring-modulith-starter-mongodb`)
75
+
76
+ **If Database = PostgreSQL or MySQL:**
77
+ - Spring Data JPA (`spring-boot-starter-data-jpa`)
78
+ - PostgreSQL driver (`org.postgresql:postgresql`) or MySQL driver (`com.mysql:mysql-connector-j`)
79
+ - Flyway (`org.flywaydb:flyway-core`) for schema migration
80
+ - Spring Modulith starter-jpa (`spring-modulith-starter-jpa`)
81
+
82
+ **If Auth = Keycloak:**
83
+ - Spring Security (`spring-boot-starter-security`)
84
+ - Spring Security OAuth2 Resource Server (`spring-boot-starter-oauth2-resource-server`)
85
+
86
+ **If Auth = Spring Security (JWT):**
87
+ - Spring Security (`spring-boot-starter-security`)
88
+ - `io.jsonwebtoken:jjwt-api`, `jjwt-impl`, `jjwt-jackson` for JWT token generation/validation
89
+
90
+ **If Scheduling = yes:**
91
+ - Spring Quartz (`spring-boot-starter-quartz`)
92
+ - If Database = MongoDB: `io.fluidsonic.mirror:fluidsonic-mirror-quartz` (MongoDB job store for Quartz)
93
+ - If Database = PostgreSQL/MySQL: Quartz JDBC job store (built-in)
94
+
95
+ **If Scheduling = yes AND Spring Batch = yes:**
96
+ - Spring Batch (`spring-boot-starter-batch`)
97
+
98
+ **If Scheduling = yes AND Spring Batch = yes AND Remote Partitioning = yes:**
99
+ - Spring Batch Integration (`spring-batch-integration`)
100
+ - Spring Integration AMQP (`spring-integration-amqp`)
101
+ - Spring Boot AMQP Starter (`spring-boot-starter-amqp`)
102
+
103
+ **If Messaging = yes:**
104
+ - Spring Boot AMQP Starter (`spring-boot-starter-amqp`)
105
+ *(shared with Remote Partitioning — if both are selected, include the dependency once)*
106
+
107
+ **If Reporting = yes:**
108
+ - JasperReports (`net.sf.jasperreports:jasperreports:7.0.3`) — report engine with JRDesign API for programmatic layout
109
+ - JasperReports Fonts (`net.sf.jasperreports:jasperreports-fonts:7.0.3`)
110
+ - OpenPDF (`com.github.librepdf:openpdf:2.0.4`) — PDF export engine for JasperReports 7.x
111
+ - Apache POI OOXML (`org.apache.poi:poi-ooxml:5.4.1`) — XLSX export support
112
+
113
+ ## When the Skill Triggers
114
+
115
+ Generate the spec when the user provides an **application name** and **version** that
116
+ corresponds to one of the custom applications defined in `CLAUDE.md`. The skill
117
+ reads all required inputs from the project's context files — no interactive Q&A is needed
118
+ for the core inputs.
119
+
120
+ The user invokes this skill by specifying the target application and version, for example:
121
+ - `/specgen-spring-jpa-restapi hc_adapter v1.0.0`
122
+ - `/specgen-spring-jpa-restapi hc_adapter v1.0.0 module:Job Demand`
123
+ - `/specgen-spring-jpa-restapi "HC Adapter" v1.0.0`
124
+
125
+ The skill then locates the matching context folder and reads all input files automatically.
126
+
127
+ ## Version Gate
128
+
129
+ 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`):
130
+
131
+ 1. If `<app_folder>/CHANGELOG.md` does not exist, skip this check (first-ever execution for this application).
132
+ 2. If `<app_folder>/CHANGELOG.md` exists, scan all `## vX.Y.Z` headings and determine the **highest version** using semantic versioning comparison.
133
+ 3. Compare the requested version against the highest version:
134
+ - If requested version **>=** highest version: proceed normally.
135
+ - 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.
136
+
137
+ ## Input Resolution
138
+
139
+ This skill uses standardized input resolution. Provide:
140
+
141
+ | Argument | Required | Example | Description |
142
+ |----------|----------|---------|-------------|
143
+ | `<application>` | Yes | `hc_adapter` | Application name to locate the context folder |
144
+ | `<version>` | Yes | `v1.0.0` | Version to scope processing |
145
+ | `module:<name>` | No | `module:Job Demand` | Limit generation to a single module |
146
+
147
+ ### Application Folder Resolution
148
+
149
+ The application name is matched against root-level application folders:
150
+ 1. Strip any leading `<number>_` prefix from folder names (e.g., `1_hc_adapter` -> `hc_adapter`)
151
+ 2. Match case-insensitively against the provided application name
152
+ 3. Accept snake_case, kebab-case, or title-case input (all match the same folder)
153
+ 4. If no match found, list available applications and stop
154
+
155
+ ### Auto-Resolved Paths
156
+
157
+ | File | Resolved Path |
158
+ |------|---------------|
159
+ | PRD.md | `<app_folder>/context/PRD.md` |
160
+ | Module Models | `<app_folder>/context/model/` |
161
+ | Output (specification) | `<app_folder>/context/specification/` |
162
+
163
+ ### Example Invocations
164
+
165
+ - `/specgen-spring-jpa-restapi hc_adapter v1.0.0` (all modules)
166
+ - `/specgen-spring-jpa-restapi hc_adapter v1.0.0 module:Job Demand` (one module)
167
+ - `/specgen-spring-jpa-restapi "HC Adapter" v1.0.0`
168
+
169
+ ### Version Filtering
170
+
171
+ When a version is provided, only include user stories, NFRs, and constraints from versions
172
+ <= the provided version. For example, if `v1.0.3` is specified:
173
+ - Include items tagged `[v1.0.0]`, `[v1.0.1]`, `[v1.0.2]`, `[v1.0.3]`
174
+ - Exclude items tagged `[v1.0.4]` or later
175
+ - Version comparison uses semantic versioning order
176
+
177
+ ### Module Filtering
178
+
179
+ When `module:<name>` is provided:
180
+ - Only generate the `SPEC.md` for that specific module
181
+ - Other existing module spec files remain untouched
182
+ - `SPECIFICATION.md` (root) gets a partial update — only that module's entry in the TOC
183
+ is added or updated; all other TOC entries are preserved as-is
184
+
185
+ ## Gathering Input
186
+
187
+ The specification is driven by **five input sources** that are read from the project's
188
+ context files. The skill does NOT ask the user for database, authentication, scheduling,
189
+ or messaging choices — it **determines** these automatically from the context.
190
+
191
+ ### Input 1: Application Name (from CLAUDE.md)
192
+
193
+ From CLAUDE.md (already loaded in context), locate the target application under the **Custom Applications**
194
+ section. Extract:
195
+
196
+ - **Application name**: The section heading (e.g., "HC Adapter", "SC Adapter")
197
+ - **Application description**: The description paragraph below the heading
198
+ - **Dependencies**: The "Depends on" list — this is the primary source for determining
199
+ optional components (see [Determining Optional Components](#determining-optional-components))
200
+
201
+ The application name is used to derive:
202
+ - **Artifact ID**: Kebab-case of the application name (e.g., `hc-adapter`)
203
+ - **Group ID**: `com.bestinet.urp` (project-level constant)
204
+ - **Base package**: `com.bestinet.urp.<artifactid_no_hyphens>` (e.g., `com.bestinet.urp.hcadapter`)
205
+
206
+ ### Input 2: User Stories (from PRD.md)
207
+
208
+ Read `<app_folder>/context/PRD.md`. This file contains all user stories
209
+ organized by module. Extract:
210
+
211
+ - **System modules**: Modules under the `# System Module` heading (e.g., User, Notification,
212
+ Activities, Audit Trail). These become system-level modules in the spec.
213
+ - **Business modules**: Modules under the `# Business Module` heading (e.g., Location
214
+ Information, Corridor, Employer). These become business-level modules.
215
+ - **User stories per module**: Each `### User Story` section contains tagged items like
216
+ `[USHC00108] As a user, I want to...`. These define the functional requirements for
217
+ each module's service interface and API endpoints.
218
+
219
+ The user stories directly inform:
220
+ - Which CRUD operations each module's service must expose
221
+ - Which REST API endpoints are needed
222
+ - Which request/response DTOs and validation rules apply
223
+
224
+ **Important:** Items with strikethrough (`~~text~~`) are deprecated — do NOT include them
225
+ as active requirements. Instead, list them in the "Removed / Replaced" subsection of the
226
+ traceability table (see spec-template.md) so that developers can see what was removed and
227
+ which version removed it. If a deprecated item has a replacement (e.g., `USHC00015` replaced
228
+ by `USHC00222`), note the replacement ID.
229
+
230
+ - **Version tags per item**: Each `### User Story`, `### Non Functional Requirement`,
231
+ and `### Constraint` section contains one or more version blocks formatted as `[v1.0.x]`.
232
+ Items listed under each version tag belong to that version. The skill must track the
233
+ version tag for each item (user story, NFR, constraint) and carry it through to the
234
+ generated specification's traceability section. When a version block explicitly lists
235
+ "Removed ... from previous version", record those removals in a "Removed / Replaced"
236
+ subsection with the version that removed them and the replacement ID (if any).
237
+
238
+ ### Input 3: Non-Functional Requirements (from PRD.md)
239
+
240
+ Within the same `PRD.md`, each module has a `### Non Functional Requirement` section
241
+ with tagged items like `[NFRHC0120]`. These inform:
242
+
243
+ - Data storage strategies (e.g., "stored in staging database", "stored in the database")
244
+ - Integration patterns (e.g., "API call to external service", "sent asynchronously")
245
+ - Performance constraints (e.g., "automatically deleted after 30 days")
246
+ - Security requirements (e.g., "API key authentication", "JWT validation")
247
+
248
+ NFRs should be mapped to specific technical decisions in the spec — for example, an NFR
249
+ stating "staging database" confirms adapter pattern, while "sent asynchronously" confirms
250
+ event-driven processing.
251
+
252
+ ### Input 4: Constraints (from PRD.md)
253
+
254
+ Within the same `PRD.md`, each module has a `### Constraint` section with tagged
255
+ items like `[CONSHC042]`. These define hard boundaries that the spec must enforce:
256
+
257
+ - Field-level restrictions (e.g., "only accept ISO3 country codes")
258
+ - Feature boundaries (e.g., "only 2 message types supported")
259
+ - Scope limitations (e.g., "does not manage any user, permissions and roles")
260
+
261
+ Constraints are embedded directly into the relevant module blueprint — they inform
262
+ service interface contracts, validation rules, and API endpoint configurations.
263
+
264
+ ### Input 5: Module Model (from model/ folder)
265
+
266
+ Read `<app_folder>/context/model/MODEL.md` first as the index, then read the
267
+ individual module model files in each module subfolder.
268
+
269
+ **MODEL.md** provides:
270
+ - Summary table of all modules with entity counts and design decisions
271
+ - Links to each module's detailed model files
272
+
273
+ **Per-module files** (e.g., `model/job-demand/model.md`):
274
+ - Complete entity field definitions with types and constraints
275
+ - Embedded vs. referenced relationships
276
+ - Table names
277
+ - Index specifications
278
+ - Audit field patterns
279
+
280
+ **Per-module schema** (e.g., `model/job-demand/schemas.json`):
281
+ - JSON schemas defining exact field types, required fields, and validation rules
282
+
283
+ **Per-module diagram** (e.g., `model/job-demand/entity-model.mermaid`):
284
+ - Visual representation of entity structure and relationships
285
+
286
+ The module model directly maps to:
287
+ - JPA entities (field-for-field, not placeholder) or MongoDB documents
288
+ - Repository methods and query patterns
289
+ - MapStruct mapper definitions
290
+ - DTO structures matching the actual module fields
291
+ - Service interface method signatures
292
+
293
+ - **Version tracking**: The MODEL.md summary table includes a "Versions" column listing
294
+ which versions each module participates in (e.g., "1.0.0, 1.0.1, 1.0.3"). Per-module
295
+ model.md files may also include version annotations on fields and indexes. The skill
296
+ must carry these version tags into the generated specification.
297
+
298
+ ## PRD.md Extended Sections
299
+
300
+ Before determining optional components, check PRD.md for the following extended sections and extract their content for use throughout specification generation:
301
+
302
+ ### Architecture Principle Extraction
303
+
304
+ If PRD.md contains an `# Architecture Principle` section, read it and extract architectural patterns as a structured context object. These patterns serve as **primary signals** for optional component determination and specification content:
305
+
306
+ | Pattern to Extract | How It Influences the Specification |
307
+ |---|---|
308
+ | Framework mention (e.g., "Spring Boot") | Validates technology stack choice |
309
+ | "Stateless" | Confirms stateless REST API — no HTTP session, JWT validation only; include in Security section |
310
+ | "Event-driven" | Enhances event publishing/subscribing sections with event catalog and explicit listener patterns |
311
+ | "Message driven" / "message queue" | Validates RabbitMQ integration; include message flow per module |
312
+ | "Document based database" / "MongoDB" | Primary signal for Database = MongoDB |
313
+ | "At-least-once delivery" | Add Idempotency section with idempotency key header pattern and deduplication |
314
+ | "Container based deployment" | Confirms `${ENV_VAR}` syntax for configuration |
315
+ | "API gateway" | Adjust base URL configuration for gateway routing |
316
+ | "Scale out" / "horizontally scalable" | Note horizontal scaling considerations in deployment section |
317
+
318
+ If the section is absent, proceed with existing CLAUDE.md-only detection.
319
+
320
+ ### High Level Process Flow Extraction
321
+
322
+ If PRD.md contains a `# High Level Process Flow` section:
323
+ 1. Parse all named process flows and their ordered steps
324
+ 2. Each process flow is an **authoritative source** for messaging pipeline sections in per-module SPEC.md:
325
+ - Each step maps to a service method, event listener, or message handler
326
+ - Error paths generate exception handlers and dead-letter queue configurations
327
+ - ACK/NACK patterns become outbound message publisher specs with defined schemas
328
+ 3. Include a "Process Flow Implementation" subsection in each affected module's SPEC.md mapping flow steps to service methods
329
+ 4. Generate an event catalog in SPECIFICATION.md listing all domain events from process flows
330
+
331
+ If the section is absent, derive messaging patterns from NFRs only (existing behavior).
332
+
333
+ ---
334
+
335
+ ## Determining Optional Components
336
+
337
+ Instead of asking the user, the skill determines optional components by analyzing the
338
+ dependencies listed in `CLAUDE.md`, the `# Architecture Principle` section in PRD.md (if present),
339
+ and cross-referencing with PRD.md NFRs and constraints.
340
+
341
+ ### Database Detection
342
+
343
+ **First check PRD.md `# Architecture Principle`**: If it explicitly mentions a database type (e.g., "document based database", "MongoDB", "relational database", "MySQL"), use that as the primary signal.
344
+
345
+ **Fallback to CLAUDE.md**: Examine the "Depends on" list in CLAUDE.md for the target application:
346
+
347
+ | Dependency Pattern | Database Selection |
348
+ |---|---|
349
+ | References "Hub Database" (MongoDB) | Database = MongoDB |
350
+ | References "HC Database" or "SC Database" (MySQL) | Database = MySQL |
351
+ | No database dependency listed | Database = none |
352
+
353
+ Also check `CLAUDE.md`'s database section for the exact database name, host, and
354
+ credentials to use in the spec's application configuration. Read `ENVIRONMENT.md` (in the
355
+ project root) for host, port, and credentials.
356
+
357
+ ### Authentication Detection
358
+
359
+ | Dependency Pattern | Auth Selection |
360
+ |---|---|
361
+ | References "Hub Single Sign On" (Keycloak) | Auth = Keycloak (Resource Server) |
362
+ | PRD.md constraint says "does not manage any user, permissions and roles" | Auth = none |
363
+ | PRD.md NFRs reference "JWT token" or "Bearer token" | Auth = Keycloak (Resource Server) |
364
+ | No SSO/Keycloak dependency but has user management stories | Auth = JWT (self-issued) |
365
+
366
+ If Auth = Keycloak (Resource Server), also extract from CLAUDE.md:
367
+ - Keycloak version from "Hub Single Sign On" section
368
+ - Keycloak realm: Default derived from project name
369
+ - Keycloak issuer URI: Default `http://localhost:8180/realms/<realm>`
370
+ - Keycloak roles: Infer from user stories and NFRs
371
+ - The application validates JWT tokens issued by Keycloak (stateless, no session)
372
+
373
+ ### Messaging Detection
374
+
375
+ | Dependency Pattern | Messaging Selection |
376
+ |---|---|
377
+ | References "Hub to HC Adapter Message Queue" or "Hub to SC Adapter Message Queue" (RabbitMQ) | Messaging = yes |
378
+ | No message queue dependency listed | Messaging = no |
379
+
380
+ If Messaging = yes, also extract the RabbitMQ version from the corresponding message
381
+ queue section in CLAUDE.md.
382
+
383
+ ### Scheduling Detection
384
+
385
+ Scheduling is determined from PRD.md content:
386
+
387
+ | Content Pattern | Scheduling Selection |
388
+ |---|---|
389
+ | NFRs mention "automatically deleted after X days", "scheduled", "periodic", "batch processing" | Scheduling = yes |
390
+ | User stories describe recurring jobs, cleanup tasks, or time-triggered operations | Scheduling = yes |
391
+ | No scheduling-related requirements found | Scheduling = no |
392
+
393
+ **If Scheduling = yes**, further determine:
394
+ - **Spring Batch = yes** if NFRs mention "batch processing", "ETL", "bulk import/export",
395
+ or processing large volumes of data with reader/processor/writer patterns
396
+ - **Remote Partitioning = yes** if NFRs mention "distributed processing", "horizontal
397
+ scaling", or "partitioned batch jobs"
398
+
399
+ ### Reporting Detection
400
+
401
+ Reporting is determined from PRD.md content:
402
+
403
+ | Content Pattern | Reporting Selection |
404
+ |---|---|
405
+ | NFRs mention "report", "Report interface", "generate report", "report generation" | Reporting = yes |
406
+ | User stories describe generating/downloading PDF, Excel, or CSV reports | Reporting = yes |
407
+ | A "Report" module exists in PRD.md with NFRs defining a Report interface | Reporting = yes |
408
+ | No reporting-related requirements found | Reporting = no |
409
+
410
+ **If Reporting = yes**, the spec includes:
411
+ - JasperReports with JRDesign API for fully programmatic report layout (no .jrxml templates)
412
+ - `ReportDefinition` interface with `buildDesign()` method for modules to implement
413
+ - `ReportDesignHelper` utility class with static builders for common layout patterns
414
+ - `ReportService` orchestrating compile → fill → export via `JRBeanCollectionDataSource`
415
+ - Report registry persisted in the database
416
+ - REST controller with report list, details, and generation endpoints (JSON + file download)
417
+ - Multi-format export: PDF (OpenPDF), XLSX (Apache POI), CSV
418
+
419
+ ### Summary of Determination
420
+
421
+ After analyzing all inputs, produce a determination summary before generating the spec.
422
+ Present it to the user for confirmation:
423
+
424
+ ```
425
+ Optional Component Determination:
426
+ - Database: MySQL (from CLAUDE.md -> depends on HC Database)
427
+ - Authentication: Keycloak Resource Server (from CLAUDE.md -> depends on Hub Single Sign On)
428
+ - Scheduling: no
429
+ - Messaging: yes (from CLAUDE.md -> depends on Hub to HC Adapter Message Queue)
430
+ - Reporting: yes (from PRD.md → Report module with Report interface NFR)
431
+ ```
432
+
433
+ If the user disagrees with any determination, allow them to override before proceeding.
434
+
435
+ ## Required Inputs
436
+
437
+ After determination, these values are needed. Most are derived automatically:
438
+
439
+ **Auto-derived from context files:**
440
+ - **Application name**: From CLAUDE.md section heading
441
+ - **Artifact ID**: Kebab-case of application name
442
+ - **Group ID**: `com.bestinet.urp`
443
+ - **Base package**: `com.bestinet.urp.<artifactid>`
444
+ - **Application description**: From CLAUDE.md description
445
+ - **Modules**: From PRD.md module headings + model/MODEL.md
446
+ - **Database**: Auto-determined (see above)
447
+ - **Authentication**: Auto-determined (see above)
448
+ - **Scheduling**: Auto-determined (see above)
449
+ - **Messaging**: Auto-determined (see above)
450
+ - **Database name/credentials**: From ENVIRONMENT.md (root-level file with local environment credentials)
451
+
452
+ **Auto-derived from CLAUDE.md (Port Allocation table):**
453
+ - **Server port**: Look up the application's port from the `Port Allocation` table in the `Custom Applications` section of `CLAUDE.md`. Do NOT hardcode a default — the port MUST match the allocated port for this application.
454
+
455
+ **Optional (use sensible defaults if not found in context):**
456
+ - **API version prefix**: Default `/api/v1`
457
+ - **Log level**: Default `INFO` for application, `WARN` for frameworks
458
+
459
+ ## Generating the Specification
460
+
461
+ Once inputs are gathered from context files and optional components are determined,
462
+ generate the specification as a **multi-file output split by module**. Read the spec
463
+ template at `references/spec-template.md` for the exact structure and content of each
464
+ section. The template is the authoritative guide — follow it closely.
465
+
466
+ The specification is split into two categories:
467
+
468
+ 1. **Root `SPECIFICATION.md`** — Contains the Table of Contents, shared infrastructure,
469
+ and application-level sections that apply across all modules.
470
+ 2. **Per-module `<module-name>/SPEC.md`** — Each module gets its own folder with
471
+ a self-contained specification file covering that module's complete blueprint.
472
+
473
+ This split enables a coding agent to:
474
+ - First, scaffold the shared infrastructure from `SPECIFICATION.md`
475
+ - Then, implement each module independently by picking up its `<module>/SPEC.md`
476
+
477
+ **Important:** The generated spec must use **real module data** from the context files,
478
+ not generic placeholders. Specifically:
479
+
480
+ - **Modules** must use the actual module names from PRD.md and MODEL.md
481
+ (e.g., `jobDemand`, `candidateRegistration`, `employer` — not `module1`, `module2`)
482
+ - **Entity fields** must match the actual fields defined in the module model
483
+ files (e.g., `model/job-demand/model.md`), not placeholder `fieldOne`/`fieldTwo`
484
+ - **Service interfaces** must expose methods matching the actual user stories (e.g., if
485
+ a story says "search job demands by country", the service needs `searchByCountry()`)
486
+ - **REST endpoints** must map to the actual user stories (e.g., if a user story says
487
+ "view details of a job demand", there must be a `GET /api/v1/job-demands/{id}` endpoint)
488
+ - **Request/Response DTOs** must match what the user stories and module model define
489
+ - **Version tags**: Every user story ID, NFR ID, constraint ID in the traceability section
490
+ must include its version tag (e.g., `USHC00228 [v1.0.3]`).
491
+ - **Removed / Replaced items**: The traceability section must include a "Removed / Replaced"
492
+ subsection listing any deprecated items from previous versions.
493
+
494
+ ### Output Structure
495
+
496
+ ```
497
+ <app_folder>/context/specification/
498
+ ├── SPECIFICATION.md <- TOC + shared/application-level specs
499
+ ├── job-demand/
500
+ │ └── SPEC.md <- Module blueprint for Job Demand
501
+ ├── candidate-registration/
502
+ │ └── SPEC.md <- Module blueprint for Candidate Registration
503
+ ├── ... <- One folder per module from PRD.md
504
+ ```
505
+
506
+ ### What Goes in `SPECIFICATION.md` (Root)
507
+
508
+ The root file contains the TOC and all shared/application-level sections. These are the
509
+ sections that a coding agent implements **first** before any module work:
510
+
511
+ #### 1. Project Overview
512
+ Project metadata, application description, technology stack summary, the complete
513
+ list of API consumers/roles, and the **Module Index** —
514
+ a table listing every module with a link to its `<module>/SPEC.md` file.
515
+
516
+ #### 2. Maven Configuration
517
+ Complete `pom.xml` structure with all dependencies (core + selected conditional),
518
+ plugin configurations (MapStruct annotation processor, Spring Boot Maven plugin),
519
+ and property management.
520
+
521
+ #### 3. Application Configuration *(conditional content varies)*
522
+ A single `application.yml` (no profile-specific files like `application-dev.yml` or
523
+ `application-prod.yml`) covering database connection (MongoDB URI or JDBC datasource
524
+ depending on selection), auth settings (Keycloak Resource Server JWT validation if
525
+ selected, or self-issued JWT if selected), scheduling config (if selected), and logging
526
+ configuration. **All environment-sensitive values (ports, hostnames, credentials, URIs)
527
+ MUST use Spring's `${ENV_VAR:default}` syntax** to allow externalization via environment
528
+ variables while keeping sensible defaults for local development. Do NOT use Spring
529
+ profiles or profile-specific YAML files — environment differences are handled entirely
530
+ through environment variables (e.g., via `.env` file locally or system environment
531
+ variables in deployment).
532
+
533
+ #### 3a. Application-Specific Configuration (`app:` namespace)
534
+
535
+ All application-owned configuration — any config specific to THIS application, as
536
+ opposed to the Spring/Java ecosystem — MUST live under the top-level `app:` key in
537
+ `application.yml`. NEVER place application-specific keys under Spring framework
538
+ namespaces (`spring.*`, `server.*`, `management.*`, `logging.*`, `springdoc.*`) —
539
+ those are reserved for framework configuration.
540
+
541
+ **Grouping rule.** Organise the `app:` tree by module:
542
+ - **Cross-cutting values** (version, shared feature flags, shared timeouts, CORS,
543
+ shared security settings, shared messaging infrastructure, shared object-storage
544
+ settings) sit directly under `app.*` with no module prefix.
545
+ - **Per-module values** are grouped under `app.<module-kebab-case>.*`, one block
546
+ per module that needs runtime config. A module with a single config value still
547
+ gets its own block — do not flatten.
548
+ - **NEVER place module-specific keys at the YAML root** (e.g., top-level
549
+ `notification:`, `batch-job:`, `audit-trail:`). They MUST be nested under `app:`.
550
+
551
+ **Naming rule.** YAML keys use **kebab-case** (`from-address`, `retry-limit`,
552
+ `max-retry`). Spring Boot's relaxed binding maps them to camelCase Java fields
553
+ automatically. Do NOT use camelCase or snake_case in YAML.
554
+
555
+ **Binding rule.** For every `app.*` subtree (cross-cutting OR per-module), bind once
556
+ via `@ConfigurationProperties` on a **record** in the corresponding module's `config`
557
+ subpackage — or, for cross-cutting values, in the application-level `config`
558
+ subpackage. **Do NOT** inject individual values via `@Value("${app....}")` scattered
559
+ across beans. Bind once at the module boundary and inject the typed record.
560
+
561
+ **Environment-override rule.** Every `app.*` leaf value MUST use Spring's
562
+ `${ENV_VAR:default}` syntax so it can be overridden per environment without editing
563
+ YAML. Every referenced `${ENV_VAR}` MUST appear in the `.env` file generated in
564
+ section 3b.
565
+
566
+ **Example structure:**
567
+
568
+ ```yaml
569
+ app:
570
+ # Cross-cutting (no module prefix)
571
+ version: ${APP_VERSION:1.0.0}
572
+ cors:
573
+ allowed-origins: ${APP_CORS_ALLOWED_ORIGINS:http://localhost:3000}
574
+ security:
575
+ public-paths:
576
+ - /actuator/health
577
+ - /api/v1/info
578
+
579
+ # Per-module blocks — one per module with runtime config
580
+ notification:
581
+ email:
582
+ from-address: ${NOTIFICATION_FROM_ADDRESS:noreply@example.com}
583
+ retry-limit: ${NOTIFICATION_RETRY_LIMIT:3}
584
+ cleanup:
585
+ retention-days: ${NOTIFICATION_RETENTION_DAYS:30}
586
+ batch-job:
587
+ cleanup:
588
+ retention-days: ${BATCH_JOB_RETENTION_DAYS:90}
589
+ audit-trail:
590
+ cleanup:
591
+ retention-days: ${AUDIT_TRAIL_RETENTION_DAYS:365}
592
+ ```
593
+
594
+ **Example cross-cutting record (`app.*`):**
595
+
596
+ ```java
597
+ @ConfigurationProperties(prefix = "app")
598
+ public record AppProperties(String version, Cors cors, Security security) {
599
+ public record Cors(List<String> allowedOrigins) {}
600
+ public record Security(List<String> publicPaths) {}
601
+ }
602
+ ```
603
+
604
+ **Example per-module record (`app.<module>.*`):**
605
+
606
+ ```java
607
+ @ConfigurationProperties(prefix = "app.notification")
608
+ public record NotificationProperties(
609
+ Email email,
610
+ Cleanup cleanup
611
+ ) {
612
+ public record Email(String fromAddress, int retryLimit) {}
613
+ public record Cleanup(int retentionDays) {}
614
+ }
615
+ ```
616
+
617
+ Enable binding at the application root with `@ConfigurationPropertiesScan` on the
618
+ main application class, or register each record individually via
619
+ `@EnableConfigurationProperties` on a `@Configuration` class in the owning module.
620
+
621
+ **Mandatory cross-cutting values:**
622
+
623
+ | Key | Purpose | Binding |
624
+ |-----|---------|---------|
625
+ | `app.version` | Current application version; must match `pom.xml` `<version>` | `AppProperties.version()` |
626
+
627
+ Additional cross-cutting keys may be added as the application grows, but
628
+ `app.version` is always present.
629
+
630
+ **`app.version` specifics.** The `.env` file must include `APP_VERSION={version}`
631
+ with the actual version value. The `pom.xml` `<version>` element MUST also be set to
632
+ the same version value (e.g., `1.0.3`). When multiple versions were provided during
633
+ skill invocation, use the highest one. The REST API MUST expose the application
634
+ version in:
635
+
636
+ 1. **A health/info endpoint** (e.g., `GET /api/v1/info` or Spring Actuator
637
+ `/actuator/info`) returning `{"version": "1.0.3", ...}`. Inject `AppProperties`
638
+ into the controller and read the version via `appProperties.version()`.
639
+ 2. **Every API response envelope** — if the API uses a standard response wrapper,
640
+ include a `version` field (e.g., `{"version": "1.0.3", "data": {...}}`).
641
+
642
+ #### 3b. `.env` File Generation from ENVIRONMENT.md
643
+ Generate a `.env` file at the project root by reading `ENVIRONMENT.md` from the project root.
644
+ The `.env` file maps ENVIRONMENT.md credential and platform values to the environment variable
645
+ names referenced in `application.yml`. The spec must define the complete `.env` content
646
+ with actual values from ENVIRONMENT.md.
647
+
648
+ **Process:**
649
+ 1. Read `ENVIRONMENT.md` from the project root
650
+ 2. Extract credential values from `ENVIRONMENT.md` (`# Supporting 3rd Party Applications`
651
+ for database hosts, ports, usernames, passwords, plus Keycloak/RabbitMQ); read toolchain
652
+ paths (JDK, Maven) from `DEVTOOL.md`
653
+ 3. Map each value to the corresponding `${ENV_VAR}` name used in `application.yml`
654
+ 4. Generate the `.env` file with `KEY=value` pairs
655
+
656
+ **Example `.env` output (derived from ENVIRONMENT.md):**
657
+ ```properties
658
+ # Database
659
+ DB_HOST=localhost
660
+ DB_PORT=3306
661
+ DB_NAME=hub_supp
662
+ DB_USERNAME=root
663
+ DB_PASSWORD=B3st1n3t@2025
664
+
665
+ # Authentication (Keycloak)
666
+ KEYCLOAK_HOST=http://localhost:8180
667
+ KEYCLOAK_REALM=urp
668
+ KEYCLOAK_CLIENT_ID=hub-middleware-api
669
+
670
+ # Messaging (RabbitMQ)
671
+ RABBITMQ_HOST=localhost
672
+ RABBITMQ_PORT=5672
673
+ RABBITMQ_USERNAME=guest
674
+ RABBITMQ_PASSWORD=guest
675
+
676
+ # Server
677
+ SERVER_PORT=<port from CLAUDE.md Port Allocation table>
678
+
679
+ # Platform
680
+ JAVA_HOME=C:\Users\rashidee.rashid.BESTINET\.jdks\azul-21.0.9
681
+ MAVEN_HOME=C:\Users\rashidee.rashid.BESTINET\apache-maven-3.9.12
682
+ ```
683
+
684
+ **Rules:**
685
+ - Only include variables that are actually referenced in `application.yml`
686
+ - Use actual values from ENVIRONMENT.md — never use placeholders or `TODO`
687
+ - If ENVIRONMENT.md does not exist or a value is not found, use sensible defaults for local
688
+ development (e.g., `localhost`, default ports)
689
+ - The `.env` file is gitignored (already covered in `.gitignore`)
690
+
691
+ #### 4. `.gitignore`
692
+ Generate a `.gitignore` file at the project root that excludes all generated, downloaded,
693
+ and environment-specific files from version control.
694
+
695
+ #### 5. Package Structure
696
+ The complete directory tree rooted at the base package. The structure follows
697
+ Domain-Driven Design with Spring Modulith conventions, adapted for REST API
698
+ with `controller` subpackages (not `page`/`fragment`). Use actual module names.
699
+ Read `references/modulith-patterns.md` for the detailed module layout and inter-module
700
+ communication rules.
701
+
702
+ #### 6. Security Configuration *(conditional — include only if Auth != none)*
703
+ **If Auth = Keycloak (Resource Server):** OAuth2 Resource Server setup with JWT validation.
704
+ `SecurityFilterChain` with `oauth2ResourceServer(jwt -> ...)`. Keycloak JWT decoder
705
+ configuration. Role extraction from JWT claims (`realm_access`, `resource_access`).
706
+ Stateless session policy. CORS configuration. Read `references/security-patterns.md`
707
+ for the full security architecture.
708
+
709
+ **If Auth = JWT (self-issued):** Spring Security with custom JWT token provider.
710
+ `SecurityFilterChain` with `JwtAuthenticationFilter`. `JwtTokenProvider` for token
711
+ generation and validation. Stateless session policy. CORS configuration.
712
+
713
+ #### 7. REST API Conventions
714
+ Standardized REST API patterns including:
715
+ - URI naming conventions (plural nouns, kebab-case)
716
+ - API versioning strategy (`/api/v1/...` path prefix)
717
+ - Request/Response DTO patterns (Java records with Bean Validation)
718
+ - Standardized error response envelope (`ApiError` record)
719
+ - HTTP status code usage guidelines
720
+ - Pagination response structure (Spring Data `Page` serialization)
721
+ - HATEOAS considerations (optional, note when applicable)
722
+
723
+ Read `references/restapi-patterns.md` for the complete REST API patterns.
724
+
725
+ #### 8. Error Handling & Exceptions
726
+ Global `@RestControllerAdvice` exception handler returning standardized JSON error
727
+ responses. Base `ApiException` with status/code/message. `ResourceNotFoundException`,
728
+ `ValidationException`, `ConflictException` hierarchy. Consistent `ApiError` envelope
729
+ across all error responses.
730
+
731
+ #### 9. Pagination & Filtering Support
732
+ Standardized pagination using Spring Data `Pageable`. Sorting support via query
733
+ parameters. Dynamic filtering using Spring Data Specifications (JPA) or Query DSL
734
+ (MongoDB). Default page size, maximum page size configuration.
735
+
736
+ #### 10. Data Access *(conditional content varies)*
737
+ **If Database = MongoDB:** MongoDB repositories per module with Spring Data MongoRepository.
738
+ DTO mapping via MapStruct. All list endpoints paginated. Use actual collection names.
739
+
740
+ **If Database = PostgreSQL/MySQL:** JPA repositories per module with Spring Data
741
+ JpaRepository. JPA entities with `@Entity`/`@Table` annotations extending `BaseEntity`.
742
+ `BaseEntity` uses `@UuidGenerator(style = UuidGenerator.Style.TIME)` with
743
+ `@Column(columnDefinition = "CHAR(36)")` and `private String id`. Flyway migration scripts.
744
+ DTO mapping via MapStruct. All list endpoints paginated. Use actual table names.
745
+ **MySQL UUID rule:** All UUID primary keys and foreign keys use `CHAR(36)` in DDL.
746
+
747
+ **If Database = none:** In-memory data structures or stubs.
748
+
749
+ #### 11. API Documentation (SpringDoc OpenAPI)
750
+ SpringDoc OpenAPI configuration for auto-generating Swagger UI. Controller annotations
751
+ (`@Tag`, `@Operation`, `@ApiResponse`). Configuration in `application.yml`.
752
+
753
+ #### 12. Logging Strategy
754
+ SLF4J with Logback configuration, correlation ID filter (`X-Correlation-Id` header),
755
+ MDC context filter, per-module log levels.
756
+
757
+ #### 13. Scheduling and Batch Processing *(conditional — include only if Scheduling = yes)*
758
+ Quartz scheduler configuration with job store matching the selected database.
759
+ Read `references/batch-patterns.md` for the full scaffolding spec.
760
+
761
+ #### 14. Event-Driven Architecture
762
+ Spring Modulith application events for inter-module communication. Read
763
+ `references/modulith-patterns.md` for details.
764
+
765
+ #### 15. Messaging (RabbitMQ Pub/Sub) *(conditional — include only if Messaging = yes)*
766
+ Standalone RabbitMQ publisher/consumer services for inter-system communication.
767
+ Read `references/messaging-patterns.md` for the full messaging architecture.
768
+
769
+ #### 16. MapStruct Usage
770
+ Per-module MapStruct mapper conventions and mapping flow patterns.
771
+
772
+ #### 17. Testing Strategy
773
+ Overview of testing approach — unit tests (service layer with Mockito), integration tests
774
+ (controller layer with `@WebMvcTest` and MockMvc), security test utilities
775
+ (JWT mocking if Keycloak, or `@WithMockUser` if JWT), Spring Modulith module verification.
776
+
777
+ #### 18. Caching Strategy *(optional — include if applicable)*
778
+ HTTP caching headers (`Cache-Control`, `ETag`). Application-level caching with
779
+ Spring Cache and Caffeine. Cache eviction strategies.
780
+
781
+ #### 19. Idempotency *(optional — include if applicable)*
782
+ `Idempotency-Key` header pattern for mutating operations. Duplicate detection
783
+ and response replay.
784
+
785
+ #### 20. Reporting (JasperReports JRDesign API) *(conditional — include only if Reporting = yes)*
786
+ JasperReports infrastructure with fully programmatic report layout via JRDesign API — no
787
+ `.jrxml` XML templates. Report layouts are built entirely in Java code using `JasperDesign`,
788
+ `JRDesignBand`, `JRDesignStaticText`, `JRDesignTextField`, and `JRDesignField` classes.
789
+ Includes `ReportDefinition` interface with `buildDesign()` method for modules to implement,
790
+ `ReportDesignHelper` utility with static builders for common patterns (A4 portrait/landscape,
791
+ column headers, detail bands, page footers), `ReportService` orchestrating compile → fill →
792
+ export via `JRBeanCollectionDataSource`, `ReportRegistry` for auto-discovering and persisting
793
+ report definitions at startup, REST controller with report list, details, and generation
794
+ endpoints (`GET /api/v1/reports`, `POST /api/v1/reports/{id}/generate`), multi-format export
795
+ (PDF via OpenPDF, XLSX via Apache POI, CSV). Modules register reports by creating
796
+ `@Component` classes implementing `ReportDefinition` — each report builds its layout
797
+ programmatically and calls module services to produce DTOs (never repositories directly),
798
+ preserving Spring Modulith module boundaries. Read `references/reporting-patterns.md` for
799
+ the full reporting architecture.
800
+
801
+ ### What Goes in Each `<module>/SPEC.md` (Per-Module)
802
+
803
+ For EACH module from PRD.md and MODEL.md, create a folder named after the
804
+ module (kebab-case, e.g., `job-demand/`) and generate a `SPEC.md` inside it.
805
+
806
+ Each module `SPEC.md` is a **self-contained** blueprint that a coding agent can pick up
807
+ and implement independently (after the shared infrastructure is in place). It must include:
808
+
809
+ - **Header** with module name and a back-reference to the root `SPECIFICATION.md`
810
+ - **Traceability**: User story IDs, NFR IDs, constraint IDs, table/collection names
811
+ - **Service interface** with methods derived from user stories
812
+ - **Request DTOs** with Bean Validation annotations matching module model fields
813
+ - **Response DTOs** as Java records matching module model fields
814
+ - **Exception class** for module-specific errors
815
+ - **Entity/Document class** with fields from `model/<module>/model.md` and
816
+ `model/<module>/schemas.json`
817
+ - **Repository** with query methods matching user stories' data access patterns
818
+ - **MapStruct mapper** with mappings matching actual field names
819
+ - **Service implementation** with full CRUD logic
820
+ - **REST controller** with endpoints matching user stories (`@RestController`)
821
+ - **Complete code samples** for every component — continuous and copy-pasteable
822
+
823
+ **Separating REST API Layer from Messaging/Async Pipeline:**
824
+
825
+ When a module has BOTH user-facing endpoints (user stories) AND async processing NFRs
826
+ (e.g., RabbitMQ message consumption, message validation, ACK publishing, forwarding),
827
+ the SPEC.md MUST clearly separate these into distinct sections:
828
+
829
+ 1. **REST API sections** — service methods for CRUD operations (search, getById, create,
830
+ update, delete), REST controllers, request/response DTOs. These are driven by user
831
+ stories (USHCxxxxx).
832
+ 2. **Messaging Pipeline sections** — message consumer (`@RabbitListener`), message
833
+ validator, ACK publisher, forward publisher, queue configuration, domain events,
834
+ `processIncomingMessage()` service method. These are driven by NFRs (NFRHCxxxx).
835
+
836
+ > **MQ listener placement (mandatory).** Every `@RabbitListener` class generated for a
837
+ > module MUST be placed inside that module's `internal/` package
838
+ > (`{{base}}.{{module}}.internal`), package-private, alongside the controller. Shared
839
+ > messaging infrastructure (`RabbitMQMessagingConfig`, `RabbitMQPublisher`,
840
+ > `MessageConverterConfig`, cross-module event/command DTOs) lives in
841
+ > `shared/messaging/`, but that package must contain **no** `@RabbitListener`
842
+ > classes. See `references/messaging-patterns.md` § "Consumer Service (module-internal)"
843
+ > for the canonical pattern.
844
+
845
+ See `references/spec-template.md` for the exact template structure.
846
+
847
+ ## Changelog Append
848
+
849
+ After all specification files are successfully generated, append an entry to `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
850
+
851
+ 1. Read `<app_folder>/CHANGELOG.md`. If it does not exist, create it with:
852
+ ```markdown
853
+ # Changelog
854
+
855
+ - This file tracks all skill executions by version for this application.
856
+ - The highest version recorded here is the current application version.
857
+ - Skills MUST NOT execute for a version lower than the highest version in this file.
858
+
859
+ ---
860
+ ```
861
+ 2. Search for a `## {version}` heading matching the current version.
862
+ 3. If the section **exists**: append a new row to its table.
863
+ 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.
864
+ 5. Row format: `| {YYYY-MM-DD} | {application_name} | specgen-spring-jpa-restapi | {module or "All"} | Generated Spring Boot REST API technical specification |`
865
+ 6. **Never modify or delete existing rows.**
866
+
867
+ ## Output Format
868
+
869
+ The generated specification is a **folder of files**, not a single document:
870
+
871
+ ```
872
+ <app_folder>/context/specification/
873
+ ├── SPECIFICATION.md <- Root: TOC + shared/application-level specs
874
+ ├── <module-1>/
875
+ │ └── SPEC.md <- Module blueprint (self-contained)
876
+ ├── <module-2>/
877
+ │ └── SPEC.md
878
+ ├── <module-N>/
879
+ │ └── SPEC.md
880
+ ```
881
+
882
+ - **Root folder**: `<app_folder>/context/specification/`
883
+ - **Root file**: `SPECIFICATION.md`
884
+ - **Module folders**: One folder per module from PRD.md, named in kebab-case
885
+ - **Module files**: Each `SPEC.md` is self-contained with full code samples
886
+
887
+ **Sample code is mandatory.** Every component described in any spec file must include a
888
+ complete, self-explanatory code sample inside a fenced code block (Java, YAML, or JSON
889
+ as appropriate). The sample code must be continuous (not fragments stitched with "// ..."
890
+ gaps) and usable as a direct reference by a coding agent or developer.
891
+
892
+ ## Constraints
893
+
894
+ These constraints are non-negotiable. Every code sample in the generated spec must
895
+ follow them. If any constraint is violated, the spec is incorrect.
896
+
897
+ ### Universal Constraints (Always Apply)
898
+
899
+ **Do NOT use Lombok's `@Data` annotation — anywhere.** Use `@Getter` and `@Setter`
900
+ explicitly on every class that needs accessors. `@Data` generates `equals()`, `hashCode()`,
901
+ and `toString()` which cause problems with persistent entities, lazy-loaded
902
+ collections, and circular references. The spec must use `@Getter @Setter` consistently.
903
+
904
+ **Do NOT use field injection.** Every Spring-managed bean must use constructor injection.
905
+ Use Lombok's `@RequiredArgsConstructor` with `private final` fields. Never use `@Autowired`
906
+ on fields. This applies to services, controllers, configurations, filters, and any other
907
+ Spring component.
908
+
909
+ **Use Java records for DTOs.** All request and response DTOs should be Java records
910
+ (immutable, auto-generated `equals`/`hashCode`/`toString`). Records with Bean Validation
911
+ annotations for request DTOs.
912
+
913
+ **Use MapStruct for all object mapping.** Define MapStruct mappers per module with
914
+ `@Mapper(componentModel = "spring")`. Avoid handwritten mapping beyond simple passthroughs.
915
+
916
+ **Never expose JPA entities or MongoDB documents directly in API responses.** Always
917
+ map to response DTOs via MapStruct.
918
+
919
+ **All data listings must be paginated.** Every endpoint that returns a list must accept
920
+ `Pageable` parameters and return `Page<T>`. Never return unbounded lists.
921
+
922
+ **Use real module data from context files.** The spec must use actual field names,
923
+ collection/table names, module names, and user stories from the context files.
924
+
925
+ **REST API URI conventions:**
926
+ - Use plural nouns for resource names (e.g., `/api/v1/job-demands`, NOT `/api/v1/job-demand`)
927
+ - Use kebab-case for multi-word resources (e.g., `/api/v1/job-demands`, NOT `/api/v1/jobDemands`)
928
+ - Use `{id}` path variable for single resource access (e.g., `/api/v1/job-demands/{id}`)
929
+ - Maximum 2 levels of nesting (e.g., `/api/v1/employers/{id}/contacts`)
930
+ - Non-CRUD actions use sub-resource verbs (e.g., `POST /api/v1/orders/{id}/cancel`)
931
+
932
+ **Return correct HTTP status codes:**
933
+ - `200 OK` for successful retrieval and updates
934
+ - `201 Created` with `Location` header for resource creation
935
+ - `204 No Content` for successful deletion
936
+ - `400 Bad Request` for validation errors
937
+ - `401 Unauthorized` for missing/invalid credentials
938
+ - `403 Forbidden` for insufficient permissions
939
+ - `404 Not Found` for non-existent resources
940
+ - `409 Conflict` for state conflicts
941
+
942
+ ### Conditional Constraints
943
+
944
+ **If Auth = Keycloak (Resource Server):**
945
+ - **Use OAuth2 Resource Server (not OAuth2 Client).** The application validates JWT tokens
946
+ in the `Authorization: Bearer` header. Stateless — no HTTP session.
947
+ - **Do NOT manage users and roles in the application.** Keycloak owns user/role management.
948
+ The application only reads roles from JWT claims to enforce access control.
949
+
950
+ **If Auth = JWT (self-issued):**
951
+ - The application manages its own JWT token generation and validation.
952
+ - Stateless session policy. Custom `JwtAuthenticationFilter` extracts and validates tokens.
953
+
954
+ **If Scheduling = yes and Database = MongoDB:**
955
+ - **Use `io.fluidsonic.mirror` for Quartz MongoDB job store.**
956
+
957
+ **If Scheduling = yes and Database = PostgreSQL/MySQL:**
958
+ - Use the built-in Quartz JDBC job store with the selected relational database.
959
+
960
+ **If Messaging = yes:**
961
+ - Queue and exchange names for pub/sub messaging (`app.*`) must not collide with batch
962
+ partition queues (`batch.partition.*`). Use distinct prefixes for each concern.
963
+
964
+ ## Principles Embedded in the Spec
965
+
966
+ These principles should be woven into every section of the spec rather than listed
967
+ separately.
968
+
969
+ ### Always-Applicable Principles
970
+ - RESTful API design with standardized conventions
971
+ - JSON request/response with Jackson serialization
972
+ - Bean Validation at controller boundary (`@Valid`)
973
+ - Standardized error response envelope
974
+ - Event-driven inter-module communication via Spring Modulith events
975
+ - Domain-driven package structure (one module per bounded context)
976
+ - Separation of concerns (controller -> service -> repository)
977
+ - Constructor injection everywhere (`@RequiredArgsConstructor` + `private final`)
978
+ - `@Getter @Setter` instead of `@Data` on all entity/document classes
979
+ - Java records for all DTOs
980
+ - Single `application.yml` with environment variables for all environment-specific values (no profile-specific YAML files)
981
+ - Custom exception hierarchy with global error handling via `@RestControllerAdvice`
982
+ - Structured logging with correlation IDs
983
+ - OpenAPI documentation via SpringDoc
984
+ - Pagination on all list endpoints
985
+
986
+ ### Conditional Principles
987
+ - **If Auth = Keycloak:** OAuth2 Resource Server with JWT validation for all
988
+ authentication and authorization (stateless). No user/role management — external IdP only.
989
+ - **If Auth = JWT:** Custom JWT token provider with stateless authentication.
990
+ - **If Auth = none:** No security filter chain. All endpoints are publicly accessible.