@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,243 @@
1
+ ---
2
+ name: tracegen-matrix
3
+ model: claude-sonnet-4-6
4
+ effort: medium
5
+ description: >
6
+ Requirement-to-code traceability generator — links every PRD requirement ID (User Stories,
7
+ Non-Functional Requirements, Constraints) and bug code from a module's SPEC.md to the source
8
+ code that implements it, and writes a per-application context/TRACEABILITY.md matrix. Resolves
9
+ links primarily from the in-source CO2 traceability comments written by conductor-feature-develop
10
+ and conductor-defect (e.g. `Implements: USHM00003`, `Bug fixes: [BUG-024]`), with a name-based
11
+ source-scan fallback, and OPTIONAL precision enrichment from the codebase-memory knowledge graph
12
+ when that MCP server is installed. Works fully WITHOUT codebase-memory. Takes an application name
13
+ (mandatory), with optional version and module filters. Use when the user asks to "generate
14
+ traceability", "update the traceability matrix", "link requirements to code", "regenerate
15
+ TRACEABILITY.md", or when invoked as a sub-step by the feature/defect conductors after code or
16
+ bug-fix changes.
17
+ ---
18
+
19
+ # Tracegen — Traceability Matrix
20
+
21
+ Generate / update `<app_folder>/context/TRACEABILITY.md` — a per-application matrix linking every
22
+ PRD requirement ID (and bug code) to the source code that implements it. Two layers per module:
23
+ **module-level** (every ID of a module → that module's implementing code, complete coverage) and
24
+ **symbol-level** (specific ID → the specific file/symbol that implements it, where derivable).
25
+
26
+ This skill is **codebase-memory-OPTIONAL**. It resolves links from in-source traceability comments
27
+ and source scanning, and only uses the codebase-memory MCP for extra precision when present. It must
28
+ NEVER fail or produce an empty file just because codebase-memory is not installed.
29
+
30
+ ## When to Use This Skill
31
+
32
+ - Automatically, as the final traceability step of `conductor-feature-develop` (after all modules
33
+ for a version are implemented) and `conductor-defect` (after all bugs for a version are fixed).
34
+ - Manually, when a user asks to (re)generate or refresh the traceability matrix for an application.
35
+
36
+ ## Prerequisites
37
+
38
+ - `<app_folder>/context/PRD.md` — tagged requirement IDs (run `util-ustagger` first if untagged).
39
+ - `<app_folder>/context/specification/<module>/SPEC.md` — per-module specs with a Traceability
40
+ section listing the module's requirement IDs (and, for backends, the implementing package).
41
+ - Application source code under `<app_folder>/` (or the resolved `source:` path). If no source code
42
+ exists yet, the skill still produces a forward-traceability stub (see Workflow step 6c).
43
+
44
+ ## Version Gate
45
+
46
+ Before starting any work, resolve the application folder first (see Input Resolution), then check
47
+ `CHANGELOG.md` in the application folder (`<app_folder>/CHANGELOG.md`):
48
+
49
+ 1. If `<app_folder>/CHANGELOG.md` does not exist, skip this check (first-ever execution).
50
+ 2. If it exists, scan all `## vX.Y.Z` headings and determine the **highest version** via semantic
51
+ version comparison.
52
+ 3. If a `version:` argument was provided and the requested version **<** highest version → **STOP
53
+ immediately**. Print: `"Version {requested} is lower than the current application version
54
+ {highest} recorded in <app_folder>/CHANGELOG.md. Execution rejected."`
55
+ 4. If no `version:` argument was provided (regenerating against the current state), skip the gate.
56
+
57
+ ## Input Resolution
58
+
59
+ ```
60
+ /tracegen-matrix <application> [version:<version>] [module:<module>] [source:<source-code-path>]
61
+ ```
62
+
63
+ | Argument | Required | Description |
64
+ |----------|----------|-------------|
65
+ | `<application>` | Yes | Application name OR an already-resolved `<app_folder>` path. Matched against root-level application folders. |
66
+ | `version:<version>` | No | Single version (e.g. `version:v1.2.0`). Used for the Version Gate and to label the changelog row and the file header. Does NOT filter which IDs are linked — the matrix always reflects the full current PRD + code. |
67
+ | `module:<module>` | No | If provided, (re)generate ONLY that module's section in TRACEABILITY.md, preserving all other sections. If omitted, regenerate the whole file. |
68
+ | `source:<path>` | No | Path where source code resides. Defaults to `<app_folder>` (same convention as the conductors). |
69
+
70
+ ### Application Folder Resolution
71
+
72
+ 1. If `<application>` is already a path to an existing folder containing a `context/` subfolder,
73
+ use it directly as `<app_folder>` (this is how the conductors pass it).
74
+ 2. Otherwise, list root-level application folders; strip any leading `<number>_` prefix; match the
75
+ provided name case-insensitively (accept snake_case, kebab-case, or title-case).
76
+ 3. If no match is found, list available applications and **stop**.
77
+
78
+ ### Auto-Resolved Paths
79
+
80
+ | Item | Resolved Path |
81
+ |------|---------------|
82
+ | PRD.md | `<app_folder>/context/PRD.md` |
83
+ | Specifications | `<app_folder>/context/specification/<module>/SPEC.md` |
84
+ | Develop tracking | `<app_folder>/context/develop/<module>/IMPLEMENTATION_MODULE.md` |
85
+ | Source code | `<source-code-path>/` (defaults to `<app_folder>/`) |
86
+ | Output | `<app_folder>/context/TRACEABILITY.md` |
87
+
88
+ ## Resolution Strategy (codebase-memory is OPTIONAL)
89
+
90
+ Pick code references for each requirement ID using the following cascade. Combine the layers — do
91
+ not stop at the first that yields a hit.
92
+
93
+ 1. **In-source traceability comments (PRIMARY — no MCP, deterministic).**
94
+ `conductor-feature-develop` stamps every source file it creates with a top-of-file comment
95
+ listing the requirement codes it implements, and `conductor-defect` appends bug codes:
96
+ ```
97
+ Implements: USHM00003, USHM00006
98
+ NFR: NFRHM0003
99
+ Constraints: CONSHM003
100
+ Bug fixes: [BUG-024]
101
+ ```
102
+ For each requirement / bug code, scan the source tree for that exact code. Every file whose
103
+ top-of-file comment contains the code is an implementer of it. Map file → symbol using the
104
+ primary declared type/function in that file (class/interface/component name, usually = filename).
105
+ - Recommended scan: ripgrep over source files, excluding `context/`, build output, dependencies,
106
+ and tests — e.g. search the codes within the first ~20 lines / comment blocks of each file.
107
+
108
+ 2. **Name-based source scan (FALLBACK — no MCP).**
109
+ When a module's IDs produce NO comment hits (e.g. legacy code authored before the traceability-
110
+ comment rule, as in pre-existing applications), resolve at module granularity instead:
111
+ - Backend: read the module's `SPEC.md` `Package` (e.g. `my.app.module.foo`) and locate the
112
+ matching source directory; collect its controller / service / repository / entity / mapper /
113
+ DTO files.
114
+ - Frontend: read the module's `SPEC.md` named pages/components/hooks/api and `Mockup Screens`,
115
+ then locate the matching source files by name under the app's `src/`.
116
+ Every ID of the module links to this resolved set (module-level layer).
117
+
118
+ 3. **codebase-memory enrichment (OPTIONAL — only if the MCP is installed).**
119
+ If the `codebase-memory` MCP tools (`search_graph`, `search_code`) are available in this session,
120
+ resolve each matched file to its exact graph `qualified_name` for precise, navigable anchors, and
121
+ use the graph to discover additional same-module symbols. If the MCP is NOT available, skip this
122
+ step entirely and use **file-path references** instead (see Reference Format). The matrix content
123
+ and structure are identical either way; only the anchor precision differs.
124
+
125
+ **Hard rule:** never invent a reference. A reference must come from a real comment hit, a real
126
+ source file located on disk, or (when present) a real codebase-memory node. If a specific symbol
127
+ cannot be resolved, leave the symbol-level cell as `—`; the module-level layer still covers it.
128
+
129
+ ### Reference Format
130
+
131
+ - **codebase-memory present** → use the full graph `qualified_name` (exact node anchor).
132
+ - **codebase-memory absent** → use a repo-relative path with optional symbol suffix:
133
+ `path/to/File.java#ClassName` (or `src/features/foo/pages/FooPage.tsx#FooPage`).
134
+
135
+ Record which mode was used in the file header so readers know how to interpret the anchors.
136
+
137
+ ## Workflow
138
+
139
+ 1. **Resolve inputs** — application folder, source path, optional version/module (Input Resolution).
140
+ Apply the Version Gate.
141
+ 2. **Detect capabilities** — record: (a) is the codebase-memory MCP available? (b) do source files
142
+ carry in-source traceability comments? (sample a few known IDs). These two booleans select the
143
+ active resolution layers and the Reference Format.
144
+ 3. **Enumerate modules** — glob `<app_folder>/context/specification/*/SPEC.md`. If `module:` was
145
+ provided, restrict to that module.
146
+ 4. **Extract requirement IDs per module** — from each `SPEC.md` Traceability section: User Story,
147
+ NFR, and Constraint IDs with their version tags. Also collect the module's `Package` (backend)
148
+ or named components (frontend), and any `[BUG-XXX]` codes recorded for the module in PRD.md's
149
+ `### Bug` section. Cross-check `<app_folder>/context/develop/<module>/IMPLEMENTATION_MODULE.md`
150
+ when present for explicit ID→symbol hints.
151
+ 5. **Resolve code references** — apply the Resolution Strategy cascade to build, per module:
152
+ - the **module-level** set (the module's implementing files/symbols), and
153
+ - **symbol-level** links for the specific IDs where a comment hit or SPEC/IMPLEMENTATION naming
154
+ pins a specific file/symbol. Mark symbol-level links inferred when derived from naming rather
155
+ than an explicit comment hit.
156
+ 6. **Write TRACEABILITY.md** using the Output structure below.
157
+ - a. Whole-file regeneration when no `module:` filter.
158
+ - b. Single-module update when `module:` is given — replace only that module's `## <Module>`
159
+ section, preserving every other section and the file header/summary (recompute the summary).
160
+ - c. If NO source code exists for the app yet, still write the file: list every module's full ID
161
+ inventory with all symbol cells `—`, plus the module's *intended* SPEC-named symbols as plain
162
+ (non-anchor) references, and a prominent NOT-YET-IMPLEMENTED banner. This preserves forward
163
+ traceability and is regenerated to real anchors once code exists.
164
+ 7. **Changelog Append** — see below.
165
+ 8. **Print a summary** — modules processed, total IDs linked (US/NFR/CON counts), symbol-level link
166
+ count, resolution mode used (comments / name-based / graph-enriched), and any unresolved IDs.
167
+
168
+ ## Output
169
+
170
+ A single file: `<app_folder>/context/TRACEABILITY.md`.
171
+
172
+ ```markdown
173
+ # Traceability — <Application Display Name>
174
+
175
+ > **Purpose**: links every PRD requirement ID (User Stories, NFRs, Constraints) and bug code from
176
+ > `context/PRD.md` + `context/specification/*/SPEC.md` to the source code that implements it.
177
+ > **Resolution mode**: <in-source comments | name-based scan | graph-enriched> — anchors are
178
+ > <codebase-memory qualified_names | repo-relative file paths>.
179
+ > **Two layers**: _module-level_ — every ID of a module maps to that module's implementing code
180
+ > (complete); _symbol-level_ — specific ID → the specific file/symbol where derivable (partial,
181
+ > `(inferred)` when from naming rather than an in-source comment).
182
+ > **Maintenance**: regenerated by `tracegen-matrix` at the end of `conductor-feature-develop` and
183
+ > `conductor-defect`; re-run manually after significant code moves.
184
+
185
+ ---
186
+
187
+ ## <Module Name> · prefix `<PFX>` · package `<package or n/a>`
188
+
189
+ **Module-level code** (every ID below maps to these):
190
+ - `<reference>` — <role e.g. Controller / Page>
191
+ - `<reference>` — <role e.g. ServiceImpl / Hook>
192
+ - …
193
+
194
+ **Requirement links:**
195
+
196
+ | ID | Type | Ver | Symbol-level implementation |
197
+ |----|------|-----|-----------------------------|
198
+ | USHM00003 | US | v1.0.0 | `<reference>` |
199
+ | NFRHM0003 | NFR | v1.0.0 | — |
200
+ | CONSHM003 | CON | v1.0.0 | `<reference>` (inferred) |
201
+ | BUG-024 | BUG | v1.0.1 | `<reference>` |
202
+
203
+ ---
204
+
205
+ (repeat per module)
206
+
207
+ ## Summary
208
+ - Modules: <N>
209
+ - IDs linked: <N> (US <a>, NFR <b>, CON <c>, BUG <d>)
210
+ - Symbol-level links: <N>
211
+ - Resolution mode: <comments | name-based | graph-enriched>
212
+ - Unresolved: <short list or "none">
213
+ ```
214
+
215
+ Type abbreviations: US = User Story, NFR = Non-Functional Requirement, CON = Constraint, BUG = bug
216
+ fix code.
217
+
218
+ ## Changelog Append
219
+
220
+ After the matrix is successfully written, append an entry to `<app_folder>/CHANGELOG.md`:
221
+
222
+ 1. If `<app_folder>/CHANGELOG.md` does not exist, create it with the standard CO2 changelog header.
223
+ 2. Determine the version label: the `version:` argument if provided, else the highest version in
224
+ the changelog, else `v1.0.0`.
225
+ 3. Search for a `## {version}` heading. If it exists, append a new row; if not, insert a new section
226
+ after the `---` below the header and before any existing `## vX.Y.Z` section (newest-first).
227
+ 4. Row format: `| {YYYY-MM-DD} | {application_name} | tracegen-matrix | {module or "All"} | Regenerated TRACEABILITY.md — {N} IDs linked ({fine} symbol-level), mode: {resolution-mode} |`
228
+ 5. **Never modify or delete existing rows.**
229
+
230
+ ## Constraints
231
+
232
+ - **codebase-memory is OPTIONAL.** The skill MUST complete and produce a useful TRACEABILITY.md
233
+ when the codebase-memory MCP is absent, using in-source comments and source scanning. Treat the
234
+ graph purely as an enrichment for anchor precision.
235
+ - **Never fabricate a reference.** Every anchor must trace to a real in-source comment, a real file
236
+ on disk, or a real graph node. Unresolved symbol-level cells are `—`.
237
+ - **Preserve unrelated sections.** With a `module:` filter, only that module's section may change.
238
+ - **Do not modify source code, PRD.md, SPEC.md, or any other artifact.** This skill only writes
239
+ `TRACEABILITY.md` and appends one `CHANGELOG.md` row.
240
+ - **Preserve requirement tags verbatim.** Use the 9-character `util-ustagger` codes and `[BUG-XXX]`
241
+ codes exactly as they appear; never reformat or invent codes.
242
+ - **Idempotent.** Re-running with the same inputs reproduces the same matrix (modulo newly added
243
+ code or requirements).
@@ -0,0 +1,422 @@
1
+ ---
2
+ name: util-preparek8senv
3
+ model: claude-sonnet-4-6
4
+ effort: medium
5
+ description: >
6
+ Prepare Kubernetes environment infrastructure by generating K8s manifests for all 3rd party
7
+ supporting applications for a single target environment defined in CLAUDE.md. Creates/updates
8
+ ENVIRONMENT.md with per-environment configs and credentials, then generates persistent
9
+ StatefulSet-based K8s manifests for each 3rd party application (databases, message queues,
10
+ caches, SSO, API gateways, etc.) directly in the `environment/` folder. Since the
11
+ `environment/` folder is gitignored, each machine maintains its own independent copy.
12
+ Ensures all services are remotely accessible using tools from DEVTOOL.md.
13
+ Trigger on keywords: "prepare k8s environment", "prepare kubernetes", "setup k8s infra",
14
+ "generate k8s manifests for 3rd party", "prepare environment", "setup infrastructure",
15
+ "prepare k8s", "init k8s environment", "scaffold k8s environment".
16
+ Accepts an optional environment argument to select which Kubernetes environment to generate for.
17
+ ---
18
+
19
+ # Util Prepare K8s Environment
20
+
21
+ Prepare Kubernetes infrastructure by generating K8s manifests for all 3rd party supporting
22
+ applications for a **single target environment**. Manifests are generated directly in the
23
+ `environment/` folder (no per-environment subfolders). Since the `environment/` folder is
24
+ gitignored, each machine maintains its own independent copy of the manifests.
25
+
26
+ ## Input Resolution
27
+
28
+ This skill accepts an optional `<environment>` argument:
29
+
30
+ ```
31
+ /util-preparek8senv [environment]
32
+ ```
33
+
34
+ | Argument | Required | Example | Description |
35
+ |----------|----------|---------|-------------|
36
+ | `<environment>` | No | `home_server` | Target environment name — must match a Kubernetes environment in CLAUDE.md |
37
+
38
+ If omitted:
39
+ - If CLAUDE.md defines exactly **one** Kubernetes environment → auto-select it.
40
+ - If CLAUDE.md defines **multiple** Kubernetes environments → list them and ask the user to specify.
41
+
42
+ The environment name is matched **case-insensitively** against the environment headings in CLAUDE.md, accepting snake_case, kebab-case, or title-case input (e.g., `home_server`, `home-server`, `Home Server` all match `## Home Server`).
43
+
44
+ All other configuration is read from the project root:
45
+
46
+ | File | Purpose | Required |
47
+ |------|---------|----------|
48
+ | `CLAUDE.md` | Project detail, environments, 3rd party applications, rules | Yes |
49
+ | `ENVIRONMENT.md` | Per-environment configs and credentials for 3rd party apps | Created if missing |
50
+ | `DEVTOOL.md` | Local development tools (CLI paths for kubectl, mysql, mongosh, etc.) | Yes |
51
+
52
+ ## Workflow
53
+
54
+ ### 1. Parse CLAUDE.md
55
+
56
+ Read CLAUDE.md from the project root and extract:
57
+
58
+ - **Project Code**: From `# Project Detail` → Project Code (e.g., `URP`). Used as K8s namespace (lowercase: `urp`).
59
+ - **Environment list**: Each `## <Environment Name>` heading under `# Environment` is an environment. Extract:
60
+ - Environment name (e.g., "Localhost", "Home Server")
61
+ - Snake_case identifier for folder name (e.g., `localhost`, `home_server`)
62
+ - Domain name (e.g., `localhost`, `home.server`) — from the `- Domain:` field
63
+ - Deployment Type (e.g., `Manual`, `Kubernetes`) — from the `- Deployment Type:` field
64
+ - Operating system, Kubernetes distribution/version (for Kubernetes environments)
65
+ - SSH configuration (IP, port) — for remote environments
66
+ - Kube config reference — if mentioned
67
+ - **3rd Party Application list**: Each `## <Application Name>` heading under `# Supporting 3rd Party Applications`. Extract:
68
+ - Application name (e.g., "Hub Cache", "Hub Core Database")
69
+ - Technology and version (e.g., "Redis version 7.2.1", "MongoDB version 7.0.6")
70
+ - Databases/database names if applicable
71
+ - Dependencies (`- Depends on:` list)
72
+ - **Credential rules**: From `# Rules` section — standard username/password format for new accounts.
73
+
74
+ **Stop conditions:**
75
+ - If `# Environment` section is missing or has no environments → stop with error
76
+ - If `# Supporting 3rd Party Applications` section is missing or has no entries → stop with error
77
+ - If `DEVTOOL.md` does not exist → stop with error
78
+ - If no environment has `Deployment Type: Kubernetes` → stop with error: "No Kubernetes environments found in CLAUDE.md. This skill only generates manifests for environments with Deployment Type: Kubernetes."
79
+
80
+ ### 1b. Target Environment Selection
81
+
82
+ After parsing all environments, identify Kubernetes environments and select the target:
83
+
84
+ 1. Filter environments to those with `Deployment Type: Kubernetes`.
85
+ 2. If the user provided an `<environment>` argument, match it against the Kubernetes environments (case-insensitively, accepting snake_case, kebab-case, or title-case).
86
+ - If matched → use it as the target environment.
87
+ - If not matched → list available Kubernetes environments and stop.
88
+ 3. If no argument was provided:
89
+ - If exactly **one** Kubernetes environment exists → auto-select it.
90
+ - If **multiple** exist → list them and ask the user to specify.
91
+
92
+ The selected environment is the **target environment** used for Step 2 (ENVIRONMENT.md sync) and Step 3 (K8s manifest generation). Only this one environment is processed.
93
+
94
+ ### 2. Sync ENVIRONMENT.md
95
+
96
+ #### 2a. ENVIRONMENT.md Does Not Exist
97
+
98
+ Create a new `ENVIRONMENT.md` at the project root using the template structure below.
99
+
100
+ #### 2b. ENVIRONMENT.md Already Exists
101
+
102
+ Treat as **append-only**:
103
+ 1. Parse the existing ENVIRONMENT.md to identify which environment sections (`# <Environment Name>`) and which service subsections (`## <Service Name>`) exist.
104
+ 2. Compare against CLAUDE.md:
105
+ - **Missing environment section**: Append the entire environment section with all 3rd party app subsections.
106
+ - **Missing service subsection** under an existing environment: Append the missing service subsection at the end of that environment section.
107
+ - **Missing config keys** under an existing service: Append the missing key lines with `TODO` placeholder values.
108
+ - **Existing config keys**: Do **nothing** — leave existing values as-is, even if they differ from defaults.
109
+ 3. **Never remove, modify, or reorder** existing sections, headings, or values.
110
+
111
+ #### 2c. ENVIRONMENT.md Template
112
+
113
+ ```markdown
114
+ # Context
115
+ - This document contains environment-specific variables and credentials for all 3rd party
116
+ supporting applications used in this project.
117
+ - Organized by environment as defined in CLAUDE.md.
118
+ - **This file must NOT be committed to version control.**
119
+
120
+ ---
121
+
122
+ # {{Environment Name}}
123
+ {{For localhost:}}
124
+ - Kube Config: `{{path to kube config or TODO}}`
125
+ {{For remote environments:}}
126
+ - SSH Credentials:
127
+ - Username: `{{username or TODO}}`
128
+ - Password: `{{password or TODO}}`
129
+ - Kube Config: `{{path to kube config or TODO}}`
130
+
131
+ ## {{3rd Party Application Name}}
132
+ - {{Technology}} version {{version}}
133
+ {{Technology-specific fields — see Section 2d}}
134
+
135
+ ---
136
+ ```
137
+
138
+ #### 2d. Technology-Specific Config Fields
139
+
140
+ For each 3rd party application, include config fields based on its technology type.
141
+ Use credential rules from CLAUDE.md `# Rules` section for default username/password values.
142
+ Use `TODO` for any value not yet known.
143
+
144
+ | Technology | Config Fields |
145
+ |-----------|---------------|
146
+ | MongoDB | Host, Port, Username, Password, Databases (list) |
147
+ | MySQL | Host, Port, Username, Password, Databases (list) |
148
+ | Redis | Host, Port, Password, Database Index |
149
+ | RabbitMQ | Host, AMQP Port, Admin Port, Username, Password, Vhost |
150
+ | Keycloak | Host, HTTP Port, Admin Username, Admin Password, Realm, Client IDs |
151
+ | Meilisearch | Host, Port, Master Key |
152
+ | Kong | Proxy Host, Proxy Port, Admin Host, Admin Port |
153
+ | Mailcatcher | SMTP Host, SMTP Port, HTTP Port |
154
+
155
+ #### 2e. Custom Docker Image Override
156
+
157
+ Any service in ENVIRONMENT.md may optionally specify a custom Docker image using the `Docker Image`
158
+ field:
159
+
160
+ - **`Docker Image`**: A Docker image reference (registry, name, and tag).
161
+ Format: `- Docker Image: <image-reference>`
162
+ Example: `- Docker Image: gilacode/hub_single_sign_on:26.5.4`
163
+ The image will be used as-is in the K8s manifest with `imagePullPolicy: IfNotPresent`.
164
+
165
+ When the `Docker Image` field is not present, the skill falls back to the **official Docker Hub
166
+ image** with the exact version from CLAUDE.md (default behavior).
167
+
168
+ This field is **per-environment** in ENVIRONMENT.md — one environment may use a custom image
169
+ while another uses the official image. The skill reads the target environment's section.
170
+
171
+ **Default values:**
172
+ - Host: use the **Domain** from the environment's `- Domain:` field in CLAUDE.md (e.g., `localhost`, `home.server`). If no Domain is specified, fall back to `localhost` for localhost environments or the SSH IP for remote environments. If neither is available, use `TODO`.
173
+ - Ports: technology defaults (MongoDB: `27017`, MySQL: `3306`, Redis: `6379`, RabbitMQ AMQP: `5672`, RabbitMQ Admin: `15672`, Keycloak: `8180`, Meilisearch: `7700`, Kong Proxy: `8000`, Kong Admin: `8001`, Mailcatcher SMTP: `1025`, Mailcatcher HTTP: `1080`)
174
+ - Username/Password: from CLAUDE.md rules section (default: `bestrnd` / `B3st1n3t@2025`), or technology defaults (e.g., RabbitMQ: `guest`/`guest`, MongoDB: no auth)
175
+
176
+ ### 3. Generate K8s Manifests
177
+
178
+ #### 3a. Ensure Folder Structure
179
+
180
+ 1. Check if `environment/` folder exists at the project root. If not, create it.
181
+
182
+ Resulting structure (all manifests directly in `environment/`):
183
+ ```
184
+ environment/
185
+ namespace.yaml
186
+ smtp_server.yaml
187
+ hub_cache_pvc.yaml
188
+ hub_cache.yaml
189
+ hub_core_database_pvc.yaml
190
+ hub_core_database.yaml
191
+ ...
192
+ ```
193
+
194
+ #### 3b. Generate Namespace Manifest
195
+
196
+ Create `environment/namespace.yaml`:
197
+ - Namespace name: project code in lowercase (e.g., `urp`)
198
+ - Identical regardless of environment
199
+
200
+ #### 3c. Generate PVC Manifests (Separate Files)
201
+
202
+ For each 3rd party application that requires data persistence (databases, message queues, caches),
203
+ generate a **separate** PVC file: `environment/<service_snake_case>_pvc.yaml`.
204
+
205
+ **Why separate files:** If the PVC is bundled inside the service manifest, running
206
+ `kubectl delete -f <service>.yaml` followed by `kubectl apply -f <service>.yaml` would delete
207
+ and recreate the PVC, destroying all persisted data. Keeping the PVC in its own file ensures
208
+ that `kubectl delete -f <service>.yaml` only removes the StatefulSet, ConfigMap, Secret, and
209
+ Services — the PVC (and its data) remains untouched.
210
+
211
+ The PVC file contains only the PersistentVolumeClaim resource:
212
+
213
+ ```yaml
214
+ # ==============================================================================
215
+ # {{Application Name}} ({{Technology}}) — PersistentVolumeClaim
216
+ # ==============================================================================
217
+ ---
218
+ apiVersion: v1
219
+ kind: PersistentVolumeClaim
220
+ metadata:
221
+ name: {{service-name}}-pvc
222
+ namespace: {{namespace}}
223
+ labels:
224
+ app: {{service-name}}
225
+ project: {{project-code}}
226
+ environment: {{environment}}
227
+ spec:
228
+ accessModes:
229
+ - ReadWriteOnce
230
+ resources:
231
+ requests:
232
+ storage: {{size — see Section 3d for defaults per technology}}
233
+ ```
234
+
235
+ #### 3d-svc. Generate Per-Service Manifests
236
+
237
+ For each 3rd party application, generate `environment/<service_snake_case>.yaml` containing a multi-document YAML (separated by `---`) with:
238
+
239
+ 1. **ConfigMap** — non-sensitive configuration (hostnames, ports, database names, vhosts)
240
+ 2. **Secret** — sensitive configuration (passwords, admin credentials), base64-encoded. Read actual values from ENVIRONMENT.md for the matching environment.
241
+ 3. **StatefulSet** (NOT Deployment) — ensures persistent identity, stable network IDs, and ordered scaling:
242
+ - **Image resolution** (checked in ENVIRONMENT.md for the target environment — see Section 2e):
243
+ 1. If `Docker Image` is specified → use the exact image reference as-is. Set `imagePullPolicy: IfNotPresent`. Do NOT include `args` or `command` — the custom image's `ENTRYPOINT`/`CMD` handles startup.
244
+ 2. Otherwise → use the official Docker Hub image with the exact version from CLAUDE.md (e.g., `mongo:7.0.6`, `mysql:8.4`). Include `args`/`command` as needed by the technology.
245
+ - `volumeMounts` referencing the PVC (defined in the separate `_pvc.yaml` file) for data persistence
246
+ - `env` or `envFrom` referencing ConfigMap and Secret
247
+ - Resource requests/limits (sensible defaults per technology)
248
+ - Readiness and liveness probes (technology-appropriate)
249
+ - `serviceName` matching the headless Service name
250
+ 4. **Service** — two services per StatefulSet:
251
+ - **Headless Service** (`clusterIP: None`) — for StatefulSet stable DNS
252
+ - **NodePort Service** — for remote access from developer machines and CLI tools.
253
+ Use a deterministic NodePort assignment strategy to avoid conflicts:
254
+ - Base port = `30000 + (index * 10)` where index is the service's position in alphabetical order
255
+ - Map each technology's primary port to the NodePort
256
+ 5. **Init containers** (if the service depends on another service):
257
+ - E.g., Keycloak depends on Hub Support Database — add an init container that waits for MySQL to be ready before starting Keycloak
258
+
259
+ **Important:** The service manifest must NOT contain the PersistentVolumeClaim. It only references the PVC by `claimName` in the StatefulSet's `volumes` section.
260
+
261
+ #### 3d. Technology-Specific Manifest Details
262
+
263
+ **MongoDB:**
264
+ - Image: `mongo:{version}`
265
+ - PVC: 5Gi default
266
+ - Ports: 27017
267
+ - Env: `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD` (from Secret, or skip if no auth)
268
+ - Init script: create databases listed in CLAUDE.md via ConfigMap-mounted init script
269
+ - Probe: `mongosh --eval "db.adminCommand('ping')"`
270
+
271
+ **MySQL:**
272
+ - Image: `mysql:{version}`
273
+ - PVC: 5Gi default
274
+ - Ports: 3306
275
+ - Env: `MYSQL_ROOT_PASSWORD` (from Secret)
276
+ - Init script: create databases listed in CLAUDE.md via ConfigMap-mounted `/docker-entrypoint-initdb.d/` script
277
+ - Probe: `mysqladmin ping -h localhost`
278
+
279
+ **Redis:**
280
+ - Image: `redis:{version}`
281
+ - PVC: 1Gi default
282
+ - Ports: 6379
283
+ - Env: `REDIS_PASSWORD` (from Secret, optional — skip if no auth)
284
+ - Probe: `redis-cli ping`
285
+
286
+ **RabbitMQ:**
287
+ - Image: `rabbitmq:{version}-management` (include management plugin for admin UI)
288
+ - PVC: 2Gi default
289
+ - Ports: 5672 (AMQP), 15672 (Management UI)
290
+ - Env: `RABBITMQ_DEFAULT_USER`, `RABBITMQ_DEFAULT_PASS`, `RABBITMQ_DEFAULT_VHOST` (from Secret/ConfigMap)
291
+ - Probe: `rabbitmq-diagnostics -q ping`
292
+
293
+ **Keycloak:**
294
+ - Image resolution: check ENVIRONMENT.md for `Docker Image` first (see Section 2e).
295
+ - If custom image (e.g., `gilacode/hub_single_sign_on:26.5.4`): use the specified image name; do NOT add `args: ["start-dev"]` (custom image handles startup). Use HTTP Port from ENVIRONMENT.md (typically `8180` for custom builds) for containerPort, probes, and services. Add `KC_HTTP_PORT` to ConfigMap.
296
+ - If no custom image: `quay.io/keycloak/keycloak:{version}` with `args: ["start-dev"]`. Default port `8080`.
297
+ - PVC: none (stateless — state is in the database)
298
+ - Env: `KC_DB`, `KC_DB_URL`, `KC_DB_USERNAME`, `KC_DB_PASSWORD`, `KC_HEALTH_ENABLED`, `KC_HTTP_ENABLED`, `KC_HOSTNAME_STRICT`, `KC_HTTP_PORT`, `KEYCLOAK_ADMIN`, `KEYCLOAK_ADMIN_PASSWORD` (from Secret/ConfigMap)
299
+ - Init container: wait for MySQL (Hub Support Database) to be ready
300
+ - Probe: HTTP GET `/health/ready` on the configured HTTP port
301
+
302
+ **Kong API Gateway:**
303
+ - Image: `kong:{version}`
304
+ - PVC: none (stateless — DB-less mode or state in database)
305
+ - Ports: 8000 (Proxy), 8001 (Admin API)
306
+ - Env: `KONG_DATABASE=off`, `KONG_PROXY_LISTEN=0.0.0.0:8000`, `KONG_ADMIN_LISTEN=0.0.0.0:8001`
307
+ - Probe: HTTP GET `/status` on admin port
308
+
309
+ **Mailcatcher (SMTP):**
310
+ - Image: `schickling/mailcatcher:{version}` or `sj26/mailcatcher:latest` (if specific version unavailable)
311
+ - PVC: none (ephemeral — mail is not persisted)
312
+ - Ports: 1025 (SMTP), 1080 (HTTP UI)
313
+ - Probe: TCP check on port 1025
314
+
315
+ **Meilisearch:**
316
+ - Image: `getmeili/meilisearch:v{version}`
317
+ - PVC: 2Gi default
318
+ - Ports: 7700
319
+ - Env: `MEILI_MASTER_KEY` (from Secret)
320
+ - Probe: HTTP GET `/health`
321
+
322
+ #### 3e. Create or Update Logic
323
+
324
+ For each service, there are up to two files to manage in `environment/`:
325
+ - `<service_snake_case>_pvc.yaml` — PVC file (only for services that require persistence)
326
+ - `<service_snake_case>.yaml` — service manifest (ConfigMap, Secret, StatefulSet, Services)
327
+
328
+ For each file:
329
+
330
+ 1. **If the file does not exist** (CREATE mode): Generate and write the manifest.
331
+ 2. **If it already exists** (UPDATE mode):
332
+ - Read the existing manifest
333
+ - Compare against current CLAUDE.md/ENVIRONMENT.md values for the target environment:
334
+ - Version changed → update image tag
335
+ - New databases added → update init scripts
336
+ - Credentials changed in ENVIRONMENT.md → update Secret values
337
+ - New dependencies → add init containers
338
+ - Storage size changed → update PVC (in `_pvc.yaml` only)
339
+ - Preserve any resources marked with `# CUSTOM:` comments
340
+ - Update only the parts that changed
341
+ - Log what was changed
342
+
343
+ #### 3f. Remote Accessibility
344
+
345
+ All NodePort Services must be accessible from the developer's machine using the CLI tools
346
+ specified in DEVTOOL.md. Include a comment block at the top of each service manifest with
347
+ connection instructions:
348
+
349
+ ```yaml
350
+ # Service: {{Application Name}} ({{Technology}} {{version}})
351
+ # Environment: {{Environment Name}}
352
+ #
353
+ # Connect from local machine:
354
+ # {{CLI tool from DEVTOOL.md}} {{connection command using NodePort}}
355
+ #
356
+ # Example:
357
+ # mysql -h {{host}} -P {{nodeport}} -u {{username}} -p{{password}}
358
+ # mongosh mongodb://{{host}}:{{nodeport}}/{{database}}
359
+ # rdcli -h {{host}} -p {{nodeport}}
360
+ # rabbitmqadmin -H {{host}} -P {{nodeport}} list queues
361
+ ---
362
+ ```
363
+
364
+ Use the **Domain** from the target environment's `- Domain:` field in CLAUDE.md as host with NodePort (e.g., `localhost`, `home.server`). If no Domain is specified, fall back to `localhost` for localhost environments or the SSH IP for remote environments.
365
+
366
+ ### 4. Output Summary
367
+
368
+ Print a summary of all actions taken:
369
+
370
+ ```
371
+ ## K8s Environment Preparation Summary
372
+
373
+ ### Target Environment
374
+ | Environment | Deployment Type | Output Folder |
375
+ |-------------|----------------|---------------|
376
+ | Home Server | Kubernetes | environment/ |
377
+
378
+ ### ENVIRONMENT.md
379
+ | Action | Details |
380
+ |--------|---------|
381
+ | Created/Updated | Synced Home Server environment, 11 services |
382
+
383
+ ### K8s Manifests Generated
384
+ | Service | File | Status |
385
+ |---------|------|--------|
386
+ | SMTP Server | environment/smtp_server.yaml | Created |
387
+ | Hub Cache (PVC) | environment/hub_cache_pvc.yaml | Created |
388
+ | Hub Cache | environment/hub_cache.yaml | Created |
389
+ | Hub Core Database (PVC) | environment/hub_core_database_pvc.yaml | Created |
390
+ | Hub Core Database | environment/hub_core_database.yaml | Created |
391
+ | ... | ... | ... |
392
+
393
+ ### NodePort Assignments
394
+ | Service | Primary Port | NodePort |
395
+ |---------|-------------|----------|
396
+ | HC Adapter Message Queue | 5672 | 30000 |
397
+ | HC Database | 3306 | 30010 |
398
+ | Hub Cache | 6379 | 30020 |
399
+ | Hub Core Database | 27017 | 30030 |
400
+ | Hub Single Sign On | 8180 (custom) / 8080 (official) | 30040 |
401
+ | Hub Support Database | 3306 | 30050 |
402
+ | SC API Gateway | 8000 | 30060 |
403
+ | SC Adapter Message Queue | 5672 | 30070 |
404
+ | SC Database | 3306 | 30080 |
405
+ | SMTP Server | 1025 | 30090 |
406
+ ```
407
+
408
+ ## Important Rules
409
+
410
+ - **NEVER remove, modify, or delete existing values** in ENVIRONMENT.md. Only add missing sections, services, and config keys.
411
+ - **StatefulSet over Deployment** — all 3rd party services use StatefulSet to ensure persistent identity, stable network IDs, and data persistence across pod restarts.
412
+ - **PersistentVolumeClaim in separate files** — PVCs MUST be generated in their own `<service>_pvc.yaml` files, never bundled inside the service manifest. This prevents accidental data loss when recreating services with `kubectl delete -f` / `kubectl apply -f`. The service manifest references the PVC by `claimName` only.
413
+ - **PersistentVolumeClaim** is mandatory for any service that stores data (databases, message queues, caches). Ephemeral services (Mailcatcher, Kong DB-less) are exempt.
414
+ - **NodePort for remote access** — every service must have a NodePort Service so developers can connect using local CLI tools from DEVTOOL.md.
415
+ - **Deterministic NodePort assignment** — use alphabetical ordering of service names to assign NodePorts starting from 30000 with interval of 10. This ensures consistent ports across environments and avoids conflicts.
416
+ - **Init containers for dependencies** — if a 3rd party app depends on another (e.g., Keycloak → MySQL), add an init container that waits for the dependency to be ready.
417
+ - **Image resolution precedence** — for each service, check ENVIRONMENT.md for the target environment's `Docker Image` field first (see Section 2e). If present, use the exact image reference with `imagePullPolicy: IfNotPresent` and do not add `args`/`command`. If absent, fall back to the official Docker Hub image with the exact version from CLAUDE.md (never use `latest`).
418
+ - **Namespace isolation** — all manifests use the project namespace (project code lowercase). The namespace manifest is generated once.
419
+ - **Credential rules from CLAUDE.md** — when generating default credentials for new services, follow the `# Rules` section in CLAUDE.md for standard username/password format.
420
+ - **Idempotent execution** — safe to re-run. Existing manifests are updated only where values changed. Manual customizations marked with `# CUSTOM:` are preserved.
421
+ - **ENVIRONMENT.md is the credential source** — K8s Secret values come from ENVIRONMENT.md, not hardcoded. If a value is `TODO` in ENVIRONMENT.md, use `TODO` (base64-encoded) in the Secret and log a warning.
422
+ - This skill only generates manifests for **3rd party supporting applications** — NOT for custom applications (those are handled by `depgen-k8s`).