hatch3r 1.8.0 → 2.0.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 (396) hide show
  1. package/README.md +68 -178
  2. package/dist/cli/index.js +26966 -15942
  3. package/{agents → dist/content/agents}/hatch3r-architect.md +39 -9
  4. package/dist/content/agents/hatch3r-brownfield-spec.md +254 -0
  5. package/{agents → dist/content/agents}/hatch3r-ci-watcher.md +10 -3
  6. package/{agents → dist/content/agents}/hatch3r-context-rules.md +24 -6
  7. package/{agents → dist/content/agents}/hatch3r-creator.md +78 -39
  8. package/dist/content/agents/hatch3r-dependency-drafter.md +162 -0
  9. package/{agents → dist/content/agents}/hatch3r-devops.md +14 -4
  10. package/{agents → dist/content/agents}/hatch3r-docs-writer.md +11 -1
  11. package/dist/content/agents/hatch3r-edge-case-analyst.md +134 -0
  12. package/dist/content/agents/hatch3r-enhancability.md +192 -0
  13. package/{agents → dist/content/agents}/hatch3r-fixer.md +61 -10
  14. package/dist/content/agents/hatch3r-greenfield-spec.md +256 -0
  15. package/{agents → dist/content/agents}/hatch3r-handoff-loader.md +40 -14
  16. package/{agents → dist/content/agents}/hatch3r-handoff-preparer.md +17 -8
  17. package/dist/content/agents/hatch3r-implementer.md +409 -0
  18. package/dist/content/agents/hatch3r-incident-responder.md +96 -0
  19. package/dist/content/agents/hatch3r-learnings-loader.md +377 -0
  20. package/{agents → dist/content/agents}/hatch3r-lint-fixer.md +16 -4
  21. package/dist/content/agents/hatch3r-maintainability.md +183 -0
  22. package/dist/content/agents/hatch3r-pack-installer.md +113 -0
  23. package/dist/content/agents/hatch3r-performance.md +179 -0
  24. package/dist/content/agents/hatch3r-reliability.md +193 -0
  25. package/{agents → dist/content/agents}/hatch3r-researcher.md +30 -7
  26. package/dist/content/agents/hatch3r-reviewer.md +364 -0
  27. package/dist/content/agents/hatch3r-scalability.md +162 -0
  28. package/dist/content/agents/hatch3r-security.md +197 -0
  29. package/dist/content/agents/hatch3r-testability.md +204 -0
  30. package/dist/content/agents/hatch3r-ui.md +175 -0
  31. package/dist/content/agents/hatch3r-ux.md +160 -0
  32. package/{agents → dist/content/agents}/modes/requirements-elicitation.md +1 -1
  33. package/{agents → dist/content/agents}/modes/user-flows.md +2 -2
  34. package/dist/content/agents/shared/clarification-default-block.md +44 -0
  35. package/dist/content/agents/shared/confidence-gate.md +42 -0
  36. package/dist/content/agents/shared/cq-specialist-roster.md +26 -0
  37. package/{agents → dist/content/agents}/shared/efficiency-patterns.md +32 -1
  38. package/{agents → dist/content/agents}/shared/external-knowledge.md +1 -1
  39. package/{agents → dist/content/agents}/shared/injection-patterns.md +19 -8
  40. package/dist/content/agents/shared/principles.md +60 -0
  41. package/{agents → dist/content/agents}/shared/prompt-structure.md +7 -1
  42. package/{agents → dist/content/agents}/shared/quality-charter.md +73 -9
  43. package/dist/content/agents/shared/quality-specialist-frame.md +141 -0
  44. package/dist/content/agents/shared/rigor-contract.md +151 -0
  45. package/dist/content/agents/shared/severity-mapping.md +92 -0
  46. package/dist/content/agents/shared/triage-vocabulary.md +46 -0
  47. package/{agents → dist/content/agents}/shared/user-content-templates.md +40 -14
  48. package/dist/content/agents/shared/user-question-protocol.md +139 -0
  49. package/{checks → dist/content/checks}/README.md +5 -0
  50. package/{checks → dist/content/checks}/accessibility.md +14 -7
  51. package/{checks → dist/content/checks}/code-quality.md +1 -1
  52. package/{checks → dist/content/checks}/performance.md +7 -4
  53. package/{checks → dist/content/checks}/security.md +6 -6
  54. package/{checks → dist/content/checks}/testing.md +1 -1
  55. package/{commands → dist/content/commands}/board/pickup-azure-devops.md +1 -1
  56. package/{commands → dist/content/commands}/board/pickup-delegation-multi.md +41 -14
  57. package/{commands → dist/content/commands}/board/pickup-delegation.md +10 -8
  58. package/{commands → dist/content/commands}/board/pickup-github.md +1 -1
  59. package/{commands → dist/content/commands}/board/pickup-gitlab.md +1 -1
  60. package/{commands → dist/content/commands}/board/pickup-modes.md +1 -0
  61. package/{commands → dist/content/commands}/board/pickup-post-impl.md +2 -2
  62. package/{commands → dist/content/commands}/board/shared-azure-devops.md +1 -1
  63. package/{commands → dist/content/commands}/board/shared-github.md +2 -2
  64. package/{commands → dist/content/commands}/board/shared-gitlab.md +1 -1
  65. package/{commands → dist/content/commands}/hatch3r-api-spec.md +80 -3
  66. package/dist/content/commands/hatch3r-auth-scaffold.md +250 -0
  67. package/{commands → dist/content/commands}/hatch3r-benchmark.md +91 -8
  68. package/{commands → dist/content/commands}/hatch3r-board-fill.md +104 -18
  69. package/{commands → dist/content/commands}/hatch3r-board-pickup.md +99 -15
  70. package/dist/content/commands/hatch3r-bug-pipeline.md +240 -0
  71. package/{commands → dist/content/commands}/hatch3r-bug-plan.md +84 -8
  72. package/{commands → dist/content/commands}/hatch3r-codebase-map.md +82 -6
  73. package/{commands → dist/content/commands}/hatch3r-create.md +116 -18
  74. package/{commands → dist/content/commands}/hatch3r-debug.md +112 -24
  75. package/dist/content/commands/hatch3r-diagnose.md +238 -0
  76. package/{commands → dist/content/commands}/hatch3r-feature-plan.md +130 -10
  77. package/dist/content/commands/hatch3r-handoff.md +213 -0
  78. package/{commands → dist/content/commands}/hatch3r-healthcheck.md +106 -6
  79. package/dist/content/commands/hatch3r-incident-response.md +228 -0
  80. package/{commands → dist/content/commands}/hatch3r-migration-plan.md +81 -5
  81. package/{commands → dist/content/commands}/hatch3r-onboard.md +100 -9
  82. package/dist/content/commands/hatch3r-pack-install.md +243 -0
  83. package/{commands → dist/content/commands}/hatch3r-pr-resolve.md +114 -31
  84. package/{commands → dist/content/commands}/hatch3r-project-spec.md +85 -9
  85. package/{commands → dist/content/commands}/hatch3r-quick-change.md +115 -20
  86. package/{commands → dist/content/commands}/hatch3r-refactor-plan.md +82 -6
  87. package/dist/content/commands/hatch3r-release.md +401 -0
  88. package/{commands → dist/content/commands}/hatch3r-revision.md +104 -18
  89. package/{commands → dist/content/commands}/hatch3r-roadmap.md +94 -12
  90. package/{commands → dist/content/commands}/hatch3r-security-audit.md +107 -7
  91. package/dist/content/commands/hatch3r-slo-scaffold.md +246 -0
  92. package/dist/content/commands/hatch3r-spec.md +216 -0
  93. package/{commands → dist/content/commands}/hatch3r-test-plan.md +90 -14
  94. package/dist/content/commands/hatch3r-workflow.md +628 -0
  95. package/{commands → dist/content/commands}/revision/revision-delegation.md +8 -7
  96. package/{commands → dist/content/commands}/revision/revision-modes.md +49 -4
  97. package/{commands → dist/content/commands}/revision/revision-quality.md +12 -9
  98. package/dist/content/commands/shared/orchestration-frame.md +119 -0
  99. package/{github-agents → dist/content/github-agents}/hatch3r-docs-agent.md +22 -2
  100. package/dist/content/github-agents/hatch3r-lint-agent.md +66 -0
  101. package/{github-agents → dist/content/github-agents}/hatch3r-security-agent.md +22 -2
  102. package/{github-agents → dist/content/github-agents}/hatch3r-test-agent.md +22 -2
  103. package/{hooks → dist/content/hooks}/hatch3r-ci-failure.md +3 -3
  104. package/{hooks → dist/content/hooks}/hatch3r-file-save.md +4 -4
  105. package/{hooks → dist/content/hooks}/hatch3r-post-merge.md +1 -1
  106. package/{hooks → dist/content/hooks}/hatch3r-pre-commit.md +1 -1
  107. package/{hooks → dist/content/hooks}/hatch3r-pre-push.md +7 -7
  108. package/dist/content/hooks/hatch3r-review-loop-cap.md +52 -0
  109. package/{hooks → dist/content/hooks}/hatch3r-session-start.md +3 -3
  110. package/{mcp → dist/content/mcp}/mcp.json +7 -5
  111. package/{rules → dist/content/rules}/hatch3r-accessibility-standards.md +16 -3
  112. package/{rules → dist/content/rules}/hatch3r-accessibility-standards.mdc +13 -1
  113. package/dist/content/rules/hatch3r-agent-orchestration-detail.md +250 -0
  114. package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +245 -0
  115. package/dist/content/rules/hatch3r-agent-orchestration.md +250 -0
  116. package/dist/content/rules/hatch3r-agent-orchestration.mdc +245 -0
  117. package/{rules → dist/content/rules}/hatch3r-ai-evals.md +7 -5
  118. package/{rules → dist/content/rules}/hatch3r-ai-evals.mdc +5 -4
  119. package/{rules → dist/content/rules}/hatch3r-ai-ux-patterns.md +7 -3
  120. package/{rules → dist/content/rules}/hatch3r-ai-ux-patterns.mdc +4 -1
  121. package/dist/content/rules/hatch3r-android-patterns.md +107 -0
  122. package/dist/content/rules/hatch3r-android-patterns.mdc +102 -0
  123. package/dist/content/rules/hatch3r-anti-duplication.md +115 -0
  124. package/dist/content/rules/hatch3r-anti-duplication.mdc +115 -0
  125. package/{rules → dist/content/rules}/hatch3r-api-design.md +5 -1
  126. package/{rules → dist/content/rules}/hatch3r-api-design.mdc +3 -0
  127. package/{rules → dist/content/rules}/hatch3r-api-versioning.md +3 -1
  128. package/{rules → dist/content/rules}/hatch3r-api-versioning.mdc +1 -0
  129. package/{rules → dist/content/rules}/hatch3r-auth-patterns.md +5 -2
  130. package/{rules → dist/content/rules}/hatch3r-auth-patterns.mdc +2 -0
  131. package/{rules → dist/content/rules}/hatch3r-browser-verification.md +8 -10
  132. package/{rules → dist/content/rules}/hatch3r-browser-verification.mdc +8 -10
  133. package/dist/content/rules/hatch3r-capability-matrix.md +108 -0
  134. package/dist/content/rules/hatch3r-capability-matrix.mdc +108 -0
  135. package/{rules → dist/content/rules}/hatch3r-ci-cd.md +9 -1
  136. package/{rules → dist/content/rules}/hatch3r-ci-cd.mdc +7 -0
  137. package/dist/content/rules/hatch3r-clarification-default.md +73 -0
  138. package/dist/content/rules/hatch3r-clarification-default.mdc +73 -0
  139. package/{rules → dist/content/rules}/hatch3r-code-standards.md +23 -47
  140. package/{rules → dist/content/rules}/hatch3r-code-standards.mdc +22 -46
  141. package/{rules → dist/content/rules}/hatch3r-component-conventions.md +4 -1
  142. package/{rules → dist/content/rules}/hatch3r-component-conventions.mdc +3 -0
  143. package/{rules → dist/content/rules}/hatch3r-container-hardening.md +13 -3
  144. package/{rules → dist/content/rules}/hatch3r-container-hardening.mdc +10 -1
  145. package/{rules → dist/content/rules}/hatch3r-contract-testing.md +3 -1
  146. package/{rules → dist/content/rules}/hatch3r-contract-testing.mdc +1 -0
  147. package/dist/content/rules/hatch3r-cost-visibility.md +135 -0
  148. package/dist/content/rules/hatch3r-cost-visibility.mdc +135 -0
  149. package/dist/content/rules/hatch3r-cq-rule-frame.md +54 -0
  150. package/dist/content/rules/hatch3r-cq-rule-frame.mdc +49 -0
  151. package/{rules → dist/content/rules}/hatch3r-data-classification.md +5 -2
  152. package/{rules → dist/content/rules}/hatch3r-data-classification.mdc +3 -1
  153. package/{rules → dist/content/rules}/hatch3r-deep-context.md +14 -14
  154. package/{rules → dist/content/rules}/hatch3r-deep-context.mdc +13 -13
  155. package/{rules → dist/content/rules}/hatch3r-dependency-management.md +18 -4
  156. package/{rules → dist/content/rules}/hatch3r-dependency-management.mdc +16 -3
  157. package/{rules → dist/content/rules}/hatch3r-design-system-detection.md +4 -2
  158. package/{rules → dist/content/rules}/hatch3r-design-system-detection.mdc +1 -0
  159. package/dist/content/rules/hatch3r-dotnet-patterns.md +104 -0
  160. package/dist/content/rules/hatch3r-dotnet-patterns.mdc +99 -0
  161. package/dist/content/rules/hatch3r-edge-case-discipline.md +65 -0
  162. package/dist/content/rules/hatch3r-edge-case-discipline.mdc +65 -0
  163. package/dist/content/rules/hatch3r-enhancability.md +147 -0
  164. package/dist/content/rules/hatch3r-enhancability.mdc +142 -0
  165. package/{rules → dist/content/rules}/hatch3r-event-schema-evolution.md +3 -1
  166. package/{rules → dist/content/rules}/hatch3r-event-schema-evolution.mdc +1 -0
  167. package/dist/content/rules/hatch3r-fan-out-discipline.md +91 -0
  168. package/dist/content/rules/hatch3r-fan-out-discipline.mdc +91 -0
  169. package/{rules → dist/content/rules}/hatch3r-feature-flags.md +2 -0
  170. package/{rules → dist/content/rules}/hatch3r-feature-flags.mdc +2 -0
  171. package/dist/content/rules/hatch3r-flutter-patterns.md +88 -0
  172. package/dist/content/rules/hatch3r-flutter-patterns.mdc +83 -0
  173. package/{rules → dist/content/rules}/hatch3r-git-conventions.md +5 -2
  174. package/{rules → dist/content/rules}/hatch3r-git-conventions.mdc +2 -0
  175. package/dist/content/rules/hatch3r-go-patterns.md +98 -0
  176. package/dist/content/rules/hatch3r-go-patterns.mdc +93 -0
  177. package/{rules → dist/content/rules}/hatch3r-handoff-readiness.md +14 -4
  178. package/{rules → dist/content/rules}/hatch3r-handoff-readiness.mdc +13 -3
  179. package/{rules → dist/content/rules}/hatch3r-i18n.md +3 -1
  180. package/{rules → dist/content/rules}/hatch3r-i18n.mdc +2 -0
  181. package/dist/content/rules/hatch3r-iteration-summary.md +108 -0
  182. package/dist/content/rules/hatch3r-iteration-summary.mdc +108 -0
  183. package/dist/content/rules/hatch3r-learning-system.md +202 -0
  184. package/dist/content/rules/hatch3r-learning-system.mdc +202 -0
  185. package/dist/content/rules/hatch3r-maintainability.md +157 -0
  186. package/dist/content/rules/hatch3r-maintainability.mdc +152 -0
  187. package/{rules → dist/content/rules}/hatch3r-migrations.md +4 -2
  188. package/{rules → dist/content/rules}/hatch3r-migrations.mdc +1 -0
  189. package/{rules → dist/content/rules}/hatch3r-observability-logging.md +2 -1
  190. package/{rules → dist/content/rules}/hatch3r-observability-logging.mdc +1 -0
  191. package/{rules → dist/content/rules}/hatch3r-observability-metrics.md +2 -1
  192. package/{rules → dist/content/rules}/hatch3r-observability-metrics.mdc +1 -0
  193. package/{rules → dist/content/rules}/hatch3r-observability-tracing.md +46 -36
  194. package/{rules → dist/content/rules}/hatch3r-observability-tracing.mdc +45 -35
  195. package/{rules → dist/content/rules}/hatch3r-operability.md +3 -1
  196. package/{rules → dist/content/rules}/hatch3r-operability.mdc +1 -0
  197. package/{rules → dist/content/rules}/hatch3r-passkey-server.md +4 -2
  198. package/{rules → dist/content/rules}/hatch3r-passkey-server.mdc +1 -0
  199. package/{rules → dist/content/rules}/hatch3r-performance-budgets.md +3 -1
  200. package/{rules → dist/content/rules}/hatch3r-performance-budgets.mdc +3 -1
  201. package/dist/content/rules/hatch3r-php-laravel-patterns.md +109 -0
  202. package/dist/content/rules/hatch3r-php-laravel-patterns.mdc +104 -0
  203. package/{rules → dist/content/rules}/hatch3r-progressive-delivery.md +5 -1
  204. package/{rules → dist/content/rules}/hatch3r-progressive-delivery.mdc +3 -0
  205. package/dist/content/rules/hatch3r-proof-model.md +131 -0
  206. package/dist/content/rules/hatch3r-proof-model.mdc +131 -0
  207. package/dist/content/rules/hatch3r-python-patterns.md +70 -0
  208. package/dist/content/rules/hatch3r-python-patterns.mdc +65 -0
  209. package/dist/content/rules/hatch3r-react-native-patterns.md +83 -0
  210. package/dist/content/rules/hatch3r-react-native-patterns.mdc +78 -0
  211. package/{rules → dist/content/rules}/hatch3r-resilience-patterns.md +3 -1
  212. package/{rules → dist/content/rules}/hatch3r-resilience-patterns.mdc +1 -0
  213. package/dist/content/rules/hatch3r-reviewer-calibration.md +84 -0
  214. package/dist/content/rules/hatch3r-reviewer-calibration.mdc +84 -0
  215. package/dist/content/rules/hatch3r-right-sizing.md +68 -0
  216. package/dist/content/rules/hatch3r-right-sizing.mdc +66 -0
  217. package/dist/content/rules/hatch3r-ruby-rails-patterns.md +111 -0
  218. package/dist/content/rules/hatch3r-ruby-rails-patterns.mdc +106 -0
  219. package/dist/content/rules/hatch3r-rust-patterns.md +107 -0
  220. package/dist/content/rules/hatch3r-rust-patterns.mdc +102 -0
  221. package/dist/content/rules/hatch3r-scalability.md +137 -0
  222. package/dist/content/rules/hatch3r-scalability.mdc +132 -0
  223. package/{rules → dist/content/rules}/hatch3r-secrets-management.md +12 -2
  224. package/{rules → dist/content/rules}/hatch3r-secrets-management.mdc +9 -0
  225. package/{rules → dist/content/rules}/hatch3r-security-patterns.md +38 -35
  226. package/{rules → dist/content/rules}/hatch3r-security-patterns.mdc +36 -34
  227. package/dist/content/rules/hatch3r-security.md +97 -0
  228. package/dist/content/rules/hatch3r-security.mdc +92 -0
  229. package/dist/content/rules/hatch3r-swiftui-patterns.md +98 -0
  230. package/dist/content/rules/hatch3r-swiftui-patterns.mdc +93 -0
  231. package/dist/content/rules/hatch3r-testability.md +115 -0
  232. package/dist/content/rules/hatch3r-testability.mdc +110 -0
  233. package/{rules → dist/content/rules}/hatch3r-testing.md +6 -2
  234. package/{rules → dist/content/rules}/hatch3r-testing.mdc +3 -0
  235. package/{rules → dist/content/rules}/hatch3r-theming.md +3 -1
  236. package/{rules → dist/content/rules}/hatch3r-theming.mdc +2 -0
  237. package/dist/content/rules/hatch3r-tool-currency.md +91 -0
  238. package/dist/content/rules/hatch3r-tool-currency.mdc +86 -0
  239. package/{rules → dist/content/rules}/hatch3r-tooling-hierarchy.md +30 -32
  240. package/{rules → dist/content/rules}/hatch3r-tooling-hierarchy.mdc +28 -31
  241. package/dist/content/rules/hatch3r-typescript-patterns.md +58 -0
  242. package/dist/content/rules/hatch3r-typescript-patterns.mdc +53 -0
  243. package/{rules → dist/content/rules}/hatch3r-ux-states-and-flows.md +13 -5
  244. package/{rules → dist/content/rules}/hatch3r-ux-states-and-flows.mdc +10 -3
  245. package/{skills → dist/content/skills}/hatch3r-a11y-audit/SKILL.md +11 -9
  246. package/{skills → dist/content/skills}/hatch3r-a11y-audit/references/manual-audit-checklist.md +7 -5
  247. package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +131 -0
  248. package/{skills → dist/content/skills}/hatch3r-ai-feature/SKILL.md +4 -6
  249. package/{skills → dist/content/skills}/hatch3r-api-spec/SKILL.md +27 -2
  250. package/{skills → dist/content/skills}/hatch3r-architecture-review/SKILL.md +5 -8
  251. package/{commands/hatch3r-board-groom.md → dist/content/skills/hatch3r-board-groom/SKILL.md} +16 -18
  252. package/{commands/hatch3r-board-init.md → dist/content/skills/hatch3r-board-init/SKILL.md} +34 -31
  253. package/{commands/hatch3r-board-refresh.md → dist/content/skills/hatch3r-board-refresh/SKILL.md} +17 -19
  254. package/{commands/hatch3r-board-shared.md → dist/content/skills/hatch3r-board-shared/SKILL.md} +45 -15
  255. package/dist/content/skills/hatch3r-browser-verify/SKILL.md +307 -0
  256. package/{skills → dist/content/skills}/hatch3r-bug-fix/SKILL.md +16 -3
  257. package/{skills → dist/content/skills}/hatch3r-ci-pipeline/SKILL.md +17 -7
  258. package/{skills → dist/content/skills}/hatch3r-cli-fd/SKILL.md +34 -2
  259. package/{skills → dist/content/skills}/hatch3r-cli-fzf/SKILL.md +34 -2
  260. package/dist/content/skills/hatch3r-cli-gh/SKILL.md +139 -0
  261. package/{skills → dist/content/skills}/hatch3r-cli-jq/SKILL.md +43 -9
  262. package/{skills → dist/content/skills}/hatch3r-cli-ripgrep/SKILL.md +36 -4
  263. package/dist/content/skills/hatch3r-cli-toolbox/SKILL.md +376 -0
  264. package/dist/content/skills/hatch3r-containerize/SKILL.md +157 -0
  265. package/{skills → dist/content/skills}/hatch3r-context-health/SKILL.md +27 -9
  266. package/dist/content/skills/hatch3r-cost-tracking/SKILL.md +164 -0
  267. package/{skills → dist/content/skills}/hatch3r-customize/SKILL.md +9 -13
  268. package/{skills → dist/content/skills}/hatch3r-dep-audit/SKILL.md +29 -9
  269. package/{skills → dist/content/skills}/hatch3r-design-system-detect/SKILL.md +4 -8
  270. package/dist/content/skills/hatch3r-docs-writing/SKILL.md +159 -0
  271. package/dist/content/skills/hatch3r-enhancability-verify/SKILL.md +152 -0
  272. package/{skills → dist/content/skills}/hatch3r-feature/SKILL.md +54 -4
  273. package/dist/content/skills/hatch3r-feedback/SKILL.md +103 -0
  274. package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/SKILL.md +14 -12
  275. package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/references/azure-devops.md +2 -2
  276. package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/references/gitlab-ci.md +1 -1
  277. package/{skills → dist/content/skills}/hatch3r-handoff-prepare/SKILL.md +12 -15
  278. package/{skills → dist/content/skills}/hatch3r-handoff-resume/SKILL.md +5 -8
  279. package/{commands/hatch3r-hooks.md → dist/content/skills/hatch3r-hooks/SKILL.md} +59 -148
  280. package/dist/content/skills/hatch3r-incident-response/SKILL.md +174 -0
  281. package/{skills → dist/content/skills}/hatch3r-issue-workflow/SKILL.md +15 -4
  282. package/dist/content/skills/hatch3r-learn/SKILL.md +317 -0
  283. package/{skills → dist/content/skills}/hatch3r-logical-refactor/SKILL.md +6 -7
  284. package/dist/content/skills/hatch3r-maintainability-verify/SKILL.md +146 -0
  285. package/{skills → dist/content/skills}/hatch3r-migration/SKILL.md +9 -8
  286. package/{skills → dist/content/skills}/hatch3r-observability-verify/SKILL.md +17 -13
  287. package/{skills → dist/content/skills}/hatch3r-perf-audit/SKILL.md +14 -10
  288. package/{skills → dist/content/skills}/hatch3r-pr-creation/SKILL.md +8 -11
  289. package/{skills → dist/content/skills}/hatch3r-qa-validation/SKILL.md +8 -7
  290. package/dist/content/skills/hatch3r-recipe/SKILL.md +174 -0
  291. package/{skills → dist/content/skills}/hatch3r-refactor/SKILL.md +7 -8
  292. package/dist/content/skills/hatch3r-release/SKILL.md +265 -0
  293. package/{skills → dist/content/skills}/hatch3r-reliability-verify/SKILL.md +9 -5
  294. package/{commands/hatch3r-report.md → dist/content/skills/hatch3r-report/SKILL.md} +21 -18
  295. package/dist/content/skills/hatch3r-scalability-verify/SKILL.md +145 -0
  296. package/dist/content/skills/hatch3r-security-verify/SKILL.md +144 -0
  297. package/dist/content/skills/hatch3r-team-convention-author/SKILL.md +126 -0
  298. package/dist/content/skills/hatch3r-testability-verify/SKILL.md +147 -0
  299. package/{skills → dist/content/skills}/hatch3r-ui-ux-verify/SKILL.md +20 -12
  300. package/{skills → dist/content/skills}/hatch3r-visual-refactor/SKILL.md +12 -8
  301. package/package.json +53 -46
  302. package/agents/hatch3r-a11y-auditor.md +0 -159
  303. package/agents/hatch3r-dependency-auditor.md +0 -219
  304. package/agents/hatch3r-implementer.md +0 -278
  305. package/agents/hatch3r-learnings-loader.md +0 -343
  306. package/agents/hatch3r-perf-profiler.md +0 -166
  307. package/agents/hatch3r-reviewer.md +0 -314
  308. package/agents/hatch3r-security-auditor.md +0 -180
  309. package/agents/hatch3r-test-writer.md +0 -171
  310. package/agents/shared/user-question-protocol.md +0 -95
  311. package/commands/hatch3r-agent-customize.md +0 -201
  312. package/commands/hatch3r-command-customize.md +0 -113
  313. package/commands/hatch3r-context-health.md +0 -147
  314. package/commands/hatch3r-cost-tracking.md +0 -163
  315. package/commands/hatch3r-dep-audit.md +0 -188
  316. package/commands/hatch3r-handoff.md +0 -133
  317. package/commands/hatch3r-learn.md +0 -312
  318. package/commands/hatch3r-recipe.md +0 -194
  319. package/commands/hatch3r-release.md +0 -350
  320. package/commands/hatch3r-rule-customize.md +0 -133
  321. package/commands/hatch3r-skill-customize.md +0 -112
  322. package/commands/hatch3r-workflow.md +0 -504
  323. package/dist/cli/index.d.ts +0 -2
  324. package/dist/cli/index.js.map +0 -1
  325. package/github-agents/hatch3r-lint-agent.md +0 -46
  326. package/prompts/hatch3r-bug-triage.md +0 -158
  327. package/prompts/hatch3r-code-review.md +0 -134
  328. package/prompts/hatch3r-pr-description.md +0 -176
  329. package/rules/hatch3r-agent-orchestration-detail.md +0 -211
  330. package/rules/hatch3r-agent-orchestration-detail.mdc +0 -206
  331. package/rules/hatch3r-agent-orchestration.md +0 -376
  332. package/rules/hatch3r-agent-orchestration.mdc +0 -371
  333. package/rules/hatch3r-iteration-summary.md +0 -90
  334. package/rules/hatch3r-iteration-summary.mdc +0 -85
  335. package/rules/hatch3r-learning-consult.md +0 -42
  336. package/rules/hatch3r-learning-consult.mdc +0 -38
  337. package/rules/hatch3r-observability-tracing-detail.md +0 -20
  338. package/rules/hatch3r-observability-tracing-detail.mdc +0 -14
  339. package/rules/hatch3r-observability.md +0 -20
  340. package/rules/hatch3r-observability.mdc +0 -14
  341. package/skills/hatch3r-agent-customize/SKILL.md +0 -23
  342. package/skills/hatch3r-cli-aichat/SKILL.md +0 -84
  343. package/skills/hatch3r-cli-ast-grep/SKILL.md +0 -85
  344. package/skills/hatch3r-cli-az-devops/SKILL.md +0 -89
  345. package/skills/hatch3r-cli-bat/SKILL.md +0 -85
  346. package/skills/hatch3r-cli-comby/SKILL.md +0 -85
  347. package/skills/hatch3r-cli-csvkit/SKILL.md +0 -84
  348. package/skills/hatch3r-cli-delta/SKILL.md +0 -86
  349. package/skills/hatch3r-cli-difftastic/SKILL.md +0 -84
  350. package/skills/hatch3r-cli-docker/SKILL.md +0 -89
  351. package/skills/hatch3r-cli-duckdb/SKILL.md +0 -84
  352. package/skills/hatch3r-cli-gh/SKILL.md +0 -90
  353. package/skills/hatch3r-cli-glab/SKILL.md +0 -89
  354. package/skills/hatch3r-cli-lazygit/SKILL.md +0 -78
  355. package/skills/hatch3r-cli-llm/SKILL.md +0 -84
  356. package/skills/hatch3r-cli-miller/SKILL.md +0 -84
  357. package/skills/hatch3r-cli-mods/SKILL.md +0 -84
  358. package/skills/hatch3r-cli-overview/SKILL.md +0 -60
  359. package/skills/hatch3r-cli-playwright/SKILL.md +0 -89
  360. package/skills/hatch3r-cli-podman/SKILL.md +0 -84
  361. package/skills/hatch3r-cli-qsv/SKILL.md +0 -91
  362. package/skills/hatch3r-cli-rtk/SKILL.md +0 -91
  363. package/skills/hatch3r-cli-sd/SKILL.md +0 -85
  364. package/skills/hatch3r-cli-stagehand/SKILL.md +0 -111
  365. package/skills/hatch3r-cli-taplo/SKILL.md +0 -84
  366. package/skills/hatch3r-cli-yq/SKILL.md +0 -85
  367. package/skills/hatch3r-cli-zstd/SKILL.md +0 -85
  368. package/skills/hatch3r-command-customize/SKILL.md +0 -23
  369. package/skills/hatch3r-cost-tracking/SKILL.md +0 -92
  370. package/skills/hatch3r-incident-response/SKILL.md +0 -115
  371. package/skills/hatch3r-recipe/SKILL.md +0 -91
  372. package/skills/hatch3r-release/SKILL.md +0 -120
  373. package/skills/hatch3r-rule-customize/SKILL.md +0 -23
  374. package/skills/hatch3r-skill-customize/SKILL.md +0 -23
  375. /package/{agents → dist/content/agents}/modes/architecture.md +0 -0
  376. /package/{agents → dist/content/agents}/modes/boundary-analysis.md +0 -0
  377. /package/{agents → dist/content/agents}/modes/codebase-impact.md +0 -0
  378. /package/{agents → dist/content/agents}/modes/complexity-risk.md +0 -0
  379. /package/{agents → dist/content/agents}/modes/coverage-analysis.md +0 -0
  380. /package/{agents → dist/content/agents}/modes/current-state.md +0 -0
  381. /package/{agents → dist/content/agents}/modes/feature-design.md +0 -0
  382. /package/{agents → dist/content/agents}/modes/impact-analysis.md +0 -0
  383. /package/{agents → dist/content/agents}/modes/library-docs.md +0 -0
  384. /package/{agents → dist/content/agents}/modes/migration-path.md +0 -0
  385. /package/{agents → dist/content/agents}/modes/prior-art.md +0 -0
  386. /package/{agents → dist/content/agents}/modes/refactoring-strategy.md +0 -0
  387. /package/{agents → dist/content/agents}/modes/regression.md +0 -0
  388. /package/{agents → dist/content/agents}/modes/risk-assessment.md +0 -0
  389. /package/{agents → dist/content/agents}/modes/risk-prioritization.md +0 -0
  390. /package/{agents → dist/content/agents}/modes/root-cause.md +0 -0
  391. /package/{agents → dist/content/agents}/modes/similar-implementation.md +0 -0
  392. /package/{agents → dist/content/agents}/modes/symptom-trace.md +0 -0
  393. /package/{agents → dist/content/agents}/modes/test-pattern.md +0 -0
  394. /package/{commands → dist/content/commands}/board/shared-board-overview.md +0 -0
  395. /package/{commands → dist/content/commands}/revision/revision-board-integration.md +0 -0
  396. /package/{skills → dist/content/skills}/hatch3r-issue-workflow/references/delegation-patterns.md +0 -0
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: Rust conventions covering 2024 edition idioms, error handling with thiserror/anyhow, ownership patterns, async with Tokio, testing, and Cargo workspaces
3
+ globs: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", "**/rustfmt.toml", "**/.rustfmt.toml", "**/clippy.toml", "**/.clippy.toml", "**/rust-toolchain", "**/rust-toolchain.toml"]
4
+ alwaysApply: false
5
+ ---
6
+ # Rust Patterns
7
+
8
+ **Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
9
+
10
+ > Applies when the project ships a Rust crate or workspace. Detection signals: `Cargo.toml` at repo root, `*.rs` source files, or `rust-toolchain.toml` pinning a specific toolchain.
11
+
12
+ ## Rust Language Floor
13
+
14
+ - Target the Rust 2024 edition (`edition = "2024"` in `Cargo.toml`). Adopted patterns: `let-else`, async closures, `if let` chains. Pin the toolchain in `rust-toolchain.toml` to the latest stable for reproducible builds.
15
+ - Treat `cargo clippy --all-targets --all-features -- -D warnings` as a build gate. Configure `clippy.toml` with `msrv` and project-specific lints (`disallowed-methods`, `cognitive-complexity`).
16
+ - Format with `cargo fmt --all -- --check` in CI. Use `rustfmt.toml` to pin style (e.g., `edition = "2024"`, `imports_granularity = "Crate"`).
17
+ - Treat `cargo doc --no-deps --document-private-items` warnings as errors — missing doc on public items blocks merge.
18
+
19
+ ## Project Layout
20
+
21
+ - Single crate: `src/lib.rs` for library code, `src/main.rs` or `src/bin/<name>.rs` for binaries. Avoid mixing — separate library and binary into a workspace.
22
+ - Cargo workspaces for multi-crate repos: top-level `Cargo.toml` with `[workspace]`, crates under `crates/<name>/`. Use `[workspace.dependencies]` for shared version pinning.
23
+ - Public API exposed via `pub use` re-exports in `lib.rs` — internal modules stay `pub(crate)`. Stop exporting implementation details accidentally.
24
+ - Avoid `#[allow(...)]` outside test code. When unavoidable, comment with the reason and link to a tracking issue.
25
+
26
+ ## Error Handling
27
+
28
+ - Library crates: define typed errors with `thiserror` (`#[derive(Error)]`). Implement `std::error::Error` and `Display`; do not implement them manually.
29
+ - Binary crates: use `anyhow::Result<T>` for top-level error propagation with `.context("...")` annotations. Convert library errors via `From` impls or the `?` operator.
30
+ - Never `unwrap()` or `expect()` in library code outside test fixtures. Use `.ok_or(...)` / `.ok_or_else(...)` to convert `Option` to `Result`.
31
+ - Use `Result<T, E>` consistently. Never use `panic!` for recoverable errors. `assert!` in production code is a smell — convert to typed errors.
32
+
33
+ ## Ownership & Borrowing
34
+
35
+ - Prefer owned `String` and `Vec<T>` in function signatures when the function will store the value. Use `&str` / `&[T]` for read-only inspection — Clippy's `needless_pass_by_value` flags violations.
36
+ - Use `Cow<'_, str>` when the function may or may not modify the input. Stop cloning to "make the borrow checker happy".
37
+ - For shared ownership: `Arc<T>` across threads, `Rc<T>` single-threaded. Wrap interior mutability with `Mutex`, `RwLock`, `parking_lot::Mutex` (no poisoning) — never `RefCell` across threads.
38
+ - Document lifetime parameters when they affect the public API. Names like `'a` are placeholders; rename to `'src` / `'cfg` / `'req` when the meaning is non-trivial.
39
+
40
+ ## Async with Tokio
41
+
42
+ - Tokio is the async-runtime floor for most projects (`tokio = "1"` with the `rt-multi-thread` feature). Use `async-std` only if a specific dependency requires it; document the reason.
43
+ - Mark the entrypoint with `#[tokio::main(flavor = "multi_thread", worker_threads = N)]` for binaries. For tests, `#[tokio::test]` with the `current_thread` flavor unless the test exercises real parallelism.
44
+ - Never block in async code — `std::sync::Mutex::lock` blocks; use `tokio::sync::Mutex` for async-aware locking. CPU-bound work goes through `tokio::task::spawn_blocking`.
45
+ - Cancellation: prefer structured concurrency via `tokio::select!` + `CancellationToken`. Avoid dropping `JoinHandle` to "cancel" — the task continues running until it yields.
46
+ - Timeouts: wrap I/O with `tokio::time::timeout(duration, fut)`. Tokio futures are cancel-safe only at `await` points — design around that.
47
+
48
+ ## Testing
49
+
50
+ - Unit tests in `#[cfg(test)] mod tests { ... }` blocks next to the code. Integration tests in `tests/<name>.rs` at the crate root.
51
+ - Property-based testing with `proptest` for parser / serializer / state-machine logic. `proptest!` generates random inputs and shrinks failing cases.
52
+ - Snapshot testing with `insta` for serialized output (JSON, OpenAPI, generated code). Update snapshots through PR review — never blanket-update.
53
+ - Mocking: `mockall` for trait-based mocking. Hand-rolled fakes are fine when the trait has ≤3 methods. Avoid `mock_it` / `faux` (less maintained).
54
+ - Coverage: `cargo llvm-cov` for coverage reports. Floor: 80% line coverage in `src/`, 90% for critical modules (security, billing, persistence).
55
+ - Fuzz testing with `cargo-fuzz` (`#[no_main] fuzz_target!`) for untrusted-input parsers. At least one fuzz target per public-facing parser.
56
+
57
+ ## Concurrency Idioms
58
+
59
+ - For parallel CPU work: rayon (`rayon::iter::*`). Avoid threading directly with `std::thread::spawn` outside of long-running infrastructure (e.g., a background worker pool).
60
+ - For async fan-out: `tokio::task::JoinSet` (preferred over `FuturesUnordered` for managed cancellation) or `futures::stream::buffered_unordered`. Bound concurrency explicitly — never spawn unbounded.
61
+ - Channels: `tokio::sync::mpsc` (async), `crossbeam_channel` (sync, high-throughput). `std::sync::mpsc` is legacy — use the alternatives.
62
+ - Shared state with `Arc<RwLock<T>>` — keep critical sections small. Holding a lock across an `.await` is a deadlock risk; the compiler does not flag it.
63
+
64
+ ## Performance
65
+
66
+ - Profile with `cargo flamegraph` (Linux/macOS) or `samply` (cross-platform) before optimizing. Optimizing without a profile is guessing.
67
+ - Use `cargo bench` with `criterion` for micro-benchmarks. Pin baselines in `target/criterion/` and compare in CI.
68
+ - Compile-time flags: `RUSTFLAGS="-C target-cpu=native"` for binaries pinned to a known deployment environment. Cross-compiled binaries leave `target-cpu=native` off.
69
+ - Release profile in `Cargo.toml`:
70
+ ```toml
71
+ [profile.release]
72
+ lto = "thin"
73
+ codegen-units = 1
74
+ strip = true
75
+ ```
76
+ - Inline functions only after profiling. `#[inline]` hints, not commands; over-inlining bloats the binary and slows compilation.
77
+
78
+ ## Dependency Hygiene
79
+
80
+ - Pin `Cargo.lock` for binary crates; ignore for library crates. The `cargo lock-not-in-vcs` warning calls this out.
81
+ - Vulnerability scanning: `cargo audit` in CI against the RustSec advisory database. Block merge on advisory matches without an acknowledged remediation.
82
+ - License compliance: `cargo deny check licenses` with an allowlist in `deny.toml`. Block GPL contamination via the allowlist.
83
+ - Supply-chain: prefer crates with named maintainers, recent activity (≤6 months since last release), and >100 downloads/day. Pin transitive dependencies via `Cargo.lock` and re-verify on every `cargo update`.
84
+
85
+ ## Unsafe Code
86
+
87
+ - `unsafe` blocks require a `// SAFETY:` comment explaining why the invariant holds. Reviewer cannot approve `unsafe` without the rationale.
88
+ - Clippy lint `clippy::missing_safety_doc` is a build gate for `unsafe fn` declarations.
89
+ - Prefer safe abstractions even if they cost performance. Optimize after profiling, with a measurable target.
90
+
91
+ ## References
92
+
93
+ - Rust 2024 edition: https://doc.rust-lang.org/edition-guide/rust-2024/index.html (accessed 2026-05-27, official-docs)
94
+ - Rust API Guidelines: https://rust-lang.github.io/api-guidelines/ (accessed 2026-05-27, official-docs)
95
+ - Tokio tutorial: https://tokio.rs/tokio/tutorial (accessed 2026-05-27, official-docs)
96
+ - Cargo Book: https://doc.rust-lang.org/cargo/ (accessed 2026-05-27, official-docs)
97
+
98
+ ## Cross-References
99
+
100
+ - `rules/hatch3r-api-design.md` — REST/GraphQL/gRPC contract floors apply to Rust services (Axum/Tonic).
101
+ - `rules/hatch3r-testing.md` — coverage thresholds carry over to `cargo llvm-cov`.
102
+ - `rules/hatch3r-observability-logging.md` — `tracing` crate integration with the canonical logging contract.
@@ -0,0 +1,137 @@
1
+ ---
2
+ id: hatch3r-scalability-rule
3
+ type: rule
4
+ description: CQ6 Scalability Quality measurement rule — stateless-handler ratio, back-pressure pattern adoption, idempotency-key adoption on POST/PUT/PATCH, queue offloading for >1s ops, pool sizing per concurrency profile
5
+ scope: conditional
6
+ globs: "**/handlers/**,**/routes/**,**/services/**,**/api/**,**/workers/**,**/queues/**,**/jobs/**,**/middleware/**,**/handler*,**/route*,**/worker*,**/queue*"
7
+ tags: [review, scalability, floor:content-quality]
8
+ precedence: high
9
+ quality_charter: agents/shared/quality-charter.md
10
+ cache_friendly: true
11
+ ---
12
+ # Scalability Quality (CQ6)
13
+
14
+ **Pillars:** P2 (Scientific & Practical Quality), CQ6 (Scalability Quality)
15
+
16
+ ## Scope
17
+
18
+ This rule binds the CQ6 measurement set across end-user services that hatch3r-generated agents produce. It owns:
19
+
20
+ - The stateless-handler ratio floor on user-facing routes.
21
+ - The back-pressure pattern adoption gate on high-fan-out endpoints.
22
+ - The Idempotency-Key adoption floor on POST/PUT/PATCH endpoints.
23
+ - The queue-based offloading gate for >1s operations.
24
+ - The database connection pool sizing rule per concurrency profile.
25
+ - Specialist routing to `agents/hatch3r-scalability.md`.
26
+
27
+ This complements (does not duplicate) `rules/hatch3r-resilience-patterns.md` (circuit breakers + retry-with-jitter + timeouts on outbound calls). Resilience is failure handling; scalability is horizontal-growth capability.
28
+
29
+ ## CQ6 Threshold Set
30
+
31
+ Source: pillar CQ6 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle; missing measurement is a Medium finding minimum.
32
+
33
+ | Threshold | Target | Measurement source |
34
+ |-----------|--------|--------------------|
35
+ | Stateless-handler ratio | ≥95% on user-facing routes | Static scan: in-memory session state, module-level mutable globals, sticky-session assumptions in `app/`, `src/handlers/`, `src/routes/`, `pages/api/`, `apps/api/` |
36
+ | Back-pressure pattern adoption | 100% on high-fan-out endpoints | Named pattern (semaphore, queue depth limit, rejection threshold) with documented thresholds |
37
+ | Idempotency-Key adoption | 100% on POST/PUT/PATCH endpoints | Stripe pattern — header acceptance + dedup-result storage + named TTL |
38
+ | Queue-based offloading | 100% for operations >1s | Background-job system + retry policy + dead-letter queue (DLQ) |
39
+ | Connection pool sizing | Per concurrency profile | `pool_size = expected_concurrent_requests × avg_query_time / target_p99` per `agents/hatch3r-scalability.md` §Pool sizing |
40
+ | Horizontal-scaling validation | Load tests at target scale | p99 latency within budget; no resource-pool exhaustion |
41
+
42
+ ## Stateless-Handler Pattern
43
+
44
+ A handler is stateless when ALL hold:
45
+
46
+ - No module-level mutable globals (`let counter = 0` at module scope; `Map` instances re-used across requests).
47
+ - No in-process session storage (sessions stored in Redis, JWT, cookie store — externalized per `rules/hatch3r-auth-patterns.md`).
48
+ - No sticky-session assumption (no logic that depends on the same physical instance handling consecutive requests from the same client).
49
+ - No file-system cache at module scope (caches MUST live in Redis or a distributed store).
50
+
51
+ Per-request request-scoped state is fine. The test is: can two requests from the same client land on different instances and both succeed? If yes, stateless.
52
+
53
+ ## Back-Pressure Pattern
54
+
55
+ A handler is back-pressured when it explicitly bounds in-flight work. Allowed patterns:
56
+
57
+ - **Semaphore** — fixed concurrency cap per handler; new requests reject 429 once the cap is reached.
58
+ - **Queue depth limit** — work pushed onto a queue with a max depth; producer rejects when full.
59
+ - **Rejection threshold** — load-shedding when p99 latency exceeds a documented budget.
60
+ - **Token bucket** — rate-limit per client identifier with named refill rate.
61
+
62
+ Implicit back-pressure (relying on TCP backlog, OS file-descriptor exhaustion, or queue-server overflow) does not satisfy this rule. The handler MUST cite the pattern name + threshold value in a comment near the entry point.
63
+
64
+ ## Idempotency-Key Adoption
65
+
66
+ Source: Stripe `Idempotency-Key` header pattern (https://docs.stripe.com/api/idempotent_requests). On every POST/PUT/PATCH endpoint:
67
+
68
+ 1. Accept the `Idempotency-Key` request header (UUID v4 client-generated).
69
+ 2. On first observation, persist the request hash + response to a dedup store (Redis with TTL ≥24h, or database table with TTL index).
70
+ 3. On repeat observation within TTL, return the persisted response without re-executing the operation.
71
+ 4. Document the TTL in the handler comment + the API spec.
72
+
73
+ Endpoints that explicitly DO NOT mutate state (GET, HEAD, OPTIONS) do not require the key. Endpoints that are inherently idempotent (DELETE with same target) MUST still accept the key for client convenience.
74
+
75
+ ## Queue-Based Offloading
76
+
77
+ Operations >1s wall-clock MUST be moved off the request path:
78
+
79
+ - **Job queue** — Sidekiq, BullMQ, Celery, Hangfire, Quartz; named retry policy (exponential backoff with jitter; max attempts; DLQ).
80
+ - **Async response pattern** — return 202 Accepted with a `Location` header pointing to a status endpoint; client polls or uses webhook callback.
81
+ - **Server-Sent Events / WebSocket** — for streaming progress on long operations.
82
+
83
+ Synchronous handlers performing >1s work without offloading are a CRITICAL finding from the specialist. The 1s threshold is measured at p95 of historical traffic; not the modal time.
84
+
85
+ ## Database Connection Pool Sizing
86
+
87
+ Pool size = `expected_concurrent_requests × avg_query_time / target_p99`. Audit pool-size config against:
88
+
89
+ - `expected_concurrent_requests` = handler concurrency × instance count × steady-state RPS share.
90
+ - `avg_query_time` = p50 query time from observability — cite the data source.
91
+ - `target_p99` = SLO budget for handler latency — cite the SLO declaration.
92
+
93
+ Over-sizing the pool exhausts the database's `max_connections`; under-sizing queues requests and inflates p99. The formula MUST appear in a comment in the pool-init code, with the three values populated from the current measurement.
94
+
95
+ ## Specialist Agent Routing
96
+
97
+ | Trigger | Route to |
98
+ |---------|----------|
99
+ | Handler / route definition added or modified | `agents/hatch3r-scalability.md` (CQ6 review / gate) |
100
+ | Queue client / connection-pool config modified | `agents/hatch3r-scalability.md` |
101
+ | Session storage / cache-layer change | `agents/hatch3r-scalability.md` + `rules/hatch3r-auth-patterns.md` |
102
+ | New endpoint that performs >1s work, accepts POST/PUT/PATCH, or runs on a horizontally-scaled tier | `agents/hatch3r-scalability.md` (Implementer pre-write) |
103
+ | Load-test pre-release | `agents/hatch3r-scalability.md` |
104
+ | Capacity-planning audit (new tenant, marketing event, geographic expansion) | `agents/hatch3r-scalability.md` |
105
+
106
+ ## Per-Finding Output Format
107
+
108
+ Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ6. The `proof_trace` excerpt is the handler:line citation + measurement for the threshold that produced the finding.
109
+
110
+ ## Severity Mapping
111
+
112
+ The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ6 Action per status:
113
+
114
+ - `CRITICAL`: Sync >1s op without offloading; missing Idempotency-Key on POST/PUT/PATCH; sticky-session dependency on horizontally-scaled tier.
115
+ - `FINDINGS`: Stateless-handler ratio <95%; missing back-pressure on high-fan-out endpoint; pool sizing without formula.
116
+ - `PASS`: All thresholds met; surface in iteration summary.
117
+
118
+ ## Irreversibility Trigger
119
+
120
+ Any recommendation that increases connection-pool sizes, changes queue topology (visibility timeout, partition count, DLQ binding), or removes a sticky-session strategy is irreversible at production traffic. These changes MUST go through `agents/shared/user-question-protocol.md` per `rules/hatch3r-clarification-default.md` B1 before action.
121
+
122
+ ## When to Invoke
123
+
124
+ - Every PR that adds or modifies request handlers, route definitions, queue clients, or connection-pool config.
125
+ - Every new endpoint that performs >1s work, accepts POST/PUT/PATCH, or runs on a horizontally-scaled tier.
126
+ - Every change touching session storage, cache layers, or background-job systems.
127
+ - Capacity-planning audits when service traffic projections change (new tenant onboarding, marketing event, geographic expansion).
128
+ - Load-test pre-release before any release that claims horizontal-scaling capability or a new concurrency tier.
129
+
130
+ ## References
131
+
132
+ - Pillar CQ6 (measurement set + specialist owner; see `agents/shared/principles.md`).
133
+ - The content-quality-foundation audit domain (reliability + scalability foundation).
134
+ - `agents/hatch3r-scalability.md` (CQ6 reviewer / gate).
135
+ - `rules/hatch3r-resilience-patterns.md` (failure-handling patterns — distinct from horizontal-growth).
136
+ - `rules/hatch3r-auth-patterns.md` (externalized session storage).
137
+ - Stripe `Idempotency-Key` reference: https://docs.stripe.com/api/idempotent_requests.
@@ -0,0 +1,132 @@
1
+ ---
2
+ description: CQ6 Scalability Quality measurement rule — stateless-handler ratio, back-pressure pattern adoption, idempotency-key adoption on POST/PUT/PATCH, queue offloading for >1s ops, pool sizing per concurrency profile
3
+ globs: ["**/handlers/**", "**/routes/**", "**/services/**", "**/api/**", "**/workers/**", "**/queues/**", "**/jobs/**", "**/middleware/**", "**/handler*", "**/route*", "**/worker*", "**/queue*"]
4
+ alwaysApply: false
5
+ precedence: high
6
+ ---
7
+ # Scalability Quality (CQ6)
8
+
9
+ **Pillars:** P2 (Scientific & Practical Quality), CQ6 (Scalability Quality)
10
+
11
+ ## Scope
12
+
13
+ This rule binds the CQ6 measurement set across end-user services that hatch3r-generated agents produce. It owns:
14
+
15
+ - The stateless-handler ratio floor on user-facing routes.
16
+ - The back-pressure pattern adoption gate on high-fan-out endpoints.
17
+ - The Idempotency-Key adoption floor on POST/PUT/PATCH endpoints.
18
+ - The queue-based offloading gate for >1s operations.
19
+ - The database connection pool sizing rule per concurrency profile.
20
+ - Specialist routing to `agents/hatch3r-scalability.md`.
21
+
22
+ This complements (does not duplicate) `rules/hatch3r-resilience-patterns.md` (circuit breakers + retry-with-jitter + timeouts on outbound calls). Resilience is failure handling; scalability is horizontal-growth capability.
23
+
24
+ ## CQ6 Threshold Set
25
+
26
+ Source: pillar CQ6 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle; missing measurement is a Medium finding minimum.
27
+
28
+ | Threshold | Target | Measurement source |
29
+ |-----------|--------|--------------------|
30
+ | Stateless-handler ratio | ≥95% on user-facing routes | Static scan: in-memory session state, module-level mutable globals, sticky-session assumptions in `app/`, `src/handlers/`, `src/routes/`, `pages/api/`, `apps/api/` |
31
+ | Back-pressure pattern adoption | 100% on high-fan-out endpoints | Named pattern (semaphore, queue depth limit, rejection threshold) with documented thresholds |
32
+ | Idempotency-Key adoption | 100% on POST/PUT/PATCH endpoints | Stripe pattern — header acceptance + dedup-result storage + named TTL |
33
+ | Queue-based offloading | 100% for operations >1s | Background-job system + retry policy + dead-letter queue (DLQ) |
34
+ | Connection pool sizing | Per concurrency profile | `pool_size = expected_concurrent_requests × avg_query_time / target_p99` per `agents/hatch3r-scalability.md` §Pool sizing |
35
+ | Horizontal-scaling validation | Load tests at target scale | p99 latency within budget; no resource-pool exhaustion |
36
+
37
+ ## Stateless-Handler Pattern
38
+
39
+ A handler is stateless when ALL hold:
40
+
41
+ - No module-level mutable globals (`let counter = 0` at module scope; `Map` instances re-used across requests).
42
+ - No in-process session storage (sessions stored in Redis, JWT, cookie store — externalized per `rules/hatch3r-auth-patterns.md`).
43
+ - No sticky-session assumption (no logic that depends on the same physical instance handling consecutive requests from the same client).
44
+ - No file-system cache at module scope (caches MUST live in Redis or a distributed store).
45
+
46
+ Per-request request-scoped state is fine. The test is: can two requests from the same client land on different instances and both succeed? If yes, stateless.
47
+
48
+ ## Back-Pressure Pattern
49
+
50
+ A handler is back-pressured when it explicitly bounds in-flight work. Allowed patterns:
51
+
52
+ - **Semaphore** — fixed concurrency cap per handler; new requests reject 429 once the cap is reached.
53
+ - **Queue depth limit** — work pushed onto a queue with a max depth; producer rejects when full.
54
+ - **Rejection threshold** — load-shedding when p99 latency exceeds a documented budget.
55
+ - **Token bucket** — rate-limit per client identifier with named refill rate.
56
+
57
+ Implicit back-pressure (relying on TCP backlog, OS file-descriptor exhaustion, or queue-server overflow) does not satisfy this rule. The handler MUST cite the pattern name + threshold value in a comment near the entry point.
58
+
59
+ ## Idempotency-Key Adoption
60
+
61
+ Source: Stripe `Idempotency-Key` header pattern (https://docs.stripe.com/api/idempotent_requests). On every POST/PUT/PATCH endpoint:
62
+
63
+ 1. Accept the `Idempotency-Key` request header (UUID v4 client-generated).
64
+ 2. On first observation, persist the request hash + response to a dedup store (Redis with TTL ≥24h, or database table with TTL index).
65
+ 3. On repeat observation within TTL, return the persisted response without re-executing the operation.
66
+ 4. Document the TTL in the handler comment + the API spec.
67
+
68
+ Endpoints that explicitly DO NOT mutate state (GET, HEAD, OPTIONS) do not require the key. Endpoints that are inherently idempotent (DELETE with same target) MUST still accept the key for client convenience.
69
+
70
+ ## Queue-Based Offloading
71
+
72
+ Operations >1s wall-clock MUST be moved off the request path:
73
+
74
+ - **Job queue** — Sidekiq, BullMQ, Celery, Hangfire, Quartz; named retry policy (exponential backoff with jitter; max attempts; DLQ).
75
+ - **Async response pattern** — return 202 Accepted with a `Location` header pointing to a status endpoint; client polls or uses webhook callback.
76
+ - **Server-Sent Events / WebSocket** — for streaming progress on long operations.
77
+
78
+ Synchronous handlers performing >1s work without offloading are a CRITICAL finding from the specialist. The 1s threshold is measured at p95 of historical traffic; not the modal time.
79
+
80
+ ## Database Connection Pool Sizing
81
+
82
+ Pool size = `expected_concurrent_requests × avg_query_time / target_p99`. Audit pool-size config against:
83
+
84
+ - `expected_concurrent_requests` = handler concurrency × instance count × steady-state RPS share.
85
+ - `avg_query_time` = p50 query time from observability — cite the data source.
86
+ - `target_p99` = SLO budget for handler latency — cite the SLO declaration.
87
+
88
+ Over-sizing the pool exhausts the database's `max_connections`; under-sizing queues requests and inflates p99. The formula MUST appear in a comment in the pool-init code, with the three values populated from the current measurement.
89
+
90
+ ## Specialist Agent Routing
91
+
92
+ | Trigger | Route to |
93
+ |---------|----------|
94
+ | Handler / route definition added or modified | `agents/hatch3r-scalability.md` (CQ6 review / gate) |
95
+ | Queue client / connection-pool config modified | `agents/hatch3r-scalability.md` |
96
+ | Session storage / cache-layer change | `agents/hatch3r-scalability.md` + `rules/hatch3r-auth-patterns.md` |
97
+ | New endpoint that performs >1s work, accepts POST/PUT/PATCH, or runs on a horizontally-scaled tier | `agents/hatch3r-scalability.md` (Implementer pre-write) |
98
+ | Load-test pre-release | `agents/hatch3r-scalability.md` |
99
+ | Capacity-planning audit (new tenant, marketing event, geographic expansion) | `agents/hatch3r-scalability.md` |
100
+
101
+ ## Per-Finding Output Format
102
+
103
+ Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ6. The `proof_trace` excerpt is the handler:line citation + measurement for the threshold that produced the finding.
104
+
105
+ ## Severity Mapping
106
+
107
+ The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ6 Action per status:
108
+
109
+ - `CRITICAL`: Sync >1s op without offloading; missing Idempotency-Key on POST/PUT/PATCH; sticky-session dependency on horizontally-scaled tier.
110
+ - `FINDINGS`: Stateless-handler ratio <95%; missing back-pressure on high-fan-out endpoint; pool sizing without formula.
111
+ - `PASS`: All thresholds met; surface in iteration summary.
112
+
113
+ ## Irreversibility Trigger
114
+
115
+ Any recommendation that increases connection-pool sizes, changes queue topology (visibility timeout, partition count, DLQ binding), or removes a sticky-session strategy is irreversible at production traffic. These changes MUST go through `agents/shared/user-question-protocol.md` per `rules/hatch3r-clarification-default.md` B1 before action.
116
+
117
+ ## When to Invoke
118
+
119
+ - Every PR that adds or modifies request handlers, route definitions, queue clients, or connection-pool config.
120
+ - Every new endpoint that performs >1s work, accepts POST/PUT/PATCH, or runs on a horizontally-scaled tier.
121
+ - Every change touching session storage, cache layers, or background-job systems.
122
+ - Capacity-planning audits when service traffic projections change (new tenant onboarding, marketing event, geographic expansion).
123
+ - Load-test pre-release before any release that claims horizontal-scaling capability or a new concurrency tier.
124
+
125
+ ## References
126
+
127
+ - Pillar CQ6 (measurement set + specialist owner; see `agents/shared/principles.md`).
128
+ - The content-quality-foundation audit domain (reliability + scalability foundation).
129
+ - `agents/hatch3r-scalability.md` (CQ6 reviewer / gate).
130
+ - `rules/hatch3r-resilience-patterns.md` (failure-handling patterns — distinct from horizontal-growth).
131
+ - `rules/hatch3r-auth-patterns.md` (externalized session storage).
132
+ - Stripe `Idempotency-Key` reference: https://docs.stripe.com/api/idempotent_requests.
@@ -2,8 +2,10 @@
2
2
  id: hatch3r-secrets-management
3
3
  type: rule
4
4
  description: Secret management, rotation, and secure handling patterns for the project
5
- scope: "**/.env*,**/*secret*,**/*credential*,**/*token*,**/config/**,**/.gitignore,**/vault/**,**/*auth*.config*"
6
- tags: [security]
5
+ scope: conditional
6
+ globs: "**/.env*,**/*secret*,**/*credential*,**/*token*,**/config/**,**/.gitignore,**/vault/**,**/*auth*.config*"
7
+ tags: [floor:security]
8
+ precedence: critical
7
9
  quality_charter: agents/shared/quality-charter.md
8
10
  cache_friendly: true
9
11
  ---
@@ -36,6 +38,8 @@ cache_friendly: true
36
38
 
37
39
  ## Cloud Secret Managers
38
40
 
41
+ > Maturity tier: team+ — solo projects may keep secrets in a local `.env` outside git. A managed vault earns its cost once a second engineer, a deployed environment, or a compliance audit enters the picture.
42
+
39
43
  - **AWS Secrets Manager:** Store secrets as JSON key-value pairs. Use IAM policies to scope access per service/role. Enable automatic rotation with Lambda rotation functions. Use `aws-sdk` `GetSecretValue` at runtime — never bake secrets into container images or deployment artifacts.
40
44
  - **GCP Secret Manager:** Store each secret as a versioned resource. Grant `secretmanager.secretAccessor` role per service account with resource-level IAM. Access secrets via `@google-cloud/secret-manager` client library at startup. Use secret versions (not `latest` in production) for auditability.
41
45
  - **Azure Key Vault:** Store secrets, keys, and certificates. Use Managed Identity for authentication — no credentials needed to access the vault. Apply access policies per application identity. Enable soft-delete and purge protection.
@@ -55,6 +59,8 @@ cache_friendly: true
55
59
 
56
60
  ## OIDC Trust-Policy Conditions (Cloud Auth)
57
61
 
62
+ > Maturity tier: team+ — solo projects with no CI-to-cloud federation may defer. OIDC trust-policy hardening matters once CI deploys to a shared cloud account; before that, scoped local credentials are acceptable.
63
+
58
64
  Long-lived cloud secrets (`AWS_ACCESS_KEY_ID`, `GOOGLE_APPLICATION_CREDENTIALS` JSON file, Azure SP password) in CI are an anti-pattern in 2026. GitHub OIDC issues a per-run JWT; the cloud provider's trust policy exchanges it for short-lived credentials scoped to the workflow.
59
65
 
60
66
  - **Branch + environment conditions are required.** The `sub` claim must be matched to a specific `(repository, ref, environment)` triple. PR workflows assume a read-only role; main-branch workflows assume the production role.
@@ -65,6 +71,8 @@ Long-lived cloud secrets (`AWS_ACCESS_KEY_ID`, `GOOGLE_APPLICATION_CREDENTIALS`
65
71
 
66
72
  ## Secret Manager Mandate
67
73
 
74
+ > Maturity tier: scaleup+ — team projects may run a single vault per environment; scaleup adds per-service IAM/IRSA scoping and automated rotation. Solo projects skip this section.
75
+
68
76
  Every production secret lives in a managed vault — AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, HashiCorp Vault, or a SaaS equivalent (Doppler, 1Password Secrets Automation, Infisical). Direct `.env`-file secret storage is permitted only for local development, and the file is never committed.
69
77
 
70
78
  - Repository ships `.env.example` only — a template with placeholder values and per-variable descriptions. Actual `.env` is in `.gitignore`.
@@ -74,6 +82,8 @@ Every production secret lives in a managed vault — AWS Secrets Manager, GCP Se
74
82
 
75
83
  ## Certificate Automation
76
84
 
85
+ > Maturity tier: team+ — solo projects with a single managed-cert endpoint may defer the monitoring + SPKI-pinning controls. Cert-manager and pager alerts become mandatory once a team owns more than one TLS endpoint.
86
+
77
87
  TLS certificate expiry is a recurring outage class — manual renewal is forbidden in production. Automate via ACME.
78
88
 
79
89
  - **Kubernetes:** `cert-manager` with a `ClusterIssuer` pointing at Let's Encrypt (production) or a private ACME server. Use HTTP-01 or DNS-01 solver per environment.
@@ -2,6 +2,7 @@
2
2
  description: Secret management, rotation, and secure handling patterns for the project
3
3
  globs: ["**/.env*", "**/*secret*", "**/*credential*", "**/*token*", "**/config/**", "**/.gitignore", "**/vault/**", "**/*auth*.config*"]
4
4
  alwaysApply: false
5
+ precedence: critical
5
6
  ---
6
7
  # Secrets Management
7
8
 
@@ -32,6 +33,8 @@ alwaysApply: false
32
33
 
33
34
  ## Cloud Secret Managers
34
35
 
36
+ > Maturity tier: team+ — solo projects may keep secrets in a local `.env` outside git. A managed vault earns its cost once a second engineer, a deployed environment, or a compliance audit enters the picture.
37
+
35
38
  - **AWS Secrets Manager:** Store secrets as JSON key-value pairs. Use IAM policies to scope access per service/role. Enable automatic rotation with Lambda rotation functions. Use `aws-sdk` `GetSecretValue` at runtime — never bake secrets into container images or deployment artifacts.
36
39
  - **GCP Secret Manager:** Store each secret as a versioned resource. Grant `secretmanager.secretAccessor` role per service account with resource-level IAM. Access secrets via `@google-cloud/secret-manager` client library at startup. Use secret versions (not `latest` in production) for auditability.
37
40
  - **Azure Key Vault:** Store secrets, keys, and certificates. Use Managed Identity for authentication — no credentials needed to access the vault. Apply access policies per application identity. Enable soft-delete and purge protection.
@@ -51,6 +54,8 @@ alwaysApply: false
51
54
 
52
55
  ## OIDC Trust-Policy Conditions (Cloud Auth)
53
56
 
57
+ > Maturity tier: team+ — solo projects with no CI-to-cloud federation may defer. OIDC trust-policy hardening matters once CI deploys to a shared cloud account; before that, scoped local credentials are acceptable.
58
+
54
59
  Long-lived cloud secrets (`AWS_ACCESS_KEY_ID`, `GOOGLE_APPLICATION_CREDENTIALS` JSON file, Azure SP password) in CI are an anti-pattern in 2026. GitHub OIDC issues a per-run JWT; the cloud provider's trust policy exchanges it for short-lived credentials scoped to the workflow.
55
60
 
56
61
  - **Branch + environment conditions are required.** The `sub` claim must be matched to a specific `(repository, ref, environment)` triple. PR workflows assume a read-only role; main-branch workflows assume the production role.
@@ -61,6 +66,8 @@ Long-lived cloud secrets (`AWS_ACCESS_KEY_ID`, `GOOGLE_APPLICATION_CREDENTIALS`
61
66
 
62
67
  ## Secret Manager Mandate
63
68
 
69
+ > Maturity tier: scaleup+ — team projects may run a single vault per environment; scaleup adds per-service IAM/IRSA scoping and automated rotation. Solo projects skip this section.
70
+
64
71
  Every production secret lives in a managed vault — AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, HashiCorp Vault, or a SaaS equivalent (Doppler, 1Password Secrets Automation, Infisical). Direct `.env`-file secret storage is permitted only for local development, and the file is never committed.
65
72
 
66
73
  - Repository ships `.env.example` only — a template with placeholder values and per-variable descriptions. Actual `.env` is in `.gitignore`.
@@ -70,6 +77,8 @@ Every production secret lives in a managed vault — AWS Secrets Manager, GCP Se
70
77
 
71
78
  ## Certificate Automation
72
79
 
80
+ > Maturity tier: team+ — solo projects with a single managed-cert endpoint may defer the monitoring + SPKI-pinning controls. Cert-manager and pager alerts become mandatory once a team owns more than one TLS endpoint.
81
+
73
82
  TLS certificate expiry is a recurring outage class — manual renewal is forbidden in production. Automate via ACME.
74
83
 
75
84
  - **Kubernetes:** `cert-manager` with a `ClusterIssuer` pointing at Let's Encrypt (production) or a private ACME server. Use HTTP-01 or DNS-01 solver per environment.
@@ -2,8 +2,10 @@
2
2
  id: hatch3r-security-patterns
3
3
  type: rule
4
4
  description: Security patterns including input validation, auth enforcement, and AI/agentic security for the project
5
- scope: "**/auth/**,**/security/**,**/middleware/**,**/*auth*,**/*guard*,**/*policy*,**/*permission*,**/*sanitiz*,**/*validat*"
6
- tags: [security]
5
+ scope: conditional
6
+ globs: "**/security/**,**/*guard*,**/*policy*,**/*permission*,**/*sanitiz*,**/*validat*"
7
+ tags: [floor:security]
8
+ precedence: critical
7
9
  quality_charter: agents/shared/quality-charter.md
8
10
  cache_friendly: true
9
11
  ---
@@ -28,12 +30,7 @@ cache_friendly: true
28
30
 
29
31
  ## Authentication Enforcement
30
32
 
31
- - Auth middleware on every route by default. Public routes require explicit opt-out with code review justification.
32
- - Token validation: pin allowed algorithms (reject `none`), enforce expiry (`exp`), verify audience (`aud`) and issuer (`iss`) claims. Reject tokens failing any check.
33
- - Session security: `HttpOnly`, `Secure`, `SameSite=Strict` (or `Lax` with justification) cookies. Rotate session ID on privilege change (login, role switch).
34
- - Multi-factor authentication for sensitive operations: admin actions, payment, account deletion, API key generation.
35
- - Rate-limit authentication endpoints (login, token refresh, password reset). Lock accounts or add progressive delays after repeated failures.
36
- - Invalidate all sessions on password change. Provide "sign out everywhere" capability.
33
+ Authentication and authorization patterns (auth middleware, token validation, session security, MFA/AAL mapping, rate-limiting auth endpoints) are owned canonically by `rules/hatch3r-auth-patterns.md`. That rule activates on `**/auth/**`, `**/login/**`, `**/session/**`, `**/middleware/**`, and related globs; this rule no longer restates them, so the two no longer double-fire on the same files. For OWASP A07 in the web-app context see the §A07 section below.
37
34
 
38
35
  ## Fail-Closed Defaults
39
36
 
@@ -137,6 +134,8 @@ cache_friendly: true
137
134
 
138
135
  ## OWASP Top 10 2025 (Web Application Security)
139
136
 
137
+ Subsection order and titles follow the official OWASP Top 10:2025 release (https://owasp.org/Top10/2025/, accessed 2026-06-05). The 2025 list reorders the 2021 set: Security Misconfiguration rises to A02, A03 becomes Software Supply Chain Failures (an expansion of 2021's Vulnerable and Outdated Components), and Injection moves to A05.
138
+
140
139
  ### A01 — Broken Access Control
141
140
 
142
141
  - Enforce access control server-side. Client-side checks are UX, not security.
@@ -146,7 +145,32 @@ cache_friendly: true
146
145
  - Rate-limit API access to minimize automated IDOR scanning and credential stuffing.
147
146
  - Log access control failures and alert on repeated violations from the same identity.
148
147
 
149
- ### A02 — Cryptographic Failures
148
+ ### A02 — Security Misconfiguration
149
+
150
+ - Harden all environments: remove default accounts, disable unused features/ports/services, remove sample applications.
151
+ - Use identical security configuration across development, staging, and production. Differences in security settings between environments mask vulnerabilities.
152
+ - Automate configuration verification: infrastructure-as-code with security baselines, configuration scanning in CI.
153
+ - Send security headers on every response (HSTS, CSP, X-Content-Type-Options, X-Frame-Options). Centralize in middleware.
154
+ - Review cloud permissions quarterly. Remove unused IAM roles, security groups, and service accounts.
155
+ - Disable detailed error messages in production. Use generic error responses with correlation IDs for debugging.
156
+
157
+ ### A03 — Software Supply Chain Failures
158
+
159
+ Expands 2021's Vulnerable and Outdated Components to cover the full dependency, build, and distribution chain — third-party code, build tools, CI/CD systems, and package registries.
160
+
161
+ - Maintain a software bill of materials (SBOM) for all direct and transitive dependencies.
162
+ - Run `npm audit` (or equivalent) in CI on every build. Block merges with critical or high vulnerabilities.
163
+ - Subscribe to security advisories for all critical dependencies using the platform's built-in tools or third-party equivalents:
164
+ - **GitHub:** Dependabot alerts and security advisories
165
+ - **Azure DevOps:** Microsoft Defender for DevOps or WhiteSource/Mend integration
166
+ - **GitLab:** GitLab Dependency Scanning CI template, or Snyk integration
167
+ - Remove unused dependencies. Unused code with known vulnerabilities is still a risk.
168
+ - Pin dependency versions in lockfiles. Review lockfile changes in PRs with the same scrutiny as code changes.
169
+ - Verify package provenance: prefer signed packages, scoped registries, and `npm ci` over `npm install`. Reject `npx -y` on untrusted names (typosquatting / dependency confusion).
170
+ - Harden the build pipeline itself: pin CI actions by commit SHA, restrict who can modify pipeline config, and treat build secrets as production credentials.
171
+ - Establish SLAs for vulnerability remediation: critical within 24 hours, high within 1 week, moderate within 1 sprint.
172
+
173
+ ### A04 — Cryptographic Failures
150
174
 
151
175
  - Classify data by sensitivity (PII, financial, health, credentials). Apply encryption requirements per classification.
152
176
  - Encrypt data in transit (TLS 1.2+ mandatory, prefer 1.3) and at rest (AES-256 or equivalent).
@@ -155,7 +179,7 @@ cache_friendly: true
155
179
  - Generate cryptographic keys with secure random sources (`crypto.randomBytes`, not `Math.random`). Never hard-code keys or IVs.
156
180
  - Disable caching for responses containing sensitive data (`Cache-Control: no-store`).
157
181
 
158
- ### A03 — Injection
182
+ ### A05 — Injection
159
183
 
160
184
  - Use parameterized queries or prepared statements for all database operations. Zero tolerance for string concatenation with user input in queries.
161
185
  - Apply context-aware output encoding: HTML entities, URL encoding, JavaScript escaping, CSS escaping, LDAP escaping — matched to the output context.
@@ -163,7 +187,7 @@ cache_friendly: true
163
187
  - Use `LIMIT` and pagination in queries to prevent mass data disclosure via injection.
164
188
  - For OS command execution: avoid entirely if possible. If necessary, use parameterized APIs (not shell interpolation) with strict input validation.
165
189
 
166
- ### A04 — Insecure Design
190
+ ### A06 — Insecure Design
167
191
 
168
192
  - Use threat modeling during design phase (STRIDE, attack trees, or equivalent). Identify trust boundaries and abuse cases before writing code.
169
193
  - Establish and enforce secure design patterns: separation of concerns, defense in depth, least privilege, fail-closed.
@@ -171,28 +195,7 @@ cache_friendly: true
171
195
  - Design rate limiting, resource quotas, and cost controls into the architecture — not as afterthoughts.
172
196
  - Establish secure development lifecycle (SDL) practices: security requirements, design review, code review, testing.
173
197
 
174
- ### A05Security Misconfiguration
175
-
176
- - Harden all environments: remove default accounts, disable unused features/ports/services, remove sample applications.
177
- - Use identical security configuration across development, staging, and production. Differences in security settings between environments mask vulnerabilities.
178
- - Automate configuration verification: infrastructure-as-code with security baselines, configuration scanning in CI.
179
- - Send security headers on every response (HSTS, CSP, X-Content-Type-Options, X-Frame-Options). Centralize in middleware.
180
- - Review cloud permissions quarterly. Remove unused IAM roles, security groups, and service accounts.
181
- - Disable detailed error messages in production. Use generic error responses with correlation IDs for debugging.
182
-
183
- ### A06 — Vulnerable and Outdated Components
184
-
185
- - Maintain a software bill of materials (SBOM) for all direct and transitive dependencies.
186
- - Run `npm audit` (or equivalent) in CI on every build. Block merges with critical or high vulnerabilities.
187
- - Subscribe to security advisories for all critical dependencies using the platform's built-in tools or third-party equivalents:
188
- - **GitHub:** Dependabot alerts and security advisories
189
- - **Azure DevOps:** Microsoft Defender for DevOps or WhiteSource/Mend integration
190
- - **GitLab:** GitLab Dependency Scanning CI template, or Snyk integration
191
- - Remove unused dependencies. Unused code with known vulnerabilities is still a risk.
192
- - Pin dependency versions in lockfiles. Review lockfile changes in PRs with the same scrutiny as code changes.
193
- - Establish SLAs for vulnerability remediation: critical within 24 hours, high within 1 week, moderate within 1 sprint.
194
-
195
- ### A07 — Identification and Authentication Failures
198
+ ### A07Authentication Failures
196
199
 
197
200
  - Implement multi-factor authentication for privileged accounts and sensitive operations.
198
201
  - Enforce password complexity requirements: minimum 8 characters, check against breached password databases (Have I Been Pwned API).
@@ -201,7 +204,7 @@ cache_friendly: true
201
204
  - Never expose session IDs in URLs. Use secure, HttpOnly, SameSite cookies.
202
205
  - Implement account lockout with notification after repeated failed attempts.
203
206
 
204
- ### A08 — Software and Data Integrity Failures
207
+ ### A08 — Software or Data Integrity Failures
205
208
 
206
209
  - Verify integrity of all software updates, dependencies, and CI/CD pipeline artifacts using digital signatures or checksums.
207
210
  - Use lockfiles and verify their integrity. `npm ci` (not `npm install`) in CI for deterministic builds that fail on lockfile drift.
@@ -213,7 +216,7 @@ cache_friendly: true
213
216
  - **Azure DevOps:** Pin pipeline tasks by exact version (e.g., `task@2`)
214
217
  - **GitLab CI:** Pin included templates by SHA or tag reference
215
218
 
216
- ### A09 — Security Logging and Monitoring Failures
219
+ ### A09 — Security Logging and Alerting Failures
217
220
 
218
221
  - Log all authentication events (success, failure, lockout), access control failures, input validation failures, and security-relevant business events.
219
222
  - Use structured logging with correlation IDs. Include: timestamp, severity, event type, user identity (if available), source IP, resource accessed, outcome.