groundwork-method 0.0.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (647) hide show
  1. package/CHANGELOG.md +823 -0
  2. package/LICENSE +21 -0
  3. package/README.md +44 -29
  4. package/bin/groundwork.js +1723 -0
  5. package/dist/src/generators/add-capability/generator.d.ts +8 -0
  6. package/dist/src/generators/add-capability/generator.js +60 -0
  7. package/dist/src/generators/add-capability/generator.js.map +1 -0
  8. package/dist/src/generators/cli-app/generator.d.ts +9 -0
  9. package/dist/src/generators/cli-app/generator.js +140 -0
  10. package/dist/src/generators/cli-app/generator.js.map +1 -0
  11. package/dist/src/generators/docs-site/generator.d.ts +5 -0
  12. package/dist/src/generators/docs-site/generator.js +441 -0
  13. package/dist/src/generators/docs-site/generator.js.map +1 -0
  14. package/dist/src/generators/electron-app/generator.d.ts +6 -0
  15. package/dist/src/generators/electron-app/generator.js +261 -0
  16. package/dist/src/generators/electron-app/generator.js.map +1 -0
  17. package/dist/src/generators/flutter-app/generator.d.ts +6 -0
  18. package/dist/src/generators/flutter-app/generator.js +314 -0
  19. package/dist/src/generators/flutter-app/generator.js.map +1 -0
  20. package/dist/src/generators/go-microservice/generator.d.ts +8 -0
  21. package/dist/src/generators/go-microservice/generator.js +232 -0
  22. package/dist/src/generators/go-microservice/generator.js.map +1 -0
  23. package/dist/src/generators/nextjs-app/generator.d.ts +8 -0
  24. package/dist/src/generators/nextjs-app/generator.js +294 -0
  25. package/dist/src/generators/nextjs-app/generator.js.map +1 -0
  26. package/dist/src/generators/python-microservice/generator.d.ts +13 -0
  27. package/dist/src/generators/python-microservice/generator.js +265 -0
  28. package/dist/src/generators/python-microservice/generator.js.map +1 -0
  29. package/dist/src/generators/shared/brand-tokens.d.ts +89 -0
  30. package/dist/src/generators/shared/brand-tokens.js +308 -0
  31. package/dist/src/generators/shared/brand-tokens.js.map +1 -0
  32. package/dist/src/generators/shared/capabilities.d.ts +101 -0
  33. package/dist/src/generators/shared/capabilities.js +279 -0
  34. package/dist/src/generators/shared/capabilities.js.map +1 -0
  35. package/dist/src/generators/shared/provenance.d.ts +2 -0
  36. package/dist/src/generators/shared/provenance.js +85 -0
  37. package/dist/src/generators/shared/provenance.js.map +1 -0
  38. package/dist/src/generators/shared/scaffold-helpers.d.ts +72 -0
  39. package/dist/src/generators/shared/scaffold-helpers.js +309 -0
  40. package/dist/src/generators/shared/scaffold-helpers.js.map +1 -0
  41. package/dist/src/generators/system-test-runner/generator.d.ts +23 -0
  42. package/dist/src/generators/system-test-runner/generator.js +173 -0
  43. package/dist/src/generators/system-test-runner/generator.js.map +1 -0
  44. package/dist/src/generators/workspace-dev-cli/generator.d.ts +7 -0
  45. package/dist/src/generators/workspace-dev-cli/generator.js +138 -0
  46. package/dist/src/generators/workspace-dev-cli/generator.js.map +1 -0
  47. package/generators.json +57 -0
  48. package/lib/repo-map/grammars/tree-sitter-c.wasm +0 -0
  49. package/lib/repo-map/grammars/tree-sitter-cpp.wasm +0 -0
  50. package/lib/repo-map/grammars/tree-sitter-csharp.wasm +0 -0
  51. package/lib/repo-map/grammars/tree-sitter-dart.wasm +0 -0
  52. package/lib/repo-map/grammars/tree-sitter-go.wasm +0 -0
  53. package/lib/repo-map/grammars/tree-sitter-java.wasm +0 -0
  54. package/lib/repo-map/grammars/tree-sitter-javascript.wasm +0 -0
  55. package/lib/repo-map/grammars/tree-sitter-kotlin.wasm +0 -0
  56. package/lib/repo-map/grammars/tree-sitter-lua.wasm +0 -0
  57. package/lib/repo-map/grammars/tree-sitter-php.wasm +0 -0
  58. package/lib/repo-map/grammars/tree-sitter-python.wasm +0 -0
  59. package/lib/repo-map/grammars/tree-sitter-ruby.wasm +0 -0
  60. package/lib/repo-map/grammars/tree-sitter-rust.wasm +0 -0
  61. package/lib/repo-map/grammars/tree-sitter-scala.wasm +0 -0
  62. package/lib/repo-map/grammars/tree-sitter-swift.wasm +0 -0
  63. package/lib/repo-map/grammars/tree-sitter-tsx.wasm +0 -0
  64. package/lib/repo-map/grammars/tree-sitter-typescript.wasm +0 -0
  65. package/lib/repo-map/index.js +386 -0
  66. package/lib/repo-map/languages.js +514 -0
  67. package/lib/repo-map/pagerank.js +59 -0
  68. package/migrations/README.md +60 -0
  69. package/migrations/_template/cli-migration.js +27 -0
  70. package/migrations/gw-bet-prose-redesign.js +105 -0
  71. package/migrations/gw-drop-test-manifest.js +37 -0
  72. package/migrations/gw-register-serena-mcp.js +42 -0
  73. package/migrations/gw-relocate-hidden-skills.js +40 -0
  74. package/migrations/gw-seed-config-toml.js +24 -0
  75. package/migrations/index.json +40 -0
  76. package/package.json +70 -6
  77. package/src/AGENTS.md +36 -0
  78. package/src/config/config.toml +30 -0
  79. package/src/config/groundwork-state.json +5 -0
  80. package/src/docs/llms.txt +72 -0
  81. package/src/docs/principles/ai-native/agent-native-systems.md +90 -0
  82. package/src/docs/principles/ai-native/agentic-systems.md +78 -0
  83. package/src/docs/principles/ai-native/ai-engineering.md +100 -0
  84. package/src/docs/principles/ai-native/ai-native-product.md +76 -0
  85. package/src/docs/principles/delivery/cost-engineering.md +89 -0
  86. package/src/docs/principles/delivery/day-2-operational-baseline.md +57 -0
  87. package/src/docs/principles/delivery/devex.md +88 -0
  88. package/src/docs/principles/delivery/platform.md +101 -0
  89. package/src/docs/principles/delivery/progressive-delivery.md +92 -0
  90. package/src/docs/principles/design/ai-native-design.md +73 -0
  91. package/src/docs/principles/design/design-foundations.md +80 -0
  92. package/src/docs/principles/design/design-systems-and-tokens.md +72 -0
  93. package/src/docs/principles/design/interaction-and-motion.md +69 -0
  94. package/src/docs/principles/design/layout-and-space.md +72 -0
  95. package/src/docs/principles/design/usability-and-ux.md +79 -0
  96. package/src/docs/principles/design/visual-design.md +84 -0
  97. package/src/docs/principles/foundations/code-craft.md +86 -0
  98. package/src/docs/principles/foundations/continuous-discovery.md +75 -0
  99. package/src/docs/principles/foundations/documentation.md +102 -0
  100. package/src/docs/principles/foundations/prioritization-and-appetite.md +78 -0
  101. package/src/docs/principles/foundations/product-engineering.md +90 -0
  102. package/src/docs/principles/foundations/product-risks.md +89 -0
  103. package/src/docs/principles/foundations/requirements-and-specs.md +80 -0
  104. package/src/docs/principles/foundations/success-metrics.md +66 -0
  105. package/src/docs/principles/foundations/testing.md +108 -0
  106. package/src/docs/principles/index.md +24 -0
  107. package/src/docs/principles/quality/accessibility.md +88 -0
  108. package/src/docs/principles/quality/observability.md +84 -0
  109. package/src/docs/principles/quality/performance.md +84 -0
  110. package/src/docs/principles/quality/privacy.md +92 -0
  111. package/src/docs/principles/quality/reliability.md +89 -0
  112. package/src/docs/principles/quality/security.md +78 -0
  113. package/src/docs/principles/stack/postgres.md +100 -0
  114. package/src/docs/principles/system-design/api-design.md +86 -0
  115. package/src/docs/principles/system-design/architecture-decisions.md +81 -0
  116. package/src/docs/principles/system-design/code-structure.md +104 -0
  117. package/src/docs/principles/system-design/data-engineering.md +87 -0
  118. package/src/docs/principles/system-design/durable-execution.md +89 -0
  119. package/src/docs/principles/system-design/evolutionary-architecture.md +81 -0
  120. package/src/docs/principles/system-design/identity-and-access.md +76 -0
  121. package/src/docs/principles/system-design/integration-patterns.md +84 -0
  122. package/src/docs/principles/system-design/real-time.md +83 -0
  123. package/src/docs/principles/system-design/surface-architecture.md +74 -0
  124. package/src/docs/ways-of-working/documentation.md +69 -0
  125. package/src/docs/ways-of-working/how-we-work.md +76 -0
  126. package/src/docs/ways-of-working/units-of-work.md +40 -0
  127. package/src/engineer-skills/groundwork-electron-engineer/SKILL.md +123 -0
  128. package/src/engineer-skills/groundwork-electron-engineer/references/documentation.md +126 -0
  129. package/src/engineer-skills/groundwork-electron-engineer/references/ipc-contracts.md +138 -0
  130. package/src/engineer-skills/groundwork-electron-engineer/references/observability.md +37 -0
  131. package/src/engineer-skills/groundwork-electron-engineer/references/packaging-and-updates.md +82 -0
  132. package/src/engineer-skills/groundwork-electron-engineer/references/performance-and-reliability.md +80 -0
  133. package/src/engineer-skills/groundwork-electron-engineer/references/process-model.md +94 -0
  134. package/src/engineer-skills/groundwork-electron-engineer/references/security.md +107 -0
  135. package/src/engineer-skills/groundwork-electron-engineer/references/testing-and-smoke.md +129 -0
  136. package/src/engineer-skills/groundwork-electron-engineer/references/theming-and-tokens.md +74 -0
  137. package/src/engineer-skills/groundwork-electron-engineer/sync-anchor.md +22 -0
  138. package/src/engineer-skills/groundwork-flutter-engineer/SKILL.md +114 -0
  139. package/src/engineer-skills/groundwork-flutter-engineer/references/accessibility.md +92 -0
  140. package/src/engineer-skills/groundwork-flutter-engineer/references/architecture.md +189 -0
  141. package/src/engineer-skills/groundwork-flutter-engineer/references/data-and-contracts.md +136 -0
  142. package/src/engineer-skills/groundwork-flutter-engineer/references/documentation.md +122 -0
  143. package/src/engineer-skills/groundwork-flutter-engineer/references/navigation.md +122 -0
  144. package/src/engineer-skills/groundwork-flutter-engineer/references/observability.md +37 -0
  145. package/src/engineer-skills/groundwork-flutter-engineer/references/performance-and-reliability.md +100 -0
  146. package/src/engineer-skills/groundwork-flutter-engineer/references/platform-channels.md +93 -0
  147. package/src/engineer-skills/groundwork-flutter-engineer/references/releases-and-distribution.md +84 -0
  148. package/src/engineer-skills/groundwork-flutter-engineer/references/security.md +96 -0
  149. package/src/engineer-skills/groundwork-flutter-engineer/references/state-management.md +166 -0
  150. package/src/engineer-skills/groundwork-flutter-engineer/references/testing.md +160 -0
  151. package/src/engineer-skills/groundwork-flutter-engineer/references/theming-and-design-tokens.md +109 -0
  152. package/src/engineer-skills/groundwork-flutter-engineer/references/widgets-and-composition.md +123 -0
  153. package/src/engineer-skills/groundwork-flutter-engineer/sync-anchor.md +24 -0
  154. package/src/engineer-skills/groundwork-go-engineer/SKILL.md +174 -0
  155. package/src/engineer-skills/groundwork-go-engineer/references/api-design.md +82 -0
  156. package/src/engineer-skills/groundwork-go-engineer/references/architecture.md +42 -0
  157. package/src/engineer-skills/groundwork-go-engineer/references/capability-ports.md +50 -0
  158. package/src/engineer-skills/groundwork-go-engineer/references/code-craft-security.md +34 -0
  159. package/src/engineer-skills/groundwork-go-engineer/references/concurrency.md +108 -0
  160. package/src/engineer-skills/groundwork-go-engineer/references/documentation.md +130 -0
  161. package/src/engineer-skills/groundwork-go-engineer/references/go-services.md +77 -0
  162. package/src/engineer-skills/groundwork-go-engineer/references/http-handlers.md +172 -0
  163. package/src/engineer-skills/groundwork-go-engineer/references/implementation-patterns.md +156 -0
  164. package/src/engineer-skills/groundwork-go-engineer/references/integration-realtime-data.md +57 -0
  165. package/src/engineer-skills/groundwork-go-engineer/references/observability.md +49 -0
  166. package/src/engineer-skills/groundwork-go-engineer/references/postgres.md +41 -0
  167. package/src/engineer-skills/groundwork-go-engineer/references/reliability-performance.md +105 -0
  168. package/src/engineer-skills/groundwork-go-engineer/references/testing.md +201 -0
  169. package/src/engineer-skills/groundwork-go-engineer/sync-anchor.md +20 -0
  170. package/src/engineer-skills/groundwork-nextjs-engineer/SKILL.md +112 -0
  171. package/src/engineer-skills/groundwork-nextjs-engineer/references/accessibility.md +111 -0
  172. package/src/engineer-skills/groundwork-nextjs-engineer/references/architecture.md +323 -0
  173. package/src/engineer-skills/groundwork-nextjs-engineer/references/data-fetching.md +458 -0
  174. package/src/engineer-skills/groundwork-nextjs-engineer/references/documentation.md +324 -0
  175. package/src/engineer-skills/groundwork-nextjs-engineer/references/error-boundaries.md +383 -0
  176. package/src/engineer-skills/groundwork-nextjs-engineer/references/mutations-and-forms.md +396 -0
  177. package/src/engineer-skills/groundwork-nextjs-engineer/references/observability.md +48 -0
  178. package/src/engineer-skills/groundwork-nextjs-engineer/references/performance-and-deployment.md +947 -0
  179. package/src/engineer-skills/groundwork-nextjs-engineer/references/routing-and-navigation.md +405 -0
  180. package/src/engineer-skills/groundwork-nextjs-engineer/references/security.md +131 -0
  181. package/src/engineer-skills/groundwork-nextjs-engineer/references/server-components.md +394 -0
  182. package/src/engineer-skills/groundwork-nextjs-engineer/references/tailwind-and-styling.md +134 -0
  183. package/src/engineer-skills/groundwork-nextjs-engineer/references/testing.md +491 -0
  184. package/src/engineer-skills/groundwork-nextjs-engineer/references/type-system.md +368 -0
  185. package/src/engineer-skills/groundwork-nextjs-engineer/references/ux-principles.md +230 -0
  186. package/src/engineer-skills/groundwork-nextjs-engineer/references/visual-language.md +69 -0
  187. package/src/engineer-skills/groundwork-nextjs-engineer/sync-anchor.md +16 -0
  188. package/src/engineer-skills/groundwork-python-engineer/SKILL.md +199 -0
  189. package/src/engineer-skills/groundwork-python-engineer/references/api-standards.md +88 -0
  190. package/src/engineer-skills/groundwork-python-engineer/references/architecture.md +57 -0
  191. package/src/engineer-skills/groundwork-python-engineer/references/async-patterns.md +103 -0
  192. package/src/engineer-skills/groundwork-python-engineer/references/capability-ports.md +44 -0
  193. package/src/engineer-skills/groundwork-python-engineer/references/database.md +88 -0
  194. package/src/engineer-skills/groundwork-python-engineer/references/documentation-mcp.md +167 -0
  195. package/src/engineer-skills/groundwork-python-engineer/references/implementation-patterns.md +166 -0
  196. package/src/engineer-skills/groundwork-python-engineer/references/ml-pipelines.md +119 -0
  197. package/src/engineer-skills/groundwork-python-engineer/references/ml-systems-ai-engineering.md +74 -0
  198. package/src/engineer-skills/groundwork-python-engineer/references/observability.md +57 -0
  199. package/src/engineer-skills/groundwork-python-engineer/references/resilience.md +126 -0
  200. package/src/engineer-skills/groundwork-python-engineer/references/security.md +148 -0
  201. package/src/engineer-skills/groundwork-python-engineer/references/testing.md +216 -0
  202. package/src/engineer-skills/groundwork-python-engineer/sync-anchor.md +20 -0
  203. package/src/generators/add-capability/generator.ts +70 -0
  204. package/src/generators/add-capability/schema.json +30 -0
  205. package/src/generators/capabilities/llm/capability.json +28 -0
  206. package/src/generators/capabilities/llm/providers/anthropic/footprint.json +13 -0
  207. package/src/generators/capabilities/llm/providers/anthropic/stacks/go/internal/llm/llm.go.template +102 -0
  208. package/src/generators/capabilities/llm/providers/anthropic/stacks/python/src/__packageName__/adapters/llm.py.template +61 -0
  209. package/src/generators/capabilities/llm/providers/local/footprint.json +13 -0
  210. package/src/generators/capabilities/llm/providers/local/stacks/go/internal/llm/llm.go.template +102 -0
  211. package/src/generators/capabilities/llm/providers/local/stacks/python/src/__packageName__/adapters/llm.py.template +53 -0
  212. package/src/generators/capabilities/llm/providers/localai/footprint.json +29 -0
  213. package/src/generators/capabilities/llm/providers/localai/stacks/go/internal/llm/llm.go.template +102 -0
  214. package/src/generators/capabilities/llm/providers/localai/stacks/python/src/__packageName__/adapters/llm.py.template +53 -0
  215. package/src/generators/capabilities/llm/providers/none/footprint.json +9 -0
  216. package/src/generators/capabilities/llm/providers/none/stacks/go/internal/llm/llm.go.template +35 -0
  217. package/src/generators/capabilities/llm/providers/none/stacks/python/src/__packageName__/adapters/llm.py.template +25 -0
  218. package/src/generators/capabilities/llm/providers/ollama/footprint.json +20 -0
  219. package/src/generators/capabilities/llm/providers/ollama/stacks/go/internal/llm/llm.go.template +102 -0
  220. package/src/generators/capabilities/llm/providers/ollama/stacks/python/src/__packageName__/adapters/llm.py.template +53 -0
  221. package/src/generators/capabilities/llm/providers/openai/footprint.json +13 -0
  222. package/src/generators/capabilities/llm/providers/openai/stacks/go/internal/llm/llm.go.template +98 -0
  223. package/src/generators/capabilities/llm/providers/openai/stacks/python/src/__packageName__/adapters/llm.py.template +60 -0
  224. package/src/generators/capabilities/llm/stacks/go/internal/core/service/llm.go.template +12 -0
  225. package/src/generators/capabilities/llm/stacks/go/internal/llm/llm_test.go.template +33 -0
  226. package/src/generators/capabilities/llm/stacks/python/src/__packageName__/core/llm.py.template +15 -0
  227. package/src/generators/capabilities/llm/stacks/python/tests/contracts/test_llm.py.template +37 -0
  228. package/src/generators/cli-app/files/README.md.template +76 -0
  229. package/src/generators/cli-app/files/build.mjs.template +15 -0
  230. package/src/generators/cli-app/files/package.json.template +21 -0
  231. package/src/generators/cli-app/files/src/cli.ts.template +67 -0
  232. package/src/generators/cli-app/files/src/commands/hello.ts.template +17 -0
  233. package/src/generators/cli-app/files/src/commands/status.ts.template +23 -0
  234. package/src/generators/cli-app/files/src/core/client.test.ts.template +80 -0
  235. package/src/generators/cli-app/files/src/core/client.ts.template +64 -0
  236. package/src/generators/cli-app/files/src/registry.test.ts.template +35 -0
  237. package/src/generators/cli-app/files/src/registry.ts.template +31 -0
  238. package/src/generators/cli-app/files/tsconfig.json.template +16 -0
  239. package/src/generators/cli-app/files/tsconfig.test.json.template +11 -0
  240. package/src/generators/cli-app/generator.ts +138 -0
  241. package/src/generators/cli-app/schema.json +24 -0
  242. package/src/generators/docs-site/files/.gitignore.ejs +40 -0
  243. package/src/generators/docs-site/files/app/docs/__slug__/page.tsx +101 -0
  244. package/src/generators/docs-site/files/app/docs/layout.tsx +14 -0
  245. package/src/generators/docs-site/files/app/docs.css +43 -0
  246. package/src/generators/docs-site/files/app/layout.tsx +24 -0
  247. package/src/generators/docs-site/files/app/page.tsx +135 -0
  248. package/src/generators/docs-site/files/app/source.ts +8 -0
  249. package/src/generators/docs-site/files/components/mermaid.tsx +67 -0
  250. package/src/generators/docs-site/files/next.config.mjs +10 -0
  251. package/src/generators/docs-site/files/package.json +32 -0
  252. package/src/generators/docs-site/files/pnpm-workspace.yaml +7 -0
  253. package/src/generators/docs-site/files/postcss.config.mjs +6 -0
  254. package/src/generators/docs-site/files/source.config.ts +77 -0
  255. package/src/generators/docs-site/files/tailwind.config.js +10 -0
  256. package/src/generators/docs-site/files/tsconfig.json +27 -0
  257. package/src/generators/docs-site/generator.ts +476 -0
  258. package/src/generators/docs-site/schema.json +17 -0
  259. package/src/generators/electron-app/docs/principles/stack/electron/index.md +49 -0
  260. package/src/generators/electron-app/docs/principles/stack/electron/ipc-contracts.md +71 -0
  261. package/src/generators/electron-app/docs/principles/stack/electron/packaging-and-updates.md +59 -0
  262. package/src/generators/electron-app/docs/principles/stack/electron/process-model.md +53 -0
  263. package/src/generators/electron-app/docs/principles/stack/electron/security.md +70 -0
  264. package/src/generators/electron-app/docs/principles/stack/typescript/frontend.md +65 -0
  265. package/src/generators/electron-app/files/.gitignore.template +20 -0
  266. package/src/generators/electron-app/files/README.md.template +125 -0
  267. package/src/generators/electron-app/files/electron.vite.config.ts +31 -0
  268. package/src/generators/electron-app/files/eslint.config.mjs +92 -0
  269. package/src/generators/electron-app/files/forge.config.ts.template +44 -0
  270. package/src/generators/electron-app/files/package.json.template +54 -0
  271. package/src/generators/electron-app/files/playwright.config.ts +18 -0
  272. package/src/generators/electron-app/files/project.json.template +65 -0
  273. package/src/generators/electron-app/files/src/main/core-client.test.ts +81 -0
  274. package/src/generators/electron-app/files/src/main/core-client.ts +55 -0
  275. package/src/generators/electron-app/files/src/main/index.ts +157 -0
  276. package/src/generators/electron-app/files/src/main/ipc.ts +52 -0
  277. package/src/generators/electron-app/files/src/main/policy.test.ts +71 -0
  278. package/src/generators/electron-app/files/src/main/policy.ts +73 -0
  279. package/src/generators/electron-app/files/src/preload/index.ts +23 -0
  280. package/src/generators/electron-app/files/src/renderer/index.html.template +20 -0
  281. package/src/generators/electron-app/files/src/renderer/src/App.test.tsx +61 -0
  282. package/src/generators/electron-app/files/src/renderer/src/App.tsx.template +43 -0
  283. package/src/generators/electron-app/files/src/renderer/src/assets/main.css +40 -0
  284. package/src/generators/electron-app/files/src/renderer/src/env.d.ts +14 -0
  285. package/src/generators/electron-app/files/src/renderer/src/main.tsx +25 -0
  286. package/src/generators/electron-app/files/src/shared/ipc.ts +54 -0
  287. package/src/generators/electron-app/files/tests/smoke/app.spec.ts.template +133 -0
  288. package/src/generators/electron-app/files/tool/electron_exec.sh.template +83 -0
  289. package/src/generators/electron-app/files/tsconfig.json +7 -0
  290. package/src/generators/electron-app/files/tsconfig.node.json +27 -0
  291. package/src/generators/electron-app/files/tsconfig.web.json +22 -0
  292. package/src/generators/electron-app/files/vitest.config.ts +32 -0
  293. package/src/generators/electron-app/files/vitest.setup.ts +1 -0
  294. package/src/generators/electron-app/generator.ts +288 -0
  295. package/src/generators/electron-app/schema.json +23 -0
  296. package/src/generators/flutter-app/docs/principles/stack/flutter/architecture.md +78 -0
  297. package/src/generators/flutter-app/docs/principles/stack/flutter/index.md +38 -0
  298. package/src/generators/flutter-app/docs/principles/stack/flutter/platform-channels.md +51 -0
  299. package/src/generators/flutter-app/docs/principles/stack/flutter/releases-and-distribution.md +59 -0
  300. package/src/generators/flutter-app/docs/principles/stack/flutter/state-management.md +85 -0
  301. package/src/generators/flutter-app/docs/principles/stack/flutter/testing.md +86 -0
  302. package/src/generators/flutter-app/docs/principles/stack/flutter/widgets-and-composition.md +69 -0
  303. package/src/generators/flutter-app/files/.gitignore.template +30 -0
  304. package/src/generators/flutter-app/files/README.md.template +100 -0
  305. package/src/generators/flutter-app/files/analysis_options.yaml.template +18 -0
  306. package/src/generators/flutter-app/files/integration_test/app_test.dart.template +64 -0
  307. package/src/generators/flutter-app/files/lib/app.dart.template +24 -0
  308. package/src/generators/flutter-app/files/lib/config/app_config.dart +15 -0
  309. package/src/generators/flutter-app/files/lib/data/repositories/status_repository.dart +36 -0
  310. package/src/generators/flutter-app/files/lib/data/services/api_client.dart +71 -0
  311. package/src/generators/flutter-app/files/lib/domain/models/health_status.dart +23 -0
  312. package/src/generators/flutter-app/files/lib/main.dart +11 -0
  313. package/src/generators/flutter-app/files/lib/router.dart +23 -0
  314. package/src/generators/flutter-app/files/lib/ui/core/theme/app_theme.dart +110 -0
  315. package/src/generators/flutter-app/files/lib/ui/home/home_view.dart +89 -0
  316. package/src/generators/flutter-app/files/lib/ui/home/home_view_model.dart.template +38 -0
  317. package/src/generators/flutter-app/files/project.json.template +51 -0
  318. package/src/generators/flutter-app/files/pubspec.yaml.template +47 -0
  319. package/src/generators/flutter-app/files/test/api_client_test.dart.template +63 -0
  320. package/src/generators/flutter-app/files/test/fakes/fake_status_repository.dart.template +19 -0
  321. package/src/generators/flutter-app/files/test/home_view_test.dart.template +58 -0
  322. package/src/generators/flutter-app/files/tool/flutter_exec.sh.template +60 -0
  323. package/src/generators/flutter-app/generator.ts +362 -0
  324. package/src/generators/flutter-app/schema.json +23 -0
  325. package/src/generators/go-microservice/docs/principles/stack/go/concurrency.md +123 -0
  326. package/src/generators/go-microservice/docs/principles/stack/go/index.md +70 -0
  327. package/src/generators/go-microservice/docs/principles/stack/go/testing.md +168 -0
  328. package/src/generators/go-microservice/files/.air.toml.template +38 -0
  329. package/src/generators/go-microservice/files/.env.template +4 -0
  330. package/src/generators/go-microservice/files/.golangci.yml.template +82 -0
  331. package/src/generators/go-microservice/files/Dockerfile.dev.template +12 -0
  332. package/src/generators/go-microservice/files/asyncapi-pubsub.yaml.template +33 -0
  333. package/src/generators/go-microservice/files/asyncapi-ws.yaml.template +34 -0
  334. package/src/generators/go-microservice/files/cmd/api/main.go.template +149 -0
  335. package/src/generators/go-microservice/files/cmd/api/main_test.go.template +99 -0
  336. package/src/generators/go-microservice/files/cmd/worker/cleanup/main.go.template +39 -0
  337. package/src/generators/go-microservice/files/db/schema.sql.template +24 -0
  338. package/src/generators/go-microservice/files/go.mod.template +39 -0
  339. package/src/generators/go-microservice/files/internal/config/config.go.template +52 -0
  340. package/src/generators/go-microservice/files/internal/config/otel.go.template +93 -0
  341. package/src/generators/go-microservice/files/internal/core/domain/errors.go.template +16 -0
  342. package/src/generators/go-microservice/files/internal/core/domain/model.go.template +28 -0
  343. package/src/generators/go-microservice/files/internal/core/domain/user.go.template +13 -0
  344. package/src/generators/go-microservice/files/internal/core/pagination.go.template +16 -0
  345. package/src/generators/go-microservice/files/internal/core/service/app_service.go.template +79 -0
  346. package/src/generators/go-microservice/files/internal/core/service/event_hub.go.template +9 -0
  347. package/src/generators/go-microservice/files/internal/core/service/message_queue.go.template +10 -0
  348. package/src/generators/go-microservice/files/internal/core/service/outbox_repository.go.template +31 -0
  349. package/src/generators/go-microservice/files/internal/core/service/repository.go.template +23 -0
  350. package/src/generators/go-microservice/files/internal/core/service/user_repository.go.template +15 -0
  351. package/src/generators/go-microservice/files/internal/core/service/user_service.go.template +43 -0
  352. package/src/generators/go-microservice/files/internal/entrypoints/api/app_handler.go.template +108 -0
  353. package/src/generators/go-microservice/files/internal/entrypoints/api/auth_middleware_test.go.template +52 -0
  354. package/src/generators/go-microservice/files/internal/entrypoints/api/clerk_webhook.go.template +202 -0
  355. package/src/generators/go-microservice/files/internal/entrypoints/api/clerk_webhook_test.go.template +82 -0
  356. package/src/generators/go-microservice/files/internal/entrypoints/api/health_handler.go.template +80 -0
  357. package/src/generators/go-microservice/files/internal/entrypoints/api/idempotency/middleware.go.template +87 -0
  358. package/src/generators/go-microservice/files/internal/entrypoints/api/idempotency/middleware_test.go.template +76 -0
  359. package/src/generators/go-microservice/files/internal/entrypoints/api/idempotency/repository.go.template +37 -0
  360. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_auth.go.template +40 -0
  361. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_loadshed.go.template +38 -0
  362. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_logging.go.template +40 -0
  363. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_ratelimit.go.template +48 -0
  364. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_test.go.template +81 -0
  365. package/src/generators/go-microservice/files/internal/entrypoints/api/router.go.template +105 -0
  366. package/src/generators/go-microservice/files/internal/entrypoints/api/types.go.template +70 -0
  367. package/src/generators/go-microservice/files/internal/entrypoints/api/websocket_handler.go.template +39 -0
  368. package/src/generators/go-microservice/files/internal/httpclient/http_client.go.template +87 -0
  369. package/src/generators/go-microservice/files/internal/kafka/kafka.go.template +34 -0
  370. package/src/generators/go-microservice/files/internal/postgres/postgres.go.template +195 -0
  371. package/src/generators/go-microservice/files/internal/postgres/postgres_test.go.template +156 -0
  372. package/src/generators/go-microservice/files/internal/postgres/user_repository.go.template +56 -0
  373. package/src/generators/go-microservice/files/internal/pubsub/gcp_pubsub.go.template +35 -0
  374. package/src/generators/go-microservice/files/internal/websocket/client.go.template +151 -0
  375. package/src/generators/go-microservice/files/internal/websocket/hub.go.template +261 -0
  376. package/src/generators/go-microservice/files/scripts/apply-schema.sh.template +21 -0
  377. package/src/generators/go-microservice/files/tools/tools.go.template +10 -0
  378. package/src/generators/go-microservice/generator.ts +240 -0
  379. package/src/generators/go-microservice/schema.json +63 -0
  380. package/src/generators/nextjs-app/docs/principles/stack/typescript/frontend.md +65 -0
  381. package/src/generators/nextjs-app/files/.dockerignore.template +7 -0
  382. package/src/generators/nextjs-app/files/.env.example.template +24 -0
  383. package/src/generators/nextjs-app/files/.gitignore.template +5 -0
  384. package/src/generators/nextjs-app/files/Dockerfile +53 -0
  385. package/src/generators/nextjs-app/files/app/(auth)/sign-in/__sign-in__/page.tsx.template +9 -0
  386. package/src/generators/nextjs-app/files/app/(auth)/sign-up/__sign-up__/page.tsx.template +9 -0
  387. package/src/generators/nextjs-app/files/app/api/config/route.ts.template +39 -0
  388. package/src/generators/nextjs-app/files/app/api/healthz/route.test.ts +15 -0
  389. package/src/generators/nextjs-app/files/app/api/healthz/route.ts +5 -0
  390. package/src/generators/nextjs-app/files/app/api/proxy/__path__/route.test.ts.template +55 -0
  391. package/src/generators/nextjs-app/files/app/api/proxy/__path__/route.ts.template +126 -0
  392. package/src/generators/nextjs-app/files/app/error.tsx +39 -0
  393. package/src/generators/nextjs-app/files/app/global-error.tsx +68 -0
  394. package/src/generators/nextjs-app/files/app/globals.css +105 -0
  395. package/src/generators/nextjs-app/files/app/layout.tsx +59 -0
  396. package/src/generators/nextjs-app/files/app/loading.tsx +13 -0
  397. package/src/generators/nextjs-app/files/app/not-found.tsx +30 -0
  398. package/src/generators/nextjs-app/files/app/page.tsx +20 -0
  399. package/src/generators/nextjs-app/files/components/providers/default.tsx +19 -0
  400. package/src/generators/nextjs-app/files/components/providers/production.tsx +32 -0
  401. package/src/generators/nextjs-app/files/components/providers/telemetry.tsx +76 -0
  402. package/src/generators/nextjs-app/files/components/render-smoke.test.tsx +29 -0
  403. package/src/generators/nextjs-app/files/components/theme-provider.tsx +11 -0
  404. package/src/generators/nextjs-app/files/components.json +21 -0
  405. package/src/generators/nextjs-app/files/eslint.config.mjs +120 -0
  406. package/src/generators/nextjs-app/files/hooks/use-toast.ts +7 -0
  407. package/src/generators/nextjs-app/files/instrumentation.ts +90 -0
  408. package/src/generators/nextjs-app/files/lib/api/fetcher.ts.template +130 -0
  409. package/src/generators/nextjs-app/files/lib/config.ts +21 -0
  410. package/src/generators/nextjs-app/files/lib/logger.ts +29 -0
  411. package/src/generators/nextjs-app/files/lib/schemas/index.ts +19 -0
  412. package/src/generators/nextjs-app/files/lib/utils.ts +6 -0
  413. package/src/generators/nextjs-app/files/next.config.mjs +9 -0
  414. package/src/generators/nextjs-app/files/package.json +70 -0
  415. package/src/generators/nextjs-app/files/postcss.config.mjs +8 -0
  416. package/src/generators/nextjs-app/files/proxy.test.ts.template +30 -0
  417. package/src/generators/nextjs-app/files/proxy.ts +31 -0
  418. package/src/generators/nextjs-app/files/public/.gitkeep +1 -0
  419. package/src/generators/nextjs-app/files/tsconfig.json +42 -0
  420. package/src/generators/nextjs-app/files/vitest.config.mts +15 -0
  421. package/src/generators/nextjs-app/files/vitest.setup.ts +7 -0
  422. package/src/generators/nextjs-app/generator.ts +307 -0
  423. package/src/generators/nextjs-app/schema.json +44 -0
  424. package/src/generators/python-microservice/docs/principles/stack/python/async.md +168 -0
  425. package/src/generators/python-microservice/docs/principles/stack/python/documentation.md +240 -0
  426. package/src/generators/python-microservice/docs/principles/stack/python/mcp.md +147 -0
  427. package/src/generators/python-microservice/docs/principles/stack/python/resilience.md +193 -0
  428. package/src/generators/python-microservice/docs/principles/stack/python/testing.md +322 -0
  429. package/src/generators/python-microservice/files/.env.example.template +30 -0
  430. package/src/generators/python-microservice/files/Dockerfile.template +36 -0
  431. package/src/generators/python-microservice/files/db/schema.sql.template +19 -0
  432. package/src/generators/python-microservice/files/pyproject.toml.template +76 -0
  433. package/src/generators/python-microservice/files/scripts/apply-schema.sh.template +25 -0
  434. package/src/generators/python-microservice/files/src/__packageName__/adapters/comfyui.py.template +87 -0
  435. package/src/generators/python-microservice/files/src/__packageName__/adapters/config.py.template +48 -0
  436. package/src/generators/python-microservice/files/src/__packageName__/adapters/database.py.template +21 -0
  437. package/src/generators/python-microservice/files/src/__packageName__/adapters/message_queue.py.template +29 -0
  438. package/src/generators/python-microservice/files/src/__packageName__/adapters/repository.py.template +130 -0
  439. package/src/generators/python-microservice/files/src/__packageName__/adapters/telemetry.py.template +68 -0
  440. package/src/generators/python-microservice/files/src/__packageName__/adapters/websocket_hub.py.template +36 -0
  441. package/src/generators/python-microservice/files/src/__packageName__/core/domain/entities.py.template +22 -0
  442. package/src/generators/python-microservice/files/src/__packageName__/core/domain/exceptions.py.template +43 -0
  443. package/src/generators/python-microservice/files/src/__packageName__/core/ports.py.template +42 -0
  444. package/src/generators/python-microservice/files/src/__packageName__/core/service/example_service.py.template +68 -0
  445. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/dependencies.py.template +50 -0
  446. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/middleware.py.template +131 -0
  447. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/router.py.template +37 -0
  448. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/websocket_handler.py.template +20 -0
  449. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/worker/cleanup.py.template +35 -0
  450. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/worker/worker.py.template +28 -0
  451. package/src/generators/python-microservice/files/src/__packageName__/main.py.template +108 -0
  452. package/src/generators/python-microservice/files/tests/test_main.py.template +74 -0
  453. package/src/generators/python-microservice/files/tests/test_middleware.py.template +109 -0
  454. package/src/generators/python-microservice/files/tests/test_worker.py.template +16 -0
  455. package/src/generators/python-microservice/generator.ts +286 -0
  456. package/src/generators/python-microservice/schema.json +86 -0
  457. package/src/generators/shared/brand-tokens.ts +301 -0
  458. package/src/generators/shared/capabilities.ts +349 -0
  459. package/src/generators/shared/provenance.ts +61 -0
  460. package/src/generators/shared/scaffold-helpers.ts +309 -0
  461. package/src/generators/system-test-runner/NATIVE-CHECK-CONTRACT.md +20 -0
  462. package/src/generators/system-test-runner/files/tests/bets/.gitkeep +0 -0
  463. package/src/generators/system-test-runner/files/tests/bets/_archive/.gitkeep +0 -0
  464. package/src/generators/system-test-runner/files/tests/conftest.py.template +503 -0
  465. package/src/generators/system-test-runner/files/tests/pyproject.toml.template +20 -0
  466. package/src/generators/system-test-runner/files/tests/system/pages/__init__.py.template +9 -0
  467. package/src/generators/system-test-runner/files/tests/system/pages/base_page.py.template +36 -0
  468. package/src/generators/system-test-runner/files/tests/system/test_a11y_smoke.py.template +132 -0
  469. package/src/generators/system-test-runner/files/tests/system/test_contract_conformance.py.template +140 -0
  470. package/src/generators/system-test-runner/files/tests/system/test_layout_geometry.py.template +109 -0
  471. package/src/generators/system-test-runner/files/tests/system/test_render_smoke.py.template +257 -0
  472. package/src/generators/system-test-runner/files/tests/system/test_system.py.template +158 -0
  473. package/src/generators/system-test-runner/files/tests/system/test_token_conformance.py.template +206 -0
  474. package/src/generators/system-test-runner/files/tests/system/test_visual_regression.py.template +104 -0
  475. package/src/generators/system-test-runner/generator.ts +196 -0
  476. package/src/generators/system-test-runner/schema.json +24 -0
  477. package/src/generators/workspace-dev-cli/cli-src/build.mjs +42 -0
  478. package/src/generators/workspace-dev-cli/cli-src/dist/dev-bundle.js +2168 -0
  479. package/src/generators/workspace-dev-cli/cli-src/src/commands/bet.ts +442 -0
  480. package/src/generators/workspace-dev-cli/cli-src/src/commands/completion.ts +87 -0
  481. package/src/generators/workspace-dev-cli/cli-src/src/commands/doctor.ts +139 -0
  482. package/src/generators/workspace-dev-cli/cli-src/src/commands/lifecycle.ts +548 -0
  483. package/src/generators/workspace-dev-cli/cli-src/src/commands/quality.ts +127 -0
  484. package/src/generators/workspace-dev-cli/cli-src/src/commands/surface.ts +214 -0
  485. package/src/generators/workspace-dev-cli/cli-src/src/index.ts +127 -0
  486. package/src/generators/workspace-dev-cli/cli-src/src/registry.ts +194 -0
  487. package/src/generators/workspace-dev-cli/cli-src/src/theme/color.ts +130 -0
  488. package/src/generators/workspace-dev-cli/cli-src/src/theme/render.ts +158 -0
  489. package/src/generators/workspace-dev-cli/cli-src/src/theme/tokens.ts +122 -0
  490. package/src/generators/workspace-dev-cli/cli-src/src/util/context.ts +43 -0
  491. package/src/generators/workspace-dev-cli/cli-src/src/util/extensions.ts +99 -0
  492. package/src/generators/workspace-dev-cli/cli-src/src/util/paths.ts +46 -0
  493. package/src/generators/workspace-dev-cli/cli-src/src/util/proc.ts +106 -0
  494. package/src/generators/workspace-dev-cli/cli-src/src/util/prompt.ts +108 -0
  495. package/src/generators/workspace-dev-cli/cli-src/src/util/runners.ts +70 -0
  496. package/src/generators/workspace-dev-cli/cli-src/src/util/services.ts +221 -0
  497. package/src/generators/workspace-dev-cli/cli-src/src/util/version.ts +21 -0
  498. package/src/generators/workspace-dev-cli/cli-src/tsconfig.json +16 -0
  499. package/src/generators/workspace-dev-cli/files/.agents/skills/workspace-cli/SKILL.md.template +74 -0
  500. package/src/generators/workspace-dev-cli/files/dev.template +16 -0
  501. package/src/generators/workspace-dev-cli/files/docker-compose.yml.template +20 -0
  502. package/src/generators/workspace-dev-cli/files/scripts/cli/templates/milestone-test.pytmpl.template +46 -0
  503. package/src/generators/workspace-dev-cli/files/scripts/cli/templates/slice-test.pytmpl.template +38 -0
  504. package/src/generators/workspace-dev-cli/generator.ts +136 -0
  505. package/src/generators/workspace-dev-cli/schema.json +22 -0
  506. package/src/hidden-skills/code-intelligence.md +135 -0
  507. package/src/hidden-skills/groundwork-architect/SKILL.md +114 -0
  508. package/src/hidden-skills/groundwork-architect/references/agentic-systems.md +44 -0
  509. package/src/hidden-skills/groundwork-architect/references/ai-native-architecture.md +37 -0
  510. package/src/hidden-skills/groundwork-architect/references/api-and-contracts.md +45 -0
  511. package/src/hidden-skills/groundwork-architect/references/core-and-boundaries.md +45 -0
  512. package/src/hidden-skills/groundwork-architect/references/data-architecture.md +33 -0
  513. package/src/hidden-skills/groundwork-architect/references/decision-records.md +34 -0
  514. package/src/hidden-skills/groundwork-architect/references/durable-execution.md +45 -0
  515. package/src/hidden-skills/groundwork-architect/references/evolutionary-architecture.md +37 -0
  516. package/src/hidden-skills/groundwork-architect/references/identity-and-access.md +41 -0
  517. package/src/hidden-skills/groundwork-architect/references/integration-patterns.md +39 -0
  518. package/src/hidden-skills/groundwork-architect/references/observability.md +36 -0
  519. package/src/hidden-skills/groundwork-architect/references/performance-and-scale.md +41 -0
  520. package/src/hidden-skills/groundwork-architect/references/platform-and-delivery.md +47 -0
  521. package/src/hidden-skills/groundwork-architect/references/realtime-and-async.md +28 -0
  522. package/src/hidden-skills/groundwork-architect/references/reliability.md +31 -0
  523. package/src/hidden-skills/groundwork-architect/references/security-and-trust.md +47 -0
  524. package/src/hidden-skills/groundwork-architect/references/surface-architecture.md +40 -0
  525. package/src/hidden-skills/groundwork-architect/sync-anchor.md +34 -0
  526. package/src/hidden-skills/groundwork-architecture/architecture-template.md +50 -0
  527. package/src/hidden-skills/groundwork-architecture/instructions.md +139 -0
  528. package/src/hidden-skills/groundwork-architecture/phases/01-context-ingestion.md +18 -0
  529. package/src/hidden-skills/groundwork-architecture/phases/02-technical-constraints.md +27 -0
  530. package/src/hidden-skills/groundwork-architecture/phases/03-service-design.md +19 -0
  531. package/src/hidden-skills/groundwork-architecture/phases/04-data-flow-communication.md +23 -0
  532. package/src/hidden-skills/groundwork-architecture/phases/05-component-boundaries-contracts.md +17 -0
  533. package/src/hidden-skills/groundwork-architecture/phases/06-draft-review-present.md +38 -0
  534. package/src/hidden-skills/groundwork-architecture/phases/07-commit.md +33 -0
  535. package/src/hidden-skills/groundwork-architecture/templates/architecture-cache.md +43 -0
  536. package/src/hidden-skills/groundwork-architecture-extract/instructions.md +163 -0
  537. package/src/hidden-skills/groundwork-architecture-extract/templates/architecture-extract-cache.md +21 -0
  538. package/src/hidden-skills/groundwork-bet/briefs/acceptance-auditor.md +68 -0
  539. package/src/hidden-skills/groundwork-bet/briefs/blind-reviewer.md +56 -0
  540. package/src/hidden-skills/groundwork-bet/briefs/coverage-auditor.md +95 -0
  541. package/src/hidden-skills/groundwork-bet/briefs/edge-case-tracer.md +64 -0
  542. package/src/hidden-skills/groundwork-bet/briefs/experience-auditor.md +83 -0
  543. package/src/hidden-skills/groundwork-bet/briefs/slice-worker.md +257 -0
  544. package/src/hidden-skills/groundwork-bet/instructions.md +88 -0
  545. package/src/hidden-skills/groundwork-bet/templates/bet-progress-test.md +115 -0
  546. package/src/hidden-skills/groundwork-bet/templates/change-proposal.md +38 -0
  547. package/src/hidden-skills/groundwork-bet/templates/decomposition/meta.json +4 -0
  548. package/src/hidden-skills/groundwork-bet/templates/decomposition/milestone-index.md +31 -0
  549. package/src/hidden-skills/groundwork-bet/templates/decomposition/slice.md +31 -0
  550. package/src/hidden-skills/groundwork-bet/templates/pitch.md +45 -0
  551. package/src/hidden-skills/groundwork-bet/templates/technical-design/01-ui-design.md +51 -0
  552. package/src/hidden-skills/groundwork-bet/templates/technical-design/02-data-flows.md +36 -0
  553. package/src/hidden-skills/groundwork-bet/templates/technical-design/03-api-design.md +90 -0
  554. package/src/hidden-skills/groundwork-bet/templates/technical-design/04-data-design.md +29 -0
  555. package/src/hidden-skills/groundwork-bet/workflows/01-discovery.md +200 -0
  556. package/src/hidden-skills/groundwork-bet/workflows/02-design.md +178 -0
  557. package/src/hidden-skills/groundwork-bet/workflows/03-decomposition.md +242 -0
  558. package/src/hidden-skills/groundwork-bet/workflows/04-delivery.md +226 -0
  559. package/src/hidden-skills/groundwork-bet/workflows/05-validation.md +210 -0
  560. package/src/hidden-skills/groundwork-design-system/instructions.md +125 -0
  561. package/src/hidden-skills/groundwork-design-system/templates/brand-tokens.md +182 -0
  562. package/src/hidden-skills/groundwork-design-system/templates/design-system-cache.md +64 -0
  563. package/src/hidden-skills/groundwork-design-system/tracks/_foundation.md +136 -0
  564. package/src/hidden-skills/groundwork-design-system/tracks/agentic-protocol.md +269 -0
  565. package/src/hidden-skills/groundwork-design-system/tracks/cli.md +355 -0
  566. package/src/hidden-skills/groundwork-design-system/tracks/graphical-ui.md +330 -0
  567. package/src/hidden-skills/groundwork-design-system-extract/instructions.md +124 -0
  568. package/src/hidden-skills/groundwork-design-system-extract/templates/design-system-extract-cache.md +19 -0
  569. package/src/hidden-skills/groundwork-designer/SKILL.md +108 -0
  570. package/src/hidden-skills/groundwork-designer/references/accessibility.md +33 -0
  571. package/src/hidden-skills/groundwork-designer/references/ai-native-design.md +37 -0
  572. package/src/hidden-skills/groundwork-designer/references/design-review.md +29 -0
  573. package/src/hidden-skills/groundwork-designer/references/design-systems-and-tokens.md +33 -0
  574. package/src/hidden-skills/groundwork-designer/references/interaction-and-motion.md +37 -0
  575. package/src/hidden-skills/groundwork-designer/references/layout-and-space.md +33 -0
  576. package/src/hidden-skills/groundwork-designer/references/usability-and-ux.md +33 -0
  577. package/src/hidden-skills/groundwork-designer/references/visual-craft.md +49 -0
  578. package/src/hidden-skills/groundwork-designer/sync-anchor.md +20 -0
  579. package/src/hidden-skills/groundwork-doc-sync/instructions.md +100 -0
  580. package/src/hidden-skills/groundwork-elicit/instructions.md +66 -0
  581. package/src/hidden-skills/groundwork-elicit/methods.md +65 -0
  582. package/src/hidden-skills/groundwork-infra-adopt/instructions.md +168 -0
  583. package/src/hidden-skills/groundwork-infra-adopt/templates/infra-adopt-cache.md +21 -0
  584. package/src/hidden-skills/groundwork-mvp/instructions.md +223 -0
  585. package/src/hidden-skills/groundwork-mvp/templates/mvp-cache.md +9 -0
  586. package/src/hidden-skills/groundwork-patch/instructions.md +40 -0
  587. package/src/hidden-skills/groundwork-persona/instructions.md +65 -0
  588. package/src/hidden-skills/groundwork-product/SKILL.md +102 -0
  589. package/src/hidden-skills/groundwork-product/references/ai-native-product.md +45 -0
  590. package/src/hidden-skills/groundwork-product/references/discovery-and-opportunity.md +38 -0
  591. package/src/hidden-skills/groundwork-product/references/product-risks.md +52 -0
  592. package/src/hidden-skills/groundwork-product/references/requirements-and-specs.md +39 -0
  593. package/src/hidden-skills/groundwork-product/references/scope-and-sequencing.md +35 -0
  594. package/src/hidden-skills/groundwork-product/references/shaping-and-appetite.md +48 -0
  595. package/src/hidden-skills/groundwork-product/references/success-metrics-and-signals.md +37 -0
  596. package/src/hidden-skills/groundwork-product/sync-anchor.md +19 -0
  597. package/src/hidden-skills/groundwork-product-brief/instructions.md +231 -0
  598. package/src/hidden-skills/groundwork-product-brief-extract/instructions.md +139 -0
  599. package/src/hidden-skills/groundwork-product-brief-extract/templates/product-brief-extract-cache.md +17 -0
  600. package/src/hidden-skills/groundwork-review/checklists/architecture.md +93 -0
  601. package/src/hidden-skills/groundwork-review/checklists/bet-pitch.md +94 -0
  602. package/src/hidden-skills/groundwork-review/checklists/decomposition.md +135 -0
  603. package/src/hidden-skills/groundwork-review/checklists/design-system.md +85 -0
  604. package/src/hidden-skills/groundwork-review/checklists/domain-entity.md +66 -0
  605. package/src/hidden-skills/groundwork-review/checklists/implementation-readiness.md +47 -0
  606. package/src/hidden-skills/groundwork-review/checklists/infrastructure.md +68 -0
  607. package/src/hidden-skills/groundwork-review/checklists/maturity.md +71 -0
  608. package/src/hidden-skills/groundwork-review/checklists/product-brief.md +69 -0
  609. package/src/hidden-skills/groundwork-review/checklists/technical-design.md +112 -0
  610. package/src/hidden-skills/groundwork-review/instructions.md +181 -0
  611. package/src/hidden-skills/groundwork-scaffold/instructions.md +254 -0
  612. package/src/hidden-skills/groundwork-scaffold/phases/01-ingestion-service-mapping.md +87 -0
  613. package/src/hidden-skills/groundwork-scaffold/phases/02-scaffolding-execution.md +15 -0
  614. package/src/hidden-skills/groundwork-scaffold/phases/03-service-documentation-api-stubs.md +100 -0
  615. package/src/hidden-skills/groundwork-scaffold/phases/04-infrastructure-verification.md +17 -0
  616. package/src/hidden-skills/groundwork-scaffold/phases/05-draft-review.md +19 -0
  617. package/src/hidden-skills/groundwork-scaffold/phases/06-commit.md +19 -0
  618. package/src/hidden-skills/groundwork-scaffold/templates/scaffold-cache.md +23 -0
  619. package/src/hidden-skills/groundwork-scan/instructions.md +164 -0
  620. package/src/hidden-skills/groundwork-scan/references/digest-schema.md +66 -0
  621. package/src/hidden-skills/groundwork-scan/references/exclusions.md +44 -0
  622. package/src/hidden-skills/groundwork-scan/templates/architecture-findings.md +42 -0
  623. package/src/hidden-skills/groundwork-scan/templates/design-findings.md +23 -0
  624. package/src/hidden-skills/groundwork-scan/templates/overview.md +26 -0
  625. package/src/hidden-skills/groundwork-scan/templates/product-findings.md +23 -0
  626. package/src/hidden-skills/groundwork-scan/templates/scan-state.json +19 -0
  627. package/src/hidden-skills/groundwork-stack-forge/instructions.md +150 -0
  628. package/src/hidden-skills/groundwork-stack-forge/references/authoring-engineer-skills.md +107 -0
  629. package/src/hidden-skills/groundwork-surface-activation/instructions.md +138 -0
  630. package/src/hidden-skills/groundwork-update/briefs/reconcile-worker.md +196 -0
  631. package/src/hidden-skills/groundwork-update/instructions.md +200 -0
  632. package/src/hidden-skills/groundwork-writer/SKILL.md +278 -0
  633. package/src/hidden-skills/maturity-model.md +125 -0
  634. package/src/hidden-skills/operating-contract.md +400 -0
  635. package/src/hidden-skills/repo-map-schema.md +90 -0
  636. package/src/hidden-skills/templates/adr.md +57 -0
  637. package/src/hidden-skills/templates/capability-ports.md +71 -0
  638. package/src/hidden-skills/templates/discovery-notes.md +33 -0
  639. package/src/hidden-skills/templates/domain-entity.md +80 -0
  640. package/src/hidden-skills/templates/gap-ledger.md +21 -0
  641. package/src/hidden-skills/templates/handoff.md +37 -0
  642. package/src/hidden-skills/templates/maturity.md +39 -0
  643. package/src/hidden-skills/templates/surfaces.md +207 -0
  644. package/src/skills/groundwork-check/SKILL.md +56 -0
  645. package/src/skills/groundwork-check/instructions.md +70 -0
  646. package/src/skills/groundwork-orchestrator/SKILL.md +176 -0
  647. package/src/skills/groundwork-orchestrator/workflow-index.md +50 -0
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: groundwork-go-engineer
3
+ description: >
4
+ Implement and review Go service changes using self-contained engineering
5
+ references and the current repository as the source of truth. Use for Go
6
+ backend handlers, services, providers, domain models, migrations, telemetry,
7
+ structured logging, dependency injection, tests, concurrency, or service
8
+ architecture. This skill is the execution router for Go backend work: it loads
9
+ reference docs selectively, preserves core/edge boundaries and the inward
10
+ dependency rule, coordinates with adjacent skills, and verifies changes
11
+ against contracts and tests. Use this
12
+ skill whenever the user works in a Go service directory or asks about Go
13
+ backend behavior, even if they do not explicitly ask for a "go engineer."
14
+ ---
15
+
16
+ # Go Engineer
17
+
18
+ Go backend execution router for service repositories. Durable engineering guidance lives in `references/`; this skill decides what to load, how to route the task, what repository facts to verify, and which safety gates apply.
19
+
20
+ ## Operating Contract
21
+
22
+ 1. Load reference docs from `references/` for architectural and implementation guidance. Treat the current repository's code, specs, and generated contracts as the source of truth for naming, structure, and behavior.
23
+ 2. Orient with the repo map and Serena before reading widely (see Required First Checks) — find the hubs, then navigate by symbol. Inspect the current repository before naming packages, commands, import paths, schemas, or generated files.
24
+ 3. Load the smallest reference set that explains the task. Add more context only when the task crosses a boundary.
25
+ 4. Preserve the service's dependency direction and public contracts. Code implements OpenAPI, database migrations, event schemas, and documented architecture — it does not invent them.
26
+ 5. Treat observability as part of the contract, not an afterthought: a critical path emits an unbroken trace, and a missing span is a defect. Route durable engineering policy to the canonical docs (`docs/principles/stack/go/`, and the cross-cutting canon under `docs/principles/quality/` and `docs/principles/foundations/`) rather than restating it in code comments or this skill.
27
+ 6. Coordinate with adjacent skills when another skill owns the primary decision surface.
28
+
29
+ ---
30
+
31
+ ## Code intelligence (repo map + Serena)
32
+
33
+ GroundWork gives you a deterministic **repo map** (`npx groundwork-method repo-map` — tree-sitter import edges + PageRank centrality, cached to `.groundwork/cache/repo-map.json`) and the **Serena** MCP server (LSP-backed symbol navigation and editing), registered at init. Orient before reading widely: refresh the map, read its `centrality` ranking to find the hubs, then use Serena to navigate them (`get_symbols_overview` / `find_symbol` / `find_referencing_symbols`) and make reference-aware edits (`replace_symbol_body` / `rename`). Full workflow and the graceful-degradation contract live in `.groundwork/skills/code-intelligence.md`; fall back to ordinary reads and edits when they are unavailable.
34
+
35
+ ---
36
+
37
+ ## Required First Checks
38
+
39
+ Before non-trivial Go implementation or review work:
40
+
41
+ | Check | Why |
42
+ |---|---|
43
+ | **Orient with the repo map + Serena** — refresh `npx groundwork-method repo-map`, read its `centrality` ranking to find the hubs, then navigate them with Serena (`get_symbols_overview` / `find_symbol` / `find_referencing_symbols`) | A blind file crawl misses the structure the map already computed; symbol navigation and reference-aware edits beat grep-and-read. Fall back to ordinary reads only when these are unavailable |
44
+ | Service package layout and nearby examples for the touched layer | Prevents inventing structure that already has a convention |
45
+ | `go.mod` for Go and dependency versions | Avoids version-specific advice that contradicts the project |
46
+ | OpenAPI spec (if HTTP behavior changes) | HTTP contracts are generated — code must match the spec |
47
+ | Database schema file + migration tooling (if schema changes) | Schema is target-state — migrations derive from it |
48
+ | Event specs (AsyncAPI, Protobuf, etc.) for async/real-time behavior | Event types drive code generation downstream |
49
+
50
+ ---
51
+
52
+ ## Context Routing
53
+
54
+ Load only the rows relevant to the current task. Reference files are in the skill's `references/` directory.
55
+
56
+ | Task shape | Reference to load |
57
+ |---|---|
58
+ | Any non-trivial service change | `architecture.md`, `implementation-patterns.md`, `go-services.md` |
59
+ | Go idioms, context, interfaces, DI, errors, config validation | `go-services.md` |
60
+ | Concurrency, goroutine lifecycle, errgroup, context cancellation | `concurrency.md` |
61
+ | Layer placement, new boundary, dependency direction | `architecture.md` |
62
+ | Capability interface + provider (LLM etc.), generated adapter shape, bare-interface bet, `add-capability` | `capability-ports.md`, `architecture.md` |
63
+ | HTTP endpoint, handler, idempotency, CORS | `http-handlers.md`, `api-design.md` |
64
+ | Database repository, SQL, declarative schema, test isolation | `postgres.md` |
65
+ | Observability — tracing, structured logging, metrics | `observability.md` |
66
+ | Reliability — retries, timeouts, graceful shutdown, backpressure | `reliability-performance.md` |
67
+ | Performance — latency budgets, load shedding, profiling | `reliability-performance.md` |
68
+ | Events, Pub/Sub, WebSocket, async integration | `integration-realtime-data.md` |
69
+ | Tests, quality gates, coverage strategy, flake triage | `testing.md` |
70
+ | Code quality, naming, simplicity, deletion | `code-craft-security.md` |
71
+ | Security, auth, secrets, input validation, supply chain | `code-craft-security.md` |
72
+ | Doc comments, naming-as-documentation, godoc, comment-is-a-smell | `documentation.md` |
73
+
74
+ ---
75
+
76
+ ## Skill Handoffs
77
+
78
+ Use the smallest collaborating set. Keep the Go engineer as lead when the work is mainly Go implementation inside a service directory.
79
+
80
+ | Condition | Hand off to |
81
+ |---|---|
82
+ | Endpoint shape, OpenAPI, error envelope, pagination, idempotency, SDK generation, webhooks, versioning | API architect / API design skill |
83
+ | Schema, migrations, indexes, query plans, constraints, RLS, retention, vector/full-text search | Database / Postgres design skill |
84
+ | Streaming, Pub/Sub, WebSockets, event schemas, replay, fan-out, idempotency, source-aware updates | Real-time / event architecture skill |
85
+ | Test strategy, CI quality gates, contract tests, flake reduction, validation design | Test architecture skill |
86
+ | Deployment, Cloud Run, Terraform, Docker, CI/CD, observability infrastructure, local dev tooling | Platform engineering skill |
87
+
88
+ If the collaborating skill does not exist in the project, handle the concern inline but flag it as outside this skill's primary scope.
89
+
90
+ ---
91
+
92
+ ## Execution Checklist
93
+
94
+ 1. **Identify the touched contract surface** — domain behavior, HTTP contract, database schema, event contract, operational behavior, or tests.
95
+ 2. **Load minimal routed references** and inspect nearby code before designing.
96
+ 3. **State important inferences** when guidance comes from general Go knowledge rather than project-specific docs or code.
97
+ 4. **Implement within existing conventions** — do not create new layer boundaries without evidence from docs or existing code.
98
+ 5. **Run targeted tests/checks** when feasible. If not feasible, explain the blocker and name the exact command to run later.
99
+ 6. **Summarize** references consulted, files changed, verification performed, and residual risks.
100
+
101
+ ---
102
+
103
+ ## Safety Gates
104
+
105
+ These constraints prevent the most common classes of architectural damage in Go services.
106
+
107
+ ### Naming and Boundaries
108
+ - Do not invent package paths, command names, contract files, or service boundaries. Verify them in the repository first.
109
+ - Do not create new layer boundaries without evidence from docs or existing code.
110
+
111
+ ### Layer Discipline
112
+ - Do not put business decisions in handlers, edge implementations, middleware, migrations, or generated code when the architecture expects them in domain/service code.
113
+ - Do not leak implementation-specific types across the core/edge boundary. If a database driver type appears in a core interface, the architecture is broken.
114
+ - Always validate configuration at startup (e.g., `envconfig`); do not scatter `os.Getenv` throughout the codebase.
115
+
116
+ ### Inbound Defenses & API Standards
117
+ - Do not use offset/limit pagination for collections; enforce cursor-based pagination.
118
+ - Do not allow mutating endpoints (POST/PATCH) without an `Idempotency-Key` implementation to prevent duplicate side-effects.
119
+ - Do not omit inbound concurrency limits (load shedding); shed load rather than queuing indefinitely.
120
+ - Never use wildcard CORS (`AllowedOrigins: []string{"*"}`).
121
+
122
+ ### Error Handling
123
+ - Do not log and return the same error at multiple layers. Wrap errors with context and log at the boundary established by existing code.
124
+
125
+ ### Concurrency
126
+ - Do not launch untracked goroutines. Verify cancellation, error collection, and shutdown behavior for every concurrent operation.
127
+
128
+ ### Contract & Data Integrity
129
+ - Do not change HTTP behavior without checking the OpenAPI source and any generated-client workflow.
130
+ - Do not change database behavior without checking the target-state schema, the migration workflow, and dry-run output when feasible. Use declarative schemas.
131
+ - Do not add or modify domain event types without updating the corresponding event spec.
132
+
133
+ ### Generation
134
+ - Do not run code generation manually outside documented generation flows.
135
+
136
+ ---
137
+
138
+ ## Quick Reference
139
+
140
+ Frequently needed patterns. Verify against the actual repository before using them.
141
+
142
+ ### Domain Error Pattern
143
+
144
+ | Sentinel pattern | HTTP mapping | Use |
145
+ |---|---|---|
146
+ | `ErrNotFound` | 404 | Resource lookup miss |
147
+ | `ErrUnauthorized` | 401 | Missing or invalid auth |
148
+ | `ErrForbidden` | 403 | Valid auth, insufficient permission |
149
+ | `ErrConflict` | 409 | Duplicate resource |
150
+ | `ErrPayloadTooLarge` | 413 | File exceeds size/duration limit |
151
+ | `ErrInvalidFormat` | 415 | Input format validation failure |
152
+ | `ErrValidation` (catch-all) | 422 | Field-level validation failures |
153
+
154
+ ### Mock Pattern
155
+
156
+ Hand-written mocks with settable `Func` fields. Read the mock file before writing tests — function signatures often include parameters easy to miss from the interface alone.
157
+
158
+ ### Event Broadcast Pattern
159
+
160
+ Domain mutations broadcast via an event hub in service methods. For testing, use a mock event hub and assert captured events. Async events use a transactional outbox pattern.
161
+
162
+ ### Idempotency Middleware
163
+
164
+ Caches responses by key + user ID. For tests, implement an in-memory repository rather than depending on the production store.
165
+
166
+ ---
167
+
168
+ ## Output Expectations
169
+
170
+ - Name the references or source files that informed non-obvious decisions.
171
+ - Separate verified repository facts from recommendations based on general Go knowledge.
172
+ - Provide concrete verification commands and results.
173
+ - For code reviews: findings first, ordered by severity, with file references and missing-test risks.
174
+ - For implementation work: changed files, behavior, tests, and follow-up risks.
@@ -0,0 +1,82 @@
1
+ # API Design
2
+
3
+ ## Core Principles
4
+
5
+ ### 1. Contract-First, Code-Generated
6
+
7
+ Specs live in `/specs` and are the source of truth. Server handlers, typed clients, and reference docs are generated from them. Write the spec before the handler. Hand-rolled clients drift; generated clients cannot.
8
+
9
+ ### 2. Explicit Versioning, Additive Evolution
10
+
11
+ Breaking changes require a new major version and a documented deprecation window. Within a major version, evolve additively: new optional fields, new endpoints, new response codes. Existing clients must never break from schema extension.
12
+
13
+ ### 3. Resources, Not RPCs
14
+
15
+ HTTP endpoints model resources (`POST /entities`, `GET /entities/{id}`), not verbs (`POST /createEntity`). The resource shape forces identity, lifecycle, and composition reasoning up front. When a verb is unavoidable, name it carefully and document why a resource shape does not fit.
16
+
17
+ ### 4. Idempotency by Design
18
+
19
+ Every write endpoint accepts an `Idempotency-Key` header. The server stores the key long enough to detect replays; the client is not responsible for being careful.
20
+
21
+ ### 5. Pagination and Filtering Are Uniform
22
+
23
+ Every collection endpoint paginates with the same cursor shape, filters with the same query-string grammar, and returns the same `next`/`prev` link structure. Inconsistent pagination is a design smell.
24
+
25
+ ### 6. Errors Are Structured and Machine-Readable
26
+
27
+ Every error response carries a stable code, a human message, and a `details` object. Clients branch on the code, not on the prose. Error codes are catalogued and never renumbered.
28
+
29
+ ### 7. AI-Agent Readability Is a First-Class Concern
30
+
31
+ OpenAPI specs include rich descriptions on every field, enumerations for every finite domain, and explicit examples on every endpoint. An agent reading the spec should be able to use the API correctly without reading the handler.
32
+
33
+ ### 8. Async Events Are Contracts Too
34
+
35
+ WebSocket and Pub/Sub events receive the same rigour as HTTP — AsyncAPI spec, generated client and server models, additive evolution.
36
+
37
+ ## Error Envelope (RFC 9457)
38
+
39
+ All error responses follow this shape:
40
+
41
+ ```json
42
+ {
43
+ "status": 404,
44
+ "title": "Not Found",
45
+ "detail": "No entity with the provided id exists.",
46
+ "instance": "/entities/abc123"
47
+ }
48
+ ```
49
+
50
+ Validation errors include a field-level `errors` array:
51
+
52
+ ```json
53
+ {
54
+ "status": 422,
55
+ "title": "Unprocessable Entity",
56
+ "detail": "Request body did not match the schema.",
57
+ "errors": [
58
+ { "message": "required", "path": "body.title", "value": "" }
59
+ ]
60
+ }
61
+ ```
62
+
63
+ ## Common HTTP Status Codes
64
+
65
+ | Status | Title | Meaning | Action |
66
+ |---|---|---|---|
67
+ | 401 | Unauthorized | Missing or invalid auth token | Re-authenticate |
68
+ | 403 | Forbidden | Authenticated but not authorised | Confirm role. Do not retry |
69
+ | 404 | Not Found | Resource does not exist | Verify identifier |
70
+ | 422 | Unprocessable Entity | Request body did not match schema | Inspect `errors` array |
71
+ | 409 | Conflict | Idempotency-Key reused with different payload | Generate a fresh key |
72
+ | 429 | Too Many Requests | Rate limit exceeded | Back off per `Retry-After` |
73
+ | 504 | Gateway Timeout | Downstream dependency timed out | Retry with backoff |
74
+ | 500 | Internal Server Error | Unexpected server error | Retry with backoff; escalate if sustained |
75
+
76
+ ## Anti-Patterns
77
+
78
+ - **Breaking changes without a version bump.** The assumption "no one uses that field" is always wrong.
79
+ - **Hand-written clients.** Clients drift. Generate.
80
+ - **Kitchen-sink endpoints.** Split large payloads into focused endpoints.
81
+ - **Error payloads as strings.** Structured errors, always.
82
+ - **Endpoint-scoped pagination conventions.** Pick one and apply universally.
@@ -0,0 +1,42 @@
1
+ # Service Structure: A Pure Core, Swappable Edges
2
+
3
+ ## Dependency Rule
4
+
5
+ Dependencies flow inward. The core depends on nothing concrete; the edge implementations depend on the core through the interfaces it owns.
6
+
7
+ ## Where code lives
8
+
9
+ | Zone | Location | Depends on | Contains |
10
+ |---|---|---|---|
11
+ | **Domain** | `internal/core/domain` | Nothing | Entities, value objects, validation, sentinel errors |
12
+ | **Core service** | `internal/core/service` | Domain | Application orchestration **and** the interfaces it consumes (`Repository`, `MessageQueue`, `TextGenerator`) — declared at the point of use, in domain language |
13
+ | **Edge implementations** | technology-named packages — `internal/postgres`, `internal/kafka`, `internal/pubsub`, `internal/httpclient`, `internal/websocket`, `internal/llm` | Domain + `internal/core/service` | Concrete implementations of the core's interfaces (Postgres, Kafka, Pub/Sub, HTTP clients, the LLM client) |
14
+ | **Entrypoints (driving edge)** | `internal/entrypoints` | Domain + Services | HTTP routes, middleware, WebSocket handlers |
15
+ | **Composition root** | `cmd/` | Everything | Wires concrete implementations into services at startup |
16
+
17
+ The interface and the code that calls it live in the **same** package — Go's "accept interfaces, return structs," applied to the whole service. There is no abstract `adapters` package and no layer named for the pattern; the core is `internal/core/service`, and each implementation sits in a package named for the technology it wraps (`internal/postgres`, `internal/kafka`, …).
18
+
19
+ ## Structural Invariants
20
+
21
+ - The domain and core service import no framework, no driver, no HTTP library, no SQL client.
22
+ - Interfaces are owned by the core package that consumes them, declared in domain language and named for the role (`Repository`, not `PostgresThing`).
23
+ - Edge implementations are interchangeable — swapping Postgres for another store requires zero core changes. They import `internal/core/service` and assert conformance with `var _ service.Repository = (*Repository)(nil)` (edge → core, the correct inward direction).
24
+ - The application service orchestrates; it does not contain business rules. Rules live on entities.
25
+ - Three conceptual zones: domain; the core service (interfaces + orchestration); edge implementations. More layers are ritual, not rigour.
26
+
27
+ ## Dependency Enforcement
28
+
29
+ `depguard` is a **shipped gate** in `.golangci.yml.template`: it denies `internal/core/...` importing any edge package (`internal/postgres`, `internal/kafka`, `internal/pubsub`, `internal/httpclient`, `internal/websocket`, `internal/llm`) or any framework/driver, allowing it only stdlib + `internal/core/...`. The edge and the composition root in `cmd/` may import anything. A core-imports-edge violation fails `golangci-lint run`, so the inward-flow rule is a guarantee, not a hope.
30
+
31
+ ## Anti-Patterns
32
+
33
+ - **Framework-coupled core.** If the core imports `gin.Context` or any HTTP type, it is no longer the core.
34
+ - **Anaemic domain models.** Data structs with no behaviour and a thick service that knows all the rules.
35
+ - **Leaky interfaces.** An interface with `*sql.DB` in its signature is a Postgres type wearing a costume.
36
+ - **Layer-skipping.** Handlers that talk directly to a store because "it is just a simple endpoint."
37
+ - **Per-implementation domain types.** Different entity definitions across packages. Map explicitly at the edge.
38
+ - **Over-layering.** Five layers of DTO translation between HTTP and the core. Edge code is thin.
39
+
40
+ ## Test Seams
41
+
42
+ A pure core is trivially testable without infrastructure — every outbound dependency is an interface that can be stubbed. Test the edge implementation against the real thing it wraps; test the service against stubs of the interfaces it consumes.
@@ -0,0 +1,50 @@
1
+ # Capability Ports & Providers
2
+
3
+ GroundWork scaffolds external capabilities (LLM inference, and the same pattern for any future capability) as **an interface in the core plus a selectable provider that satisfies it**. When you read or hand-write one of these, match the generated shape exactly — the generator and your code are the same contract.
4
+
5
+ ## The model
6
+
7
+ - A **capability** is an interface declared by the core that consumes it, in `internal/core/service` (package `service`) — domain-named (e.g. `TextGenerator`), no SDK type in its signature.
8
+ - A **provider** is the vendor that satisfies the capability; its implementation is the adapter, in a technology-named edge package (e.g. `internal/llm`). Choosing a provider selects the implementation wired in at the edge; the interface and its callers never change.
9
+ - Each provider declares a **footprint** — exactly one of `env`, `compose-service`, `runner`, `none` — which is the only thing that varies the operational cost. Infrastructure is a consequence of the provider, not a default.
10
+
11
+ | Footprint | Means | Materializes as |
12
+ |---|---|---|
13
+ | `env` | config only (a hosted API) | env vars in `.env`, no infra |
14
+ | `compose-service` | a container (a self-hosted server) | a service in `docker-compose.yml` |
15
+ | `runner` | a host process | an entry in `.dev/dev.config.json` runners |
16
+ | `none` | the bare interface — a bet | interface + stub + conformance test, nothing else |
17
+
18
+ ## Generated shape (LLM reference family)
19
+
20
+ ```
21
+ internal/core/service/llm.go # the interface — declared where it is consumed, domain-owned
22
+ internal/llm/llm.go # the adapter — one provider's implementation
23
+ internal/llm/llm_test.go # the contract test
24
+ ```
25
+
26
+ - **Interface** — a plain interface in `package service`, no SDK or HTTP type in its signature. An interface with `*sql.DB` or an `*http.Client` in it is an implementation wearing a costume.
27
+ ```go
28
+ // internal/core/service/llm.go
29
+ package service
30
+
31
+ type TextGenerator interface {
32
+ GenerateText(ctx context.Context, prompt string, maxTokens int) (string, error)
33
+ }
34
+ ```
35
+ - **Adapter** — `package llm`, implemented with `net/http` and stdlib, no vendor SDK (so `go.mod` is untouched and the adapter compiles standalone). Reads its config from `os.Getenv`, retries transient 5xx/429/connection failures, maps non-retryable status to a permanent error. It imports `internal/core/service` and asserts conformance at compile time (edge → core, the inward direction):
36
+ ```go
37
+ var _ service.TextGenerator = (*Client)(nil)
38
+ ```
39
+ - **Wiring** — construct `llm.NewClient()` in `cmd/api/main.go` and pass it, typed as the `service.TextGenerator` interface, into your service. Run `go mod tidy` if a provider added a dependency. Never let a service depend on the concrete `*llm.Client`.
40
+
41
+ ## The `none` bare interface (a bet)
42
+
43
+ `--provider none` ships the interface, a stub adapter that returns a not-implemented error, and a contract test that `Skip`s while the stub errors and flips to a live assertion once `GenerateText` works. Go has no xfail, so the skip *is* the open-bet marker: a green suite with a visible skip means "the contract is fixed, the implementation is owed." Implement the adapter behind the existing interface to cash it — do not touch the interface or the test's conformance line.
44
+
45
+ ## Rules when you touch one of these
46
+
47
+ - Add a capability to an existing service with `nx g add-capability --service <svc> --capability llm --provider <p>` — it runs the same injector the scaffold does, idempotently.
48
+ - Swapping providers swaps only the adapter file and the footprint. If a change forces the interface or a caller to change, the interface was leaky — fix the interface, not the callers.
49
+ - Surfaces and frontends do **not** embed an adapter; they call this service's interface over its API (keys stay server-side, one owner per capability).
50
+ - A hand-written adapter must pass the same `var _ service.X = (*T)(nil)` conformance assertion and the contract test the generator emits.
@@ -0,0 +1,34 @@
1
+ # Code Craft & Security
2
+
3
+ ## Code Craft Principles
4
+
5
+ 1. **Simpler is better than clever.** Plain data structures over clever abstractions, plain control flow over meta-programming.
6
+ 2. **No speculative abstraction.** Three concrete use cases before generalising.
7
+ 3. **Deletion is a virtue.** Dead code cannot break, confuse, or leak.
8
+ 4. **Names are the interface.** Spend time on names. Rename aggressively.
9
+ 5. **Comments explain the "why."** Non-obvious constraints, invariants, ADR references.
10
+ 6. **Error handling is design, not decoration.** Decide which errors a function returns, how callers respond, where recoverable/fatal boundary is.
11
+ 7. **Trust the boundary; distrust the internal.** Validate at system boundaries. Do not re-validate between internal callers.
12
+ 8. **Dead code is a bug.** Commented-out code, `_unused` variables, orphan functions — delete them.
13
+
14
+ ## Security Principles
15
+
16
+ 1. **Zero trust between services.** Every call carries an identity, every identity is authorised per operation.
17
+ 2. **Threat model the change.** Five-minute threat conversation for new endpoints, data fields, integrations.
18
+ 3. **Secrets are managed, rotated, and audited.** No secrets in source. Fetched at runtime from a secret manager.
19
+ 4. **Input is hostile; validate at the boundary.** Request bodies, webhook payloads, message queue events.
20
+ 5. **Supply chain is part of the attack surface.** Pin versions, review new dependencies, SBOM generation.
21
+ 6. **Least privilege by default.** Minimum permissions, extended only on evidence.
22
+ 7. **Auth is boring technology.** Standard auth provider, standard session handling. No custom auth.
23
+ 8. **Detect and respond, not just prevent.** Log security events, alert on suspicious patterns, run tabletops.
24
+
25
+ ## Anti-Patterns
26
+
27
+ ### Code Craft
28
+ - Defensive programming without a threat model. "Might need it later" scaffolding.
29
+ - Fashion-driven refactors. Multi-paragraph docstrings. Backwards-compatibility shims for internal APIs.
30
+
31
+ ### Security
32
+ - Internal network = trusted. Secrets in environment variables checked into Git.
33
+ - "It is an internal tool, we can skip auth." Dependencies pulled in on intuition.
34
+ - Exotic auth. "The WAF will catch it."
@@ -0,0 +1,108 @@
1
+ # Concurrency
2
+
3
+ ## Core Rules
4
+
5
+ Every goroutine has an owner. `errgroup.WithContext` is the default supervision primitive. Context is passed everywhere. No goroutine runs past the lifetime of the work it was started for.
6
+
7
+ ### Never Use Bare `go func()`
8
+
9
+ A bare `go func()` that fires and forgets is a goroutine with no owner and no cancellation path. Every `go` statement launches a goroutine that is either:
10
+
11
+ 1. Tracked by an `errgroup.Group` or `sync.WaitGroup` that the caller waits on, or
12
+ 2. A long-lived background worker started at program entry and shut down via a dedicated `context.Context` and `sync.WaitGroup` on the composition root.
13
+
14
+ ### `errgroup.WithContext` Is the Default
15
+
16
+ For fan-out work — fetching multiple resources concurrently, processing items in parallel:
17
+
18
+ ```go
19
+ g, ctx := errgroup.WithContext(ctx)
20
+
21
+ g.Go(func() error {
22
+ return fetchResource(ctx, id)
23
+ })
24
+ g.Go(func() error {
25
+ return fetchMetadata(ctx, id)
26
+ })
27
+
28
+ if err := g.Wait(); err != nil {
29
+ return fmt.Errorf("fetching resources: %w", err)
30
+ }
31
+ ```
32
+
33
+ When the first goroutine returns an error, the derived `ctx` is cancelled, signalling the others to stop.
34
+
35
+ ### Context Propagation Is Non-Negotiable
36
+
37
+ Every function that launches goroutines accepts a `context.Context` and passes it down. Every goroutine checks `ctx.Done()` on any blocking operation:
38
+
39
+ ```go
40
+ select {
41
+ case result := <-ch:
42
+ process(result)
43
+ case <-ctx.Done():
44
+ return ctx.Err()
45
+ }
46
+ ```
47
+
48
+ ### Limit Concurrency with Semaphores
49
+
50
+ Unconstrained fan-out exhausts file descriptors and saturates downstream services:
51
+
52
+ ```go
53
+ const maxConcurrency = 10
54
+ sem := make(chan struct{}, maxConcurrency)
55
+
56
+ g, ctx := errgroup.WithContext(ctx)
57
+ for _, item := range items {
58
+ sem <- struct{}{}
59
+ g.Go(func() error {
60
+ defer func() { <-sem }()
61
+ return process(ctx, item)
62
+ })
63
+ }
64
+ if err := g.Wait(); err != nil {
65
+ return fmt.Errorf("processing items: %w", err)
66
+ }
67
+ ```
68
+
69
+ ### Shared State: Channels First, Mutexes Second
70
+
71
+ Pass ownership via channels rather than sharing pointers through mutexes. Use `sync.Mutex` when a channel would be awkward — e.g., protecting a map read from many goroutines.
72
+
73
+ Never access shared state without synchronisation. The Go race detector (`-race`) is a required CI gate.
74
+
75
+ ## Graceful Shutdown
76
+
77
+ Background workers started at program entry respect the root context. The composition root in `cmd/` creates a context cancelled by `SIGTERM`/`SIGINT`:
78
+
79
+ ```go
80
+ func (w *Worker) Run(ctx context.Context) error {
81
+ for {
82
+ select {
83
+ case <-ctx.Done():
84
+ return nil
85
+ case job := <-w.queue:
86
+ if err := w.process(ctx, job); err != nil {
87
+ // log, metric, continue — or propagate if fatal
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ The composition root waits on all workers before the process exits. A service that kills itself with `os.Exit` rather than waiting for goroutines to drain drops in-flight requests and corrupts state.
95
+
96
+ ## Anti-Patterns
97
+
98
+ - **Fire-and-forget goroutines.** If you don't track it, you don't own it.
99
+ - **Sharing context derivations across goroutines.** Each goroutine derives its own from the parent.
100
+ - **Goroutines in `init()` or package-level `var`.** Goroutines belong in functions with explicit lifecycle management.
101
+ - **Infinite retry loops without backoff and cancellation.** A retry loop that ignores `ctx.Done()` spins forever after shutdown.
102
+ - **Mutexes without deferred unlock.** Always `defer mu.Unlock()` immediately after acquiring the lock.
103
+
104
+ ## References
105
+
106
+ - [sync/errgroup package](https://pkg.go.dev/golang.org/x/sync/errgroup)
107
+ - *The Go Memory Model* (golang.org/ref/mem)
108
+ - *Concurrency in Go*, Katherine Cox-Buday
@@ -0,0 +1,130 @@
1
+ # Documentation
2
+
3
+ Go ships its documentation discipline in the toolchain: `go doc` and pkg.go.dev render doc comments, `gofmt` normalises them, `go vet` flags malformed ones. The language was designed so that well-named code needs little prose around it. Lean on that.
4
+
5
+ ## Hierarchy
6
+
7
+ Structure documents more reliably than comments. A comment is a promise no compiler checks; when the code changes, the comment silently lies. Documentation priority — the foundations principle (`docs/principles/foundations/documentation.md`) written the Go way:
8
+
9
+ 1. **Types and signatures** — the compiler rejects incorrect types. Zero drift risk.
10
+ 2. **Naming** — self-documenting identifiers and small interfaces. Refactor before you comment.
11
+ 3. **Error context** — `fmt.Errorf("doing X: %w", err)` strings document the failure path and are exercised by every call site.
12
+ 4. **Test names** — `TestReserve_OutOfStock_ReturnsConflict` is executable documentation verified by CI.
13
+ 5. **Doc comments on exported API** — rendered by godoc; written only when the signature cannot carry the contract.
14
+ 6. **Inline "why" comments** — last resort for a genuinely non-obvious decision.
15
+
16
+ Levels 1–4 are verified by tooling. Levels 5–6 are human promises that drift. Minimise them.
17
+
18
+ ## Doc Comments
19
+
20
+ A doc comment is the sentence directly above a declaration, and it begins with the name of the thing it documents — `go doc` and pkg.go.dev parse that convention, and `go vet`'s doc checks rely on it.
21
+
22
+ ```go
23
+ // Reserve holds stock for an order until the reservation expires.
24
+ // It returns ErrOutOfStock when the requested quantity is unavailable.
25
+ func (s *Service) Reserve(ctx context.Context, orderID string, qty int) error
26
+ ```
27
+
28
+ Document the **exported** surface — the package's contract with its callers. Unexported helpers are read with their implementation in view; a doc comment there is usually redundant with the code below it.
29
+
30
+ State the contract the signature cannot: the error conditions a caller must branch on, side effects invisible in the return type, the units or invariants of a parameter. Do not restate the signature in prose.
31
+
32
+ ```go
33
+ // BAD — restates the signature
34
+ // GetOrder gets an order by id and returns it.
35
+ func GetOrder(ctx context.Context, id string) (*Order, error)
36
+
37
+ // GOOD — skip it; the name + types already say this
38
+ func GetOrder(ctx context.Context, id string) (*Order, error)
39
+ ```
40
+
41
+ ## Package Documentation
42
+
43
+ A package earns a doc comment when its name does not convey its purpose, its boundaries, or how its pieces fit. Put it in a dedicated `doc.go` so it survives file churn:
44
+
45
+ ```go
46
+ // Package inventory tracks stock levels and reservations.
47
+ //
48
+ // A reservation is a hold with a TTL; a hold that expires returns its
49
+ // quantity to available stock. Callers reserve, then either commit or
50
+ // release — an abandoned hold is reclaimed by the sweeper, not the caller.
51
+ package inventory
52
+ ```
53
+
54
+ The comment orients a reader before they open a single file. A package whose name and exported identifiers already explain it (`httpclient`, `postgres`) needs no `doc.go`.
55
+
56
+ ## Names and Interfaces Are the Documentation
57
+
58
+ The cheapest documentation is a name that makes the comment unnecessary. Go's conventions push this hard, and the service standards bake them in (`references/go-services.md`): small interfaces defined by their consumer, concrete types returned, no stuttering (`inventory.Service`, not `inventory.InventoryService`).
59
+
60
+ A one-to-three-method interface documents a capability by its shape:
61
+
62
+ ```go
63
+ // The name and the single method are the whole contract.
64
+ type ReservationStore interface {
65
+ Save(ctx context.Context, r Reservation) error
66
+ }
67
+ ```
68
+
69
+ A wide interface needs a comment to explain what it is *for* — which is the signal it is doing too much. Narrow it, and the comment disappears.
70
+
71
+ ## Error Messages Are Documentation
72
+
73
+ A Go error string is read far more often than any doc comment — it surfaces in logs, traces, and incident timelines. Treat it as documentation of the failure path. Wrap with context that names the operation, so the chain reads as a trace:
74
+
75
+ ```go
76
+ if err := store.Save(ctx, r); err != nil {
77
+ return fmt.Errorf("reserving stock for order %s: %w", orderID, err)
78
+ }
79
+ ```
80
+
81
+ Lowercase, no trailing punctuation, no "failed to" prefix — the convention that lets wraps compose cleanly (`reserving stock for order 7: writing row: connection refused`). Sentinel and structured errors document the branches a caller is expected to take; define them where that caller lives (`references/go-services.md`).
82
+
83
+ ## Inline Comments
84
+
85
+ Inline comments explain **why**, never **what**. The code already says what it does; the comment captures the reason the next reader cannot recover from the code alone.
86
+
87
+ ```go
88
+ // Sweep every 30s: shorter churns the DB, longer lets expired holds
89
+ // starve available stock past the SLA. Tuned against load test #214.
90
+ ticker := time.NewTicker(30 * time.Second)
91
+ ```
92
+
93
+ A comment that narrates the mechanics is noise — the reader can see the loop.
94
+
95
+ ```go
96
+ // BAD — narrates the obvious
97
+ // loop over the items and sum the quantities
98
+ for _, item := range items {
99
+ total += item.Qty
100
+ }
101
+ ```
102
+
103
+ ## A Comment Is Often a Smell
104
+
105
+ When you reach for a comment to explain *what* a block does, the code is asking to be refactored. The comment is debt; the fix is in the code:
106
+
107
+ - A comment explaining a variable → rename the variable.
108
+ - A comment heading a block → extract a function whose name is that comment.
109
+ - A comment decoding a boolean argument (`Process(data, true) // skip cache`) → introduce a named type or option.
110
+ - A comment listing what a function does in three parts → the function does three things; split it.
111
+
112
+ Delete the comment and fix the name. The refactor cannot drift; the comment can.
113
+
114
+ ## In-Code Markers
115
+
116
+ ```go
117
+ // TODO(bob): batch these writes once the store supports it. Issue #231.
118
+ // FIXME(carol): retry storms under partition; needs a circuit breaker. Issue #245.
119
+ // HACK(dave): upstream returns 200 with an error body; inspect payload until fixed.
120
+ ```
121
+
122
+ Always include `(username)` and an issue reference. A marker without one will never be resolved.
123
+
124
+ ## What NOT to Document
125
+
126
+ - Self-evident exported functions where the name and types tell the whole story.
127
+ - Unexported helpers read in context with their callers.
128
+ - `Args`/`Returns`-style prose that duplicates the signature — Go has no such convention; the types are the parameter docs.
129
+ - Struct fields whose name and type are clear (`CreatedAt time.Time`); comment only a non-obvious unit or invariant.
130
+ - Generated code (protobuf, mocks) — never hand-edit comments into it.