@bonesofspring/ai-rules 0.2.20 → 0.2.22

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 (505) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +17 -2
  3. package/bin/cli.js +83 -6
  4. package/package.json +5 -2
  5. package/presets/_shared/README.md +2 -1
  6. package/presets/_shared/assets/docs-specs/INDEX.md +4 -1
  7. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +15 -0
  8. package/presets/_shared/core/agent-team/agent-task-metrics.md +1 -1
  9. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -3
  10. package/presets/_shared/core/meta/preset-pr-checklist.md +5 -1
  11. package/presets/_shared/core/meta/preset-token-budget.md +7 -3
  12. package/presets/_shared/core/meta/preset-twin-sync.md +2 -0
  13. package/presets/_shared/core/testing/testing-principles.md +70 -0
  14. package/presets/claude/android-kotlin/agents/README.md +2 -1
  15. package/presets/claude/android-kotlin/agents/build-verifier.md +2 -0
  16. package/presets/claude/android-kotlin/agents/code-reviewer.md +2 -0
  17. package/presets/claude/android-kotlin/agents/debugger.md +1 -0
  18. package/presets/claude/android-kotlin/agents/feature-developer.md +4 -1
  19. package/presets/claude/android-kotlin/agents/openspec-author.md +163 -0
  20. package/presets/claude/android-kotlin/agents/qa-tester.md +2 -0
  21. package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
  22. package/presets/claude/android-kotlin/agents/task-router.md +9 -1
  23. package/presets/claude/android-kotlin/agents/tech-writer.md +4 -0
  24. package/presets/claude/android-kotlin/commands/README.md +0 -2
  25. package/presets/claude/android-kotlin/commands/task-continue.md +1 -1
  26. package/presets/claude/android-kotlin/commands/task.md +1 -5
  27. package/presets/claude/android-kotlin/commands/technical-retro.md +2 -2
  28. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +105 -13
  29. package/presets/claude/android-kotlin/rules/README.md +1 -0
  30. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +7 -4
  31. package/presets/claude/android-kotlin/rules/tooling-and-review/ai-local-overlay.md +48 -0
  32. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  33. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-token-budget.md +7 -3
  34. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +2 -0
  35. package/presets/claude/go/README.md +1 -1
  36. package/presets/claude/go/agents/README.md +3 -2
  37. package/presets/claude/go/agents/build-verifier.md +4 -0
  38. package/presets/claude/go/agents/code-reviewer.md +4 -0
  39. package/presets/claude/go/agents/debugger.md +4 -0
  40. package/presets/claude/go/agents/feature-developer.md +5 -0
  41. package/presets/claude/go/agents/openspec-author.md +163 -0
  42. package/presets/claude/go/agents/qa-tester.md +4 -0
  43. package/presets/claude/go/agents/task-router.md +9 -1
  44. package/presets/claude/go/agents/tech-writer.md +4 -0
  45. package/presets/claude/go/commands/README.md +0 -2
  46. package/presets/claude/go/commands/task-continue.md +1 -1
  47. package/presets/claude/go/commands/task.md +1 -4
  48. package/presets/claude/go/hooks/chain-team-phases.sh +105 -14
  49. package/presets/claude/go/rules/README.md +1 -0
  50. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +2 -4
  51. package/presets/claude/go/rules/tooling-and-review/ai-local-overlay.md +48 -0
  52. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  53. package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +7 -3
  54. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +2 -0
  55. package/presets/claude/ios-swift/agents/README.md +3 -2
  56. package/presets/claude/ios-swift/agents/build-verifier.md +2 -0
  57. package/presets/claude/ios-swift/agents/code-reviewer.md +2 -0
  58. package/presets/claude/ios-swift/agents/debugger.md +1 -0
  59. package/presets/claude/ios-swift/agents/feature-developer.md +4 -1
  60. package/presets/claude/ios-swift/agents/openspec-author.md +163 -0
  61. package/presets/claude/ios-swift/agents/qa-tester.md +2 -0
  62. package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
  63. package/presets/claude/ios-swift/agents/task-router.md +9 -1
  64. package/presets/claude/ios-swift/agents/tech-writer.md +4 -0
  65. package/presets/claude/ios-swift/commands/README.md +0 -2
  66. package/presets/claude/ios-swift/commands/task-continue.md +1 -1
  67. package/presets/claude/ios-swift/commands/task.md +1 -5
  68. package/presets/claude/ios-swift/commands/technical-retro.md +2 -2
  69. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +105 -13
  70. package/presets/claude/ios-swift/rules/README.md +1 -0
  71. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +7 -4
  72. package/presets/claude/ios-swift/rules/tooling-and-review/ai-local-overlay.md +48 -0
  73. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  74. package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +7 -3
  75. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +2 -0
  76. package/presets/claude/java/CLAUDE.md +1 -1
  77. package/presets/claude/java/agents/README.md +3 -2
  78. package/presets/claude/java/agents/build-verifier.md +4 -0
  79. package/presets/claude/java/agents/code-reviewer.md +4 -0
  80. package/presets/claude/java/agents/debugger.md +4 -0
  81. package/presets/claude/java/agents/feature-developer.md +5 -0
  82. package/presets/claude/java/agents/openspec-author.md +163 -0
  83. package/presets/claude/java/agents/qa-tester.md +4 -0
  84. package/presets/claude/java/agents/task-router.md +9 -1
  85. package/presets/claude/java/agents/tech-writer.md +4 -0
  86. package/presets/claude/java/commands/README.md +0 -2
  87. package/presets/claude/java/commands/task-continue.md +1 -1
  88. package/presets/claude/java/commands/task.md +1 -4
  89. package/presets/claude/java/hooks/chain-team-phases.sh +105 -14
  90. package/presets/claude/java/rules/README.md +1 -0
  91. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +2 -4
  92. package/presets/claude/java/rules/tooling-and-review/ai-local-overlay.md +48 -0
  93. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  94. package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +7 -3
  95. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +2 -0
  96. package/presets/claude/mcp-ts/agents/build-verifier.md +4 -0
  97. package/presets/claude/mcp-ts/agents/feature-developer.md +5 -0
  98. package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
  99. package/presets/claude/mcp-ts/agents/task-router.md +1 -1
  100. package/presets/claude/mcp-ts/commands/README.md +0 -2
  101. package/presets/claude/mcp-ts/commands/task-continue.md +1 -1
  102. package/presets/claude/mcp-ts/commands/task.md +1 -4
  103. package/presets/claude/mcp-ts/commands/technical-retro.md +2 -2
  104. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +91 -20
  105. package/presets/claude/mcp-ts/rules/README.md +1 -0
  106. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +2 -4
  107. package/presets/claude/mcp-ts/rules/tooling-and-review/ai-local-overlay.md +48 -0
  108. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  109. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-token-budget.md +7 -3
  110. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +2 -0
  111. package/presets/claude/next/README.md +1 -0
  112. package/presets/claude/next/agents/README.md +2 -2
  113. package/presets/claude/next/agents/build-verifier.md +13 -1
  114. package/presets/claude/next/agents/code-reviewer.md +2 -0
  115. package/presets/claude/next/agents/debugger.md +4 -0
  116. package/presets/claude/next/agents/feature-developer.md +4 -1
  117. package/presets/claude/next/agents/openspec-author.md +163 -0
  118. package/presets/claude/next/agents/qa-tester.md +4 -0
  119. package/presets/claude/next/agents/task-analyst.md +1 -1
  120. package/presets/claude/next/agents/task-router.md +5 -1
  121. package/presets/claude/next/agents/tech-writer.md +4 -0
  122. package/presets/claude/next/agents/unit-test-generator.md +1 -1
  123. package/presets/claude/next/agents/unit-test-planner.md +1 -1
  124. package/presets/claude/next/commands/README.md +0 -2
  125. package/presets/claude/next/commands/task-continue.md +1 -1
  126. package/presets/claude/next/commands/task.md +1 -4
  127. package/presets/claude/next/hooks/chain-team-phases.sh +105 -13
  128. package/presets/claude/next/rules/README.md +1 -0
  129. package/presets/claude/next/rules/api-and-data/http-client.md +1 -1
  130. package/presets/claude/next/rules/architecture/reference-features.md +1 -1
  131. package/presets/claude/next/rules/testing/README.md +7 -1
  132. package/presets/claude/next/rules/testing/tests-e2e-structure.md +86 -48
  133. package/presets/claude/next/rules/testing/tests-unit.md +78 -51
  134. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +3 -4
  135. package/presets/claude/next/rules/tooling-and-review/ai-local-overlay.md +48 -0
  136. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  137. package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +7 -3
  138. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +2 -0
  139. package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +1 -1
  140. package/presets/claude/next/skills/playwright-e2e/SKILL.md +5 -3
  141. package/presets/claude/next/skills/unit-testing/SKILL.md +6 -4
  142. package/presets/claude/next/team/README.md +0 -3
  143. package/presets/claude/nuxt/agents/README.md +1 -1
  144. package/presets/claude/nuxt/agents/build-verifier.md +2 -0
  145. package/presets/claude/nuxt/agents/code-reviewer.md +2 -0
  146. package/presets/claude/nuxt/agents/debugger.md +4 -0
  147. package/presets/claude/nuxt/agents/feature-developer.md +4 -1
  148. package/presets/claude/nuxt/agents/openspec-author.md +163 -0
  149. package/presets/claude/nuxt/agents/qa-tester.md +4 -0
  150. package/presets/claude/nuxt/agents/task-analyst.md +1 -1
  151. package/presets/claude/nuxt/agents/task-router.md +5 -1
  152. package/presets/claude/nuxt/agents/tech-writer.md +4 -0
  153. package/presets/claude/nuxt/commands/README.md +0 -2
  154. package/presets/claude/nuxt/commands/task-continue.md +1 -1
  155. package/presets/claude/nuxt/commands/task.md +1 -5
  156. package/presets/claude/nuxt/commands/technical-retro.md +2 -2
  157. package/presets/claude/nuxt/hooks/chain-team-phases.sh +105 -13
  158. package/presets/claude/nuxt/rules/README.md +1 -0
  159. package/presets/claude/nuxt/rules/testing/README.md +6 -0
  160. package/presets/claude/nuxt/rules/testing/tests-e2e-structure.md +86 -43
  161. package/presets/claude/nuxt/rules/testing/tests-unit.md +58 -45
  162. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +8 -5
  163. package/presets/claude/nuxt/rules/tooling-and-review/ai-local-overlay.md +48 -0
  164. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  165. package/presets/claude/nuxt/rules/tooling-and-review/preset-token-budget.md +7 -3
  166. package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +2 -0
  167. package/presets/claude/nuxt/team/README.md +0 -3
  168. package/presets/claude/php-hexagonal/CLAUDE.md +1 -1
  169. package/presets/claude/php-hexagonal/agents/README.md +3 -2
  170. package/presets/claude/php-hexagonal/agents/build-verifier.md +4 -0
  171. package/presets/claude/php-hexagonal/agents/code-reviewer.md +4 -0
  172. package/presets/claude/php-hexagonal/agents/debugger.md +4 -0
  173. package/presets/claude/php-hexagonal/agents/feature-developer.md +5 -0
  174. package/presets/claude/php-hexagonal/agents/openspec-author.md +163 -0
  175. package/presets/claude/php-hexagonal/agents/qa-tester.md +4 -0
  176. package/presets/claude/php-hexagonal/agents/task-router.md +9 -1
  177. package/presets/claude/php-hexagonal/agents/tech-writer.md +4 -0
  178. package/presets/claude/php-hexagonal/commands/README.md +0 -2
  179. package/presets/claude/php-hexagonal/commands/task-continue.md +1 -1
  180. package/presets/claude/php-hexagonal/commands/task.md +1 -4
  181. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +105 -14
  182. package/presets/claude/php-hexagonal/rules/README.md +1 -0
  183. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +2 -4
  184. package/presets/claude/php-hexagonal/rules/tooling-and-review/ai-local-overlay.md +48 -0
  185. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  186. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-token-budget.md +7 -3
  187. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +2 -0
  188. package/presets/claude/php-laravel/agents/README.md +3 -2
  189. package/presets/claude/php-laravel/agents/build-verifier.md +4 -0
  190. package/presets/claude/php-laravel/agents/code-reviewer.md +4 -0
  191. package/presets/claude/php-laravel/agents/debugger.md +4 -0
  192. package/presets/claude/php-laravel/agents/feature-developer.md +5 -0
  193. package/presets/claude/php-laravel/agents/openspec-author.md +163 -0
  194. package/presets/claude/php-laravel/agents/qa-tester.md +4 -0
  195. package/presets/claude/php-laravel/agents/task-router.md +6 -1
  196. package/presets/claude/php-laravel/agents/tech-writer.md +4 -0
  197. package/presets/claude/php-laravel/commands/README.md +0 -2
  198. package/presets/claude/php-laravel/commands/task-continue.md +1 -1
  199. package/presets/claude/php-laravel/commands/task.md +1 -4
  200. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +105 -14
  201. package/presets/claude/php-laravel/rules/README.md +1 -0
  202. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +2 -4
  203. package/presets/claude/php-laravel/rules/tooling-and-review/ai-local-overlay.md +48 -0
  204. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  205. package/presets/claude/php-laravel/rules/tooling-and-review/preset-token-budget.md +7 -3
  206. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +2 -0
  207. package/presets/claude/svelte/agents/README.md +1 -1
  208. package/presets/claude/svelte/agents/build-verifier.md +2 -0
  209. package/presets/claude/svelte/agents/code-reviewer.md +2 -0
  210. package/presets/claude/svelte/agents/debugger.md +4 -0
  211. package/presets/claude/svelte/agents/feature-developer.md +4 -1
  212. package/presets/claude/svelte/agents/openspec-author.md +163 -0
  213. package/presets/claude/svelte/agents/qa-tester.md +4 -0
  214. package/presets/claude/svelte/agents/task-analyst.md +1 -1
  215. package/presets/claude/svelte/agents/task-router.md +5 -1
  216. package/presets/claude/svelte/agents/tech-writer.md +4 -0
  217. package/presets/claude/svelte/commands/README.md +0 -2
  218. package/presets/claude/svelte/commands/task-continue.md +1 -1
  219. package/presets/claude/svelte/commands/task.md +1 -5
  220. package/presets/claude/svelte/commands/technical-retro.md +2 -2
  221. package/presets/claude/svelte/hooks/chain-team-phases.sh +105 -13
  222. package/presets/claude/svelte/rules/README.md +1 -0
  223. package/presets/claude/svelte/rules/testing/README.md +6 -0
  224. package/presets/claude/svelte/rules/testing/tests-e2e-structure.md +87 -45
  225. package/presets/claude/svelte/rules/testing/tests-unit.md +70 -23
  226. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +8 -5
  227. package/presets/claude/svelte/rules/tooling-and-review/ai-local-overlay.md +48 -0
  228. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +5 -1
  229. package/presets/claude/svelte/rules/tooling-and-review/preset-token-budget.md +7 -3
  230. package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +2 -0
  231. package/presets/claude/svelte/team/README.md +0 -3
  232. package/presets/cursor/android-kotlin/agents/README.md +2 -1
  233. package/presets/cursor/android-kotlin/agents/build-verifier.md +2 -0
  234. package/presets/cursor/android-kotlin/agents/code-reviewer.md +2 -0
  235. package/presets/cursor/android-kotlin/agents/debugger.md +1 -0
  236. package/presets/cursor/android-kotlin/agents/feature-developer.md +4 -1
  237. package/presets/cursor/android-kotlin/agents/openspec-author.md +164 -0
  238. package/presets/cursor/android-kotlin/agents/qa-tester.md +2 -0
  239. package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
  240. package/presets/cursor/android-kotlin/agents/task-router.md +9 -1
  241. package/presets/cursor/android-kotlin/agents/tech-writer.md +4 -0
  242. package/presets/cursor/android-kotlin/commands/README.md +0 -2
  243. package/presets/cursor/android-kotlin/commands/task-continue.md +1 -1
  244. package/presets/cursor/android-kotlin/commands/task.md +1 -5
  245. package/presets/cursor/android-kotlin/commands/technical-retro.md +2 -2
  246. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +105 -13
  247. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +7 -4
  248. package/presets/cursor/android-kotlin/rules/ai-local-overlay.mdc +43 -0
  249. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +5 -1
  250. package/presets/cursor/android-kotlin/rules/preset-token-budget.mdc +7 -3
  251. package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +2 -0
  252. package/presets/cursor/go/README.md +6 -6
  253. package/presets/cursor/go/agents/README.md +3 -2
  254. package/presets/cursor/go/agents/build-verifier.md +4 -0
  255. package/presets/cursor/go/agents/code-reviewer.md +4 -0
  256. package/presets/cursor/go/agents/debugger.md +4 -0
  257. package/presets/cursor/go/agents/feature-developer.md +5 -0
  258. package/presets/cursor/go/agents/openspec-author.md +164 -0
  259. package/presets/cursor/go/agents/qa-tester.md +4 -0
  260. package/presets/cursor/go/agents/task-router.md +9 -1
  261. package/presets/cursor/go/agents/tech-writer.md +4 -0
  262. package/presets/cursor/go/commands/README.md +0 -2
  263. package/presets/cursor/go/commands/task-continue.md +1 -1
  264. package/presets/cursor/go/commands/task.md +1 -4
  265. package/presets/cursor/go/commands/technical-retro.md +2 -2
  266. package/presets/cursor/go/hooks/chain-team-phases.sh +105 -14
  267. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -4
  268. package/presets/cursor/go/rules/ai-local-overlay.mdc +43 -0
  269. package/presets/cursor/go/rules/preset-pr-checklist.mdc +5 -1
  270. package/presets/cursor/go/rules/preset-token-budget.mdc +7 -3
  271. package/presets/cursor/go/rules/preset-twin-sync.mdc +2 -0
  272. package/presets/cursor/ios-swift/README.md +6 -6
  273. package/presets/cursor/ios-swift/agents/README.md +3 -2
  274. package/presets/cursor/ios-swift/agents/build-verifier.md +2 -0
  275. package/presets/cursor/ios-swift/agents/code-reviewer.md +2 -0
  276. package/presets/cursor/ios-swift/agents/debugger.md +1 -0
  277. package/presets/cursor/ios-swift/agents/feature-developer.md +4 -1
  278. package/presets/cursor/ios-swift/agents/openspec-author.md +164 -0
  279. package/presets/cursor/ios-swift/agents/qa-tester.md +2 -0
  280. package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
  281. package/presets/cursor/ios-swift/agents/task-router.md +9 -1
  282. package/presets/cursor/ios-swift/agents/tech-writer.md +4 -0
  283. package/presets/cursor/ios-swift/commands/README.md +1 -3
  284. package/presets/cursor/ios-swift/commands/task-continue.md +1 -1
  285. package/presets/cursor/ios-swift/commands/task.md +1 -5
  286. package/presets/cursor/ios-swift/commands/technical-retro.md +2 -2
  287. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +105 -13
  288. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +7 -4
  289. package/presets/cursor/ios-swift/rules/ai-local-overlay.mdc +43 -0
  290. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +5 -1
  291. package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +7 -3
  292. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +2 -0
  293. package/presets/cursor/java/AGENTS.md +1 -1
  294. package/presets/cursor/java/agents/README.md +3 -2
  295. package/presets/cursor/java/agents/build-verifier.md +4 -0
  296. package/presets/cursor/java/agents/code-reviewer.md +4 -0
  297. package/presets/cursor/java/agents/debugger.md +4 -0
  298. package/presets/cursor/java/agents/feature-developer.md +5 -0
  299. package/presets/cursor/java/agents/openspec-author.md +164 -0
  300. package/presets/cursor/java/agents/qa-tester.md +4 -0
  301. package/presets/cursor/java/agents/task-router.md +9 -1
  302. package/presets/cursor/java/agents/tech-writer.md +4 -0
  303. package/presets/cursor/java/commands/README.md +0 -2
  304. package/presets/cursor/java/commands/task-continue.md +1 -1
  305. package/presets/cursor/java/commands/task.md +1 -4
  306. package/presets/cursor/java/commands/technical-retro.md +2 -2
  307. package/presets/cursor/java/hooks/chain-team-phases.sh +105 -14
  308. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -4
  309. package/presets/cursor/java/rules/ai-local-overlay.mdc +43 -0
  310. package/presets/cursor/java/rules/preset-pr-checklist.mdc +5 -1
  311. package/presets/cursor/java/rules/preset-token-budget.mdc +7 -3
  312. package/presets/cursor/java/rules/preset-twin-sync.mdc +2 -0
  313. package/presets/cursor/mcp-ts/agents/build-verifier.md +4 -0
  314. package/presets/cursor/mcp-ts/agents/feature-developer.md +5 -0
  315. package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
  316. package/presets/cursor/mcp-ts/agents/task-router.md +1 -1
  317. package/presets/cursor/mcp-ts/commands/README.md +0 -2
  318. package/presets/cursor/mcp-ts/commands/task-continue.md +1 -1
  319. package/presets/cursor/mcp-ts/commands/task.md +1 -4
  320. package/presets/cursor/mcp-ts/commands/technical-retro.md +2 -2
  321. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +91 -20
  322. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -4
  323. package/presets/cursor/mcp-ts/rules/ai-local-overlay.mdc +43 -0
  324. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +5 -1
  325. package/presets/cursor/mcp-ts/rules/preset-token-budget.mdc +7 -3
  326. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +2 -0
  327. package/presets/cursor/next/README.md +8 -6
  328. package/presets/cursor/next/REPO_AGENTS.md +8 -0
  329. package/presets/cursor/next/agents/README.md +2 -2
  330. package/presets/cursor/next/agents/build-verifier.md +13 -1
  331. package/presets/cursor/next/agents/code-reviewer.md +2 -0
  332. package/presets/cursor/next/agents/debugger.md +4 -0
  333. package/presets/cursor/next/agents/feature-developer.md +4 -1
  334. package/presets/cursor/next/agents/openspec-author.md +164 -0
  335. package/presets/cursor/next/agents/qa-tester.md +4 -0
  336. package/presets/cursor/next/agents/task-analyst.md +1 -1
  337. package/presets/cursor/next/agents/task-router.md +5 -1
  338. package/presets/cursor/next/agents/tech-writer.md +4 -0
  339. package/presets/cursor/next/agents/unit-test-generator.md +1 -1
  340. package/presets/cursor/next/agents/unit-test-planner.md +1 -1
  341. package/presets/cursor/next/commands/README.md +0 -2
  342. package/presets/cursor/next/commands/task-continue.md +1 -1
  343. package/presets/cursor/next/commands/task.md +1 -4
  344. package/presets/cursor/next/commands/technical-retro.md +2 -2
  345. package/presets/cursor/next/hooks/chain-team-phases.sh +105 -13
  346. package/presets/cursor/next/rules/README.md +6 -3
  347. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +7 -5
  348. package/presets/cursor/next/rules/ai-local-overlay.mdc +43 -0
  349. package/presets/cursor/next/rules/http-client.mdc +1 -1
  350. package/presets/cursor/next/rules/preset-pr-checklist.mdc +5 -1
  351. package/presets/cursor/next/rules/preset-token-budget.mdc +7 -3
  352. package/presets/cursor/next/rules/preset-twin-sync.mdc +2 -0
  353. package/presets/cursor/next/rules/react-ui.mdc +1 -1
  354. package/presets/cursor/next/rules/reference-features.mdc +1 -1
  355. package/presets/cursor/next/rules/tests-e2e-structure.mdc +85 -43
  356. package/presets/cursor/next/rules/tests-unit.mdc +79 -48
  357. package/presets/cursor/next/skills/playwright-e2e/SKILL.md +5 -3
  358. package/presets/cursor/next/skills/unit-testing/SKILL.md +6 -4
  359. package/presets/cursor/next/team/README.md +0 -3
  360. package/presets/cursor/nuxt/README.md +6 -6
  361. package/presets/cursor/nuxt/agents/README.md +1 -1
  362. package/presets/cursor/nuxt/agents/build-verifier.md +2 -0
  363. package/presets/cursor/nuxt/agents/code-reviewer.md +2 -0
  364. package/presets/cursor/nuxt/agents/debugger.md +4 -0
  365. package/presets/cursor/nuxt/agents/feature-developer.md +4 -1
  366. package/presets/cursor/nuxt/agents/openspec-author.md +164 -0
  367. package/presets/cursor/nuxt/agents/qa-tester.md +4 -0
  368. package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
  369. package/presets/cursor/nuxt/agents/task-router.md +5 -1
  370. package/presets/cursor/nuxt/agents/tech-writer.md +4 -0
  371. package/presets/cursor/nuxt/commands/README.md +0 -2
  372. package/presets/cursor/nuxt/commands/task-continue.md +1 -1
  373. package/presets/cursor/nuxt/commands/task.md +1 -5
  374. package/presets/cursor/nuxt/commands/technical-retro.md +2 -2
  375. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +105 -13
  376. package/presets/cursor/nuxt/rules/README.md +3 -1
  377. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +8 -5
  378. package/presets/cursor/nuxt/rules/ai-local-overlay.mdc +43 -0
  379. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +5 -1
  380. package/presets/cursor/nuxt/rules/preset-token-budget.mdc +7 -3
  381. package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +2 -0
  382. package/presets/cursor/nuxt/rules/tests-e2e-structure.mdc +87 -43
  383. package/presets/cursor/nuxt/rules/tests-unit.mdc +62 -47
  384. package/presets/cursor/nuxt/team/README.md +0 -3
  385. package/presets/cursor/php-hexagonal/AGENTS.md +1 -1
  386. package/presets/cursor/php-hexagonal/agents/README.md +3 -2
  387. package/presets/cursor/php-hexagonal/agents/build-verifier.md +4 -0
  388. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +4 -0
  389. package/presets/cursor/php-hexagonal/agents/debugger.md +4 -0
  390. package/presets/cursor/php-hexagonal/agents/feature-developer.md +5 -0
  391. package/presets/cursor/php-hexagonal/agents/openspec-author.md +164 -0
  392. package/presets/cursor/php-hexagonal/agents/qa-tester.md +4 -0
  393. package/presets/cursor/php-hexagonal/agents/task-router.md +9 -1
  394. package/presets/cursor/php-hexagonal/agents/tech-writer.md +4 -0
  395. package/presets/cursor/php-hexagonal/commands/README.md +0 -2
  396. package/presets/cursor/php-hexagonal/commands/task-continue.md +1 -1
  397. package/presets/cursor/php-hexagonal/commands/task.md +1 -4
  398. package/presets/cursor/php-hexagonal/commands/technical-retro.md +2 -2
  399. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +105 -14
  400. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -4
  401. package/presets/cursor/php-hexagonal/rules/ai-local-overlay.mdc +43 -0
  402. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +5 -1
  403. package/presets/cursor/php-hexagonal/rules/preset-token-budget.mdc +7 -3
  404. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +2 -0
  405. package/presets/cursor/php-laravel/AGENTS.md +1 -1
  406. package/presets/cursor/php-laravel/agents/README.md +3 -2
  407. package/presets/cursor/php-laravel/agents/build-verifier.md +4 -0
  408. package/presets/cursor/php-laravel/agents/code-reviewer.md +4 -0
  409. package/presets/cursor/php-laravel/agents/debugger.md +4 -0
  410. package/presets/cursor/php-laravel/agents/feature-developer.md +5 -0
  411. package/presets/cursor/php-laravel/agents/openspec-author.md +164 -0
  412. package/presets/cursor/php-laravel/agents/qa-tester.md +4 -0
  413. package/presets/cursor/php-laravel/agents/task-router.md +6 -1
  414. package/presets/cursor/php-laravel/agents/tech-writer.md +4 -0
  415. package/presets/cursor/php-laravel/commands/README.md +0 -2
  416. package/presets/cursor/php-laravel/commands/task-continue.md +1 -1
  417. package/presets/cursor/php-laravel/commands/task.md +1 -4
  418. package/presets/cursor/php-laravel/commands/technical-retro.md +2 -2
  419. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +105 -14
  420. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -4
  421. package/presets/cursor/php-laravel/rules/ai-local-overlay.mdc +43 -0
  422. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +5 -1
  423. package/presets/cursor/php-laravel/rules/preset-token-budget.mdc +7 -3
  424. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +2 -0
  425. package/presets/cursor/svelte/README.md +6 -6
  426. package/presets/cursor/svelte/agents/README.md +1 -1
  427. package/presets/cursor/svelte/agents/build-verifier.md +2 -0
  428. package/presets/cursor/svelte/agents/code-reviewer.md +2 -0
  429. package/presets/cursor/svelte/agents/debugger.md +4 -0
  430. package/presets/cursor/svelte/agents/feature-developer.md +4 -1
  431. package/presets/cursor/svelte/agents/openspec-author.md +164 -0
  432. package/presets/cursor/svelte/agents/qa-tester.md +4 -0
  433. package/presets/cursor/svelte/agents/task-analyst.md +1 -1
  434. package/presets/cursor/svelte/agents/task-router.md +5 -1
  435. package/presets/cursor/svelte/agents/tech-writer.md +4 -0
  436. package/presets/cursor/svelte/commands/README.md +0 -2
  437. package/presets/cursor/svelte/commands/task-continue.md +1 -1
  438. package/presets/cursor/svelte/commands/task.md +1 -5
  439. package/presets/cursor/svelte/commands/technical-retro.md +2 -2
  440. package/presets/cursor/svelte/hooks/chain-team-phases.sh +105 -13
  441. package/presets/cursor/svelte/rules/README.md +3 -1
  442. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +8 -5
  443. package/presets/cursor/svelte/rules/ai-local-overlay.mdc +43 -0
  444. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +5 -1
  445. package/presets/cursor/svelte/rules/preset-token-budget.mdc +7 -3
  446. package/presets/cursor/svelte/rules/preset-twin-sync.mdc +2 -0
  447. package/presets/cursor/svelte/rules/tests-e2e-structure.mdc +87 -43
  448. package/presets/cursor/svelte/rules/tests-unit.mdc +72 -23
  449. package/presets/cursor/svelte/team/README.md +0 -3
  450. package/scripts/_lib/embed-stems.json +31 -0
  451. package/scripts/aggregate-agent-task-metrics.mjs +23 -0
  452. package/scripts/check-chain-hook-coverage.sh +109 -0
  453. package/scripts/check-local-overlay.sh +136 -0
  454. package/scripts/check-preset-i18n.sh +2 -2
  455. package/scripts/check-preset-leakage.sh +4 -1
  456. package/scripts/check-preset-structure.sh +31 -1
  457. package/scripts/check-preset-token-budget.sh +120 -10
  458. package/scripts/check-rule-eval.mjs +16 -0
  459. package/scripts/check-shared-core-drift.sh +10 -32
  460. package/scripts/check-task-router-intents.sh +141 -0
  461. package/scripts/close-agent-task-human-gate.mjs +22 -5
  462. package/scripts/sync-shared-core-embeds.sh +9 -20
  463. package/scripts/test-agent-task-metrics-hooks.mjs +100 -2
  464. package/scripts/test-chain-team-phases-coverage.mjs +510 -0
  465. package/scripts/test-task-router-intents-fixtures.mjs +109 -0
  466. package/presets/claude/android-kotlin/commands/feature-continue.md +0 -23
  467. package/presets/claude/android-kotlin/commands/feature-start.md +0 -41
  468. package/presets/claude/go/commands/feature-continue.md +0 -23
  469. package/presets/claude/go/commands/feature-start.md +0 -38
  470. package/presets/claude/ios-swift/commands/feature-continue.md +0 -23
  471. package/presets/claude/ios-swift/commands/feature-start.md +0 -41
  472. package/presets/claude/java/commands/feature-continue.md +0 -23
  473. package/presets/claude/java/commands/feature-start.md +0 -38
  474. package/presets/claude/mcp-ts/commands/feature-continue.md +0 -23
  475. package/presets/claude/mcp-ts/commands/feature-start.md +0 -41
  476. package/presets/claude/next/commands/feature-continue.md +0 -23
  477. package/presets/claude/next/commands/feature-start.md +0 -38
  478. package/presets/claude/nuxt/commands/feature-continue.md +0 -23
  479. package/presets/claude/nuxt/commands/feature-start.md +0 -41
  480. package/presets/claude/php-hexagonal/commands/feature-continue.md +0 -23
  481. package/presets/claude/php-hexagonal/commands/feature-start.md +0 -38
  482. package/presets/claude/php-laravel/commands/feature-continue.md +0 -23
  483. package/presets/claude/php-laravel/commands/feature-start.md +0 -38
  484. package/presets/claude/svelte/commands/feature-continue.md +0 -23
  485. package/presets/claude/svelte/commands/feature-start.md +0 -41
  486. package/presets/cursor/android-kotlin/commands/feature-continue.md +0 -23
  487. package/presets/cursor/android-kotlin/commands/feature-start.md +0 -41
  488. package/presets/cursor/go/commands/feature-continue.md +0 -23
  489. package/presets/cursor/go/commands/feature-start.md +0 -41
  490. package/presets/cursor/ios-swift/commands/feature-continue.md +0 -23
  491. package/presets/cursor/ios-swift/commands/feature-start.md +0 -41
  492. package/presets/cursor/java/commands/feature-continue.md +0 -23
  493. package/presets/cursor/java/commands/feature-start.md +0 -41
  494. package/presets/cursor/mcp-ts/commands/feature-continue.md +0 -23
  495. package/presets/cursor/mcp-ts/commands/feature-start.md +0 -41
  496. package/presets/cursor/next/commands/feature-continue.md +0 -23
  497. package/presets/cursor/next/commands/feature-start.md +0 -41
  498. package/presets/cursor/nuxt/commands/feature-continue.md +0 -23
  499. package/presets/cursor/nuxt/commands/feature-start.md +0 -41
  500. package/presets/cursor/php-hexagonal/commands/feature-continue.md +0 -23
  501. package/presets/cursor/php-hexagonal/commands/feature-start.md +0 -41
  502. package/presets/cursor/php-laravel/commands/feature-continue.md +0 -23
  503. package/presets/cursor/php-laravel/commands/feature-start.md +0 -41
  504. package/presets/cursor/svelte/commands/feature-continue.md +0 -23
  505. package/presets/cursor/svelte/commands/feature-start.md +0 -41
@@ -4,48 +4,90 @@ globs: app/__tests__/e2e/**/*
4
4
  alwaysApply: false
5
5
  ---
6
6
 
7
- # E2E structure in the project
7
+ <!-- shared-core: testing/testing-principles.md -->
8
8
 
9
+ # Testing principles
10
+
11
+ Stack-agnostic; concrete paths, runners, and selectors live in the stack adapter (`## Stack notes`).
12
+
13
+ ## Behavior vs. implementation
14
+
15
+ - Verify **behavior and business rules**, not implementation or internal details.
16
+
17
+ ## File naming
18
+
19
+ - For **new** tests use `*.spec.ts` / `*.spec.tsx`. Do not rename existing `*.test.ts` / `*.test.tsx` without a separate task (legacy).
20
+
21
+ ## Runner and matchers
22
+
23
+ - Use the project's runner (Jest or Vitest are common); components — the project's Testing Library integration. Reuse existing matchers — no new micro-framework.
24
+
25
+ ## Test title locale
26
+
27
+ - Consumer apps **may use the project locale** (often Russian) — clear business phrases stating what is checked and the expected outcome.
28
+ - When ESLint enforces the locale (e.g. `jest/valid-title`): each sentence must start with a **capital letter** (including after `.`, `!`, `?`); a space after `.` followed by a lowercase letter is forbidden ("capital after period" violation).
29
+
30
+ Good (Russian locale in consumer app):
31
+
32
+ - `it('Возвращает пустой список. Пользователь не авторизован', () => {})` <!-- i18n-keep: E5 --> (Returns empty list. User is not authorized)
33
+
34
+ Bad (no capital after period; or wrong locale for configured ESLint):
35
+
36
+ - `it('Возвращает пустой список. пользователь не авторизован', () => {})` <!-- i18n-keep: E5 -->
37
+ - `it('Returns empty list when user is guest', () => {})` (wrong locale if ESLint enforces Russian)
38
+
39
+ ## Isolation and mocks
40
+
41
+ - Mock at the **public-contract boundary**; use the project's accepted HTTP/API/store mock approach. Do not mock what is part of the feature's public contract if that breaks the test's meaning.
42
+
43
+ ## Coverage of cross-cutting modules
44
+
45
+ - When changing a **shared cross-cutting module** (e.g. HTTP client body parsing, headers, error / auth handling) — **update or add behavior tests** covering success, error, and edge branches relevant to the module under change.
46
+
47
+ ## Data transformation coverage
48
+
49
+ - Data transformation functions with computed fields and branches must have unit tests covering edge cases (boundary values, missing fields, unexpected value combinations).
50
+
51
+ ## Reuse fixtures over ad-hoc random data
52
+
53
+ - Prefer shared fixtures / handlers from the project's accepted mocks module; do not duplicate interfaces in tests. Use the API response types (DTO types) and the **target domain types** from the project's public type surface.
54
+
55
+ ## E2E: one canonical scenario plan per feature
56
+
57
+ - For each feature keep a **single canonical scenario plan** (distinct from implementation specs; the stack adapter names the file — typically `*.cases.md`).
58
+
59
+ ## E2E: scenario ↔ test traceability
60
+
61
+ - Every scenario has a corresponding test. **Do not weaken** assertions to match an outdated implementation — tests must reflect business expectations from the plan. Colocate plan and executable tests in the same directory.
62
+
63
+ ## E2E: page objects / shared helpers
64
+
65
+ - Prefer page objects and shared helpers over scattered selectors and per-test setup duplication.
66
+
67
+ ## E2E: stable identifiers (PREFIX-XXX)
68
+
69
+ - When scenarios need stable IDs, prefix the title with `PREFIX-XXX`: `PREFIX` = first letters of words in the entity under test (Latin uppercase); `XXX` = sequential number with three digits and leading zeros. Within one `PREFIX`, numbers must form a consistent sequence with no duplicates.
70
+ - Example: `test('OH-001 Отображается список заказов', async ({ page }) => { ... })` <!-- i18n-keep: E5 --> (Order list is displayed)
71
+
72
+ ## E2E: selector priority
73
+
74
+ - Prefer role/label selectors for accessibility and forms; fall back to `data-testid` for stable elements. Use a **hierarchical naming convention** on page roots and key interactive elements (stack adapter defines the scheme — typically `{parent}__{element}`).
75
+
76
+ ## E2E: keep plans and selectors in sync with UI
77
+
78
+ - When changing UI: update selectors in page objects and cross-check with the scenario plan. When adding/changing tests: read the matching plan and sync scenario titles first.
79
+
80
+ ## Stack notes
81
+
82
+ - Runner: Playwright (`@playwright/test`).
9
83
  - E2E folder: `app/__tests__/e2e/**`.
10
- - Scenario plans:
11
- - `*.cases.md` files — **canonical source of scenarios**.
12
- - Tests:
13
- - `*.spec.ts` files Playwright scenario implementations.
14
- - Shared utilities and abstractions:
15
- - `app/__tests__/e2e/_shared/**`constants, fluent interfaces, helpers.
16
-
17
- # Principles
18
-
19
- - Every scenario from `*.cases.md` must have a corresponding test (or set of tests).
20
- - **Do not** weaken assertions in tests if that contradicts business expectations from the plans.
21
- - Prefer:
22
- - page objects (for example, `OrderHistoryPage.ts`);
23
- - shared helpers from `_shared`.
24
-
25
- # E2E test naming
26
-
27
- - Language:
28
- - in consumer apps, `test` / `it`, `describe` block titles, and steps in `*.cases.md` **may use the project locale** (often Russian) — phrasing behavior and expected outcome;
29
- - when the repo ESLint or team convention requires Russian titles, follow that; otherwise use clear English business phrases.
30
- - E2E test title format (`test(...)` / `it(...)`):
31
- - before the scenario description, include a **numbered prefix** in the form: `PREFIX-XXX Scenario description`.
32
- - `PREFIX` — abbreviation from the **first letters of words** in the entity under test, written **in Latin uppercase**.
33
- - example: `OrderHistory` → `OH`, `BillingReport` → `BR`.
34
- - `XXX` — sequential test number **with three digits and leading zeros**: `001`, `002`, `010`, `123`, etc.
35
- - full e2e test title example (Russian locale in consumer app):
36
- - `test('OH-001 Отображается список заказов', async ({ page }) => { ... })` <!-- i18n-keep: E5 --> (Order list is displayed)
37
- - within one entity (`PREFIX`), test numbers must form a **consistent sequence** with no duplicate numbers.
38
-
39
- # data-testid for e2e
40
-
41
- - **Selector priority:** `data-testid` for stable elements; `getByRole` and `getByLabel` for forms and accessible elements.
42
- - **Naming:** `{parent}__{element}` scheme (for example, `history-page__title`, `history-page__recognition-banner__attach-files-button`).
43
- - **Where to add:** on page root containers and key interactive elements (buttons, links, fields) that page objects target.
44
- - **When changing UI:** update data-testid in components and matching selectors in page objects; cross-check with `*.cases.md`.
45
-
46
- # Agent requirement
47
-
48
- When adding/changing e2e tests:
49
- - First read the matching `*.cases.md` and sync scenario titles.
50
- - Place specs next to plans in the same directory.
51
- - Reuse shared page objects and helpers instead of copying selectors directly into every test.
84
+ - Placement mirrors source paths: `app/src/<rel>` → `app/__tests__/e2e/<rel>`. Use the deepest folder of the source under test; page-wide scenarios mirror the page folder.
85
+ - Scenario plans: `*.cases.md` files — canonical source of scenarios.
86
+ - Tests: `*.spec.ts` files — Playwright scenario implementations.
87
+ - Shared utilities and abstractions: `app/__tests__/e2e/_shared/**`constants, fluent interfaces, helpers.
88
+ - Root exceptions that do not mirror a single source module: `_shared/`, `smoke.spec.ts`, and `seed.spec.ts`.
89
+ - `data-testid` naming scheme: `{parent}__{element}` example `history-page__title`, `history-page__recognition-banner__attach-files-button`.
90
+ - `PREFIX-XXX` example: `OrderHistory` → `OH`, `BillingReport` → `BR`; Russian example — `test('OH-001 Отображается список заказов', async ({ page }) => { ... })` <!-- i18n-keep: E5 --> (Order list is displayed).
91
+ - Page object example filename: `OrderHistoryPage.ts` (the seed test pointer lives at `app/__tests__/e2e/seed.spec.ts`).
92
+ - Cross-reference: See also **`playwright-agents.mdc`** for the e2e planner / generator / healer agents.
93
+ - `## Stack notes` content is stripped by `scripts/check-shared-core-drift.sh` before byte-comparing this file against `_shared/core/testing/testing-principles.md`; keep prose above (core content) verbatim against the core file.
@@ -1,82 +1,113 @@
1
1
  ---
2
2
  description: Unit and integration tests (Testing Library and project runner)
3
3
  globs:
4
- - app/src/**/*.spec.{ts,tsx}
5
- - app/src/**/*.test.{ts,tsx}
4
+ - app/__tests__/unit/**/*.spec.{ts,tsx}
5
+ - app/__tests__/unit/**/*.test.{ts,tsx}
6
6
  alwaysApply: false
7
- impact: MEDIUM
8
7
  ---
9
8
 
10
- # General testing rules
9
+ <!-- shared-core: testing/testing-principles.md -->
11
10
 
12
- - **File names:** for **new** tests use the **`*.spec.ts` / `*.spec.tsx`** suffix. Do not rename existing **`*.test.ts` / `*.test.tsx`** without a separate task (legacy).
13
- - **Runner and matchers** — as in the project (often Jest or Vitest); for components — **@testing-library/react**.
14
- - Primary goal of tests:
15
- - verify **behavior and business rules**, not implementation or internal details.
16
- - **Unit test naming** (strings in `describe` / `it` / `test`):
17
- - consumer apps **may use Russian locale** for titles — clear business phrases (what is checked and expected outcome);
18
- - when ESLint enforces Russian (see below), each sentence in the title **must start with a capital letter** (including after `.`, `!`, `?` and with multiple sentences on one line); the first letter of the whole string is capitalized too.
19
- - **CI check (when configured):** ESLint (`jest/valid-title` in `app/eslint.config.mjs`) may require titles to start with a Russian capital letter and forbid a space after `.` followed immediately by a lowercase letter (typical "capital after period" violation).
11
+ # Testing principles
12
+
13
+ Stack-agnostic; concrete paths, runners, and selectors live in the stack adapter (`## Stack notes`).
14
+
15
+ ## Behavior vs. implementation
16
+
17
+ - Verify **behavior and business rules**, not implementation or internal details.
18
+
19
+ ## File naming
20
+
21
+ - For **new** tests use `*.spec.ts` / `*.spec.tsx`. Do not rename existing `*.test.ts` / `*.test.tsx` without a separate task (legacy).
22
+
23
+ ## Runner and matchers
24
+
25
+ - Use the project's runner (Jest or Vitest are common); components — the project's Testing Library integration. Reuse existing matchers — no new micro-framework.
26
+
27
+ ## Test title locale
28
+
29
+ - Consumer apps **may use the project locale** (often Russian) — clear business phrases stating what is checked and the expected outcome.
30
+ - When ESLint enforces the locale (e.g. `jest/valid-title`): each sentence must start with a **capital letter** (including after `.`, `!`, `?`); a space after `.` followed by a lowercase letter is forbidden ("capital after period" violation).
20
31
 
21
32
  Good (Russian locale in consumer app):
22
33
 
23
34
  - `it('Возвращает пустой список. Пользователь не авторизован', () => {})` <!-- i18n-keep: E5 --> (Returns empty list. User is not authorized)
24
- - `it('При ошибке сети показывается сообщение об ошибке', () => {})` <!-- i18n-keep: E5 --> (On network error, an error message is shown)
25
35
 
26
36
  Bad (no capital after period; or wrong locale for configured ESLint):
27
37
 
28
38
  - `it('Возвращает пустой список. пользователь не авторизован', () => {})` <!-- i18n-keep: E5 -->
29
- - `it('Returns empty list when user is guest', () => {})`
39
+ - `it('Returns empty list when user is guest', () => {})` (wrong locale if ESLint enforces Russian)
40
+
41
+ ## Isolation and mocks
42
+
43
+ - Mock at the **public-contract boundary**; use the project's accepted HTTP/API/store mock approach. Do not mock what is part of the feature's public contract if that breaks the test's meaning.
44
+
45
+ ## Coverage of cross-cutting modules
46
+
47
+ - When changing a **shared cross-cutting module** (e.g. HTTP client body parsing, headers, error / auth handling) — **update or add behavior tests** covering success, error, and edge branches relevant to the module under change.
48
+
49
+ ## Data transformation coverage
30
50
 
31
- # Component tests
51
+ - Data transformation functions with computed fields and branches must have unit tests covering edge cases (boundary values, missing fields, unexpected value combinations).
32
52
 
33
- - Use `render` from `@testing-library/react`.
34
- - Assertions:
35
- - DOM matchers for Testing Library as wired in the project (`toBeInTheDocument`, `toHaveTextContent`, etc.).
36
- - Interactions:
37
- - `userEvent` from `@testing-library/user-event`.
53
+ ## Reuse fixtures over ad-hoc random data
38
54
 
39
- # Isolation and mocks
55
+ - Prefer shared fixtures / handlers from the project's accepted mocks module; do not duplicate interfaces in tests. Use the API response types (DTO types) and the **target domain types** from the project's public type surface.
40
56
 
41
- - For API/store work:
42
- - mock the store (via test-store) or use the project's accepted HTTP/API mock approach.
43
- - Do not mock what is part of the feature's public contract if that breaks the test's meaning.
57
+ ## E2E: one canonical scenario plan per feature
44
58
 
45
- # HTTP client
59
+ - For each feature keep a **single canonical scenario plan** (distinct from implementation specs; the stack adapter names the file — typically `*.cases.md`).
46
60
 
47
- - When changing the **shared HTTP client implementation** (body parsing, headers, error branches, 401/refresh, `FormData`, `blob`, etc.) — **update or add behavior tests** next to the client module in `app/src/lib/clients/**` (prefer `*.spec.ts`; legacy `*.test.ts` — do not touch without a task).
48
- - Cover meaningful branches: successful JSON, HTTP error, network, auth scenarios relevant to the project.
61
+ ## E2E: scenario test traceability
49
62
 
50
- # Mappers and data transformation
63
+ - Every scenario has a corresponding test. **Do not weaken** assertions to match an outdated implementation — tests must reflect business expectations from the plan. Colocate plan and executable tests in the same directory.
51
64
 
52
- - Data mapping functions (DTO domain model and back), especially with computed fields and branches, must have unit tests.
53
- - In mapper tests, pay special attention to edge cases and business-rule regression (for example, boundary values, missing fields, unexpected value combinations).
65
+ ## E2E: page objects / shared helpers
54
66
 
55
- # Agent requirement
67
+ - Prefer page objects and shared helpers over scattered selectors and per-test setup duplication.
68
+
69
+ ## E2E: stable identifiers (PREFIX-XXX)
70
+
71
+ - When scenarios need stable IDs, prefix the title with `PREFIX-XXX`: `PREFIX` = first letters of words in the entity under test (Latin uppercase); `XXX` = sequential number with three digits and leading zeros. Within one `PREFIX`, numbers must form a consistent sequence with no duplicates.
72
+ - Example: `test('OH-001 Отображается список заказов', async ({ page }) => { ... })` <!-- i18n-keep: E5 --> (Order list is displayed)
73
+
74
+ ## E2E: selector priority
75
+
76
+ - Prefer role/label selectors for accessibility and forms; fall back to `data-testid` for stable elements. Use a **hierarchical naming convention** on page roots and key interactive elements (stack adapter defines the scheme — typically `{parent}__{element}`).
77
+
78
+ ## E2E: keep plans and selectors in sync with UI
79
+
80
+ - When changing UI: update selectors in page objects and cross-check with the scenario plan. When adding/changing tests: read the matching plan and sync scenario titles first.
81
+
82
+ ## Stack notes
83
+
84
+ - `render` from `@testing-library/react` for component tests.
85
+ - `userEvent` from `@testing-library/user-event` for interactions.
86
+ - DOM matchers as wired in the project (`toBeInTheDocument`, `toHaveTextContent`, …).
87
+ - `jest/valid-title` ESLint rule in `app/eslint.config.mjs` enforces the Russian capital-after-period rule (when configured).
88
+ - `@/types` and `@/api` imports — types come from the public API surface, never duplicated in tests.
89
+ - `app/src/mocks/**` — shared fixtures and MSW handlers live here (or repo equivalent).
90
+ - Unit-test placement mirrors source paths: `app/src/<rel>` → `app/__tests__/unit/<rel>`. Do not colocate `*.spec.ts(x)` or `*.test.ts(x)` under `app/src/**`.
91
+ - HTTP-client behavior tests live under the mirrored `app/__tests__/unit/lib/clients/**` path (prefer `*.spec.ts`).
92
+ - UI tests live under the mirrored `app/__tests__/unit/ui/**` path. Import the source under test through the `@/` alias.
93
+ - `## Stack notes` content is stripped by `scripts/check-shared-core-drift.sh` before byte-comparing this file against `_shared/core/testing/testing-principles.md`; keep prose above (core content) verbatim against the core file.
56
94
 
57
- When adding tests:
58
- - Follow existing test structure and patterns in the repository: `*.spec.ts(x)` next to the module or in a shared test directory — as in neighboring features.
59
- - Add tests for critical logic branches and edge cases.
60
- - When working with data:
61
- - use **response types** from the API (DTO types) and **target domain types** from `@/types`; do not duplicate interfaces in tests;
62
- - when possible, rely on data and handlers from `app/src/mocks/**` (or repo equivalent), not ad-hoc random test data.
63
- - Placement:
64
- - for **UI components** — **do not create** a `__tests__` subdirectory inside the component folder; the test is a sibling `*.spec.tsx`.
65
- - in **other modules** (for example `api/services`) an existing `__tests__` layout is acceptable — do not break it for UI uniformity.
66
- - **new** files — `*.spec.ts` / `*.spec.tsx` (see "File names" above).
67
95
  ## Incorrect
68
96
 
97
+ Title violates capital-after-period rule (Russian locale). The rule's enforcement (`jest/valid-title`) will reject this in CI.
98
+
69
99
  ```ts
70
- it('returns empty list when guest', () => {})
100
+ it('возвращает пустой список. пользователь не авторизован', () => { <!-- i18n-keep: E5 -->
101
+ expect(result).toEqual([]);
102
+ });
71
103
  ```
72
104
 
73
- - `it('Возвращает пустой список. пользователь не авторизован', () => {})` <!-- i18n-keep: E5 -->
74
-
75
105
  ## Correct
76
106
 
107
+ Title respects capital-after-period rule.
108
+
77
109
  ```ts
78
- it('Возвращает пустой список. Пользователь не авторизован', () => {})
110
+ it('Возвращает пустой список. Пользователь не авторизован', () => { <!-- i18n-keep: E5 -->
111
+ expect(result).toEqual([]);
112
+ });
79
113
  ```
80
- <!-- i18n-keep: E5 -->
81
-
82
- - `it('Возвращает пустой список. Пользователь не авторизован', () => {})` <!-- i18n-keep: E5 -->
@@ -8,11 +8,13 @@ description: Plans, generates, and heals Playwright e2e tests using this preset'
8
8
  ## Project Layout
9
9
 
10
10
  - Test root: `app/__tests__/e2e`.
11
- - Test plans: `*.cases.md` files under the matching feature folder.
11
+ - Mirror formula: `app/src/<rel>` `app/__tests__/e2e/<rel>` (drop `app/src`, preserve the relative path).
12
+ - Place artifacts at the deepest mirrored folder of the source under test; page-wide scenarios use the page folder.
13
+ - Test plans: `*.cases.md` files in the mirrored folder.
12
14
  - Executable specs: `*.spec.ts` files in the same folder.
13
- - Seed/setup reference: `app/__tests__/e2e/seed.spec.ts`.
15
+ - Seed/setup reference: `app/__tests__/e2e/seed.spec.ts`. Root exceptions: `_shared/`, `smoke.spec.ts`, and `seed.spec.ts`.
14
16
 
15
- Do not introduce top-level `specs/` or `tests/` folders for real coverage unless the user explicitly asks for a sandbox.
17
+ Do not introduce top-level `specs/`, `tests/`, or feature-named folders for real coverage unless the user explicitly asks for a sandbox.
16
18
 
17
19
  ## Planner
18
20
 
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: unit-testing
3
- description: Plans, generates, and heals unit tests for mappers, thunks, HTTP client behavior, and React components using colocated *.spec.ts files and tests-unit rules. Use for unit test planning, generation, or fixing failing unit tests.
3
+ description: Plans, generates, and heals unit tests for mappers, thunks, HTTP client behavior, and React components using mirrored paths under app/__tests__/unit and tests-unit rules. Use for unit test planning, generation, or fixing failing unit tests.
4
4
  ---
5
5
 
6
6
  # Unit Testing
7
7
 
8
8
  ## Project Layout
9
9
 
10
- - Specs colocated with source: `*.spec.ts` / `*.spec.tsx` next to the module under test.
10
+ - Test root: `app/__tests__/unit`.
11
+ - Mirror formula: `app/src/<rel>` → `app/__tests__/unit/<rel>` (drop `app/src`, preserve the relative path).
12
+ - Place specs at the deepest mirrored folder of the module under test; do not colocate tests under `app/src/**`.
11
13
  - Legacy `*.test.ts` / `*.test.tsx` — do not rename without a separate task.
12
14
  - Runner: Jest or Vitest as configured in the target repo; components use `@testing-library/react`.
13
15
 
@@ -17,11 +19,11 @@ Follow **`tests-unit.mdc`** (Cursor) or **`rules/testing/tests-unit.md`** (Claud
17
19
 
18
20
  Write or update `.cursor/team/tasks/<slug>/unit-test-plan.md` (or `.claude/team/...`).
19
21
 
20
- Each scenario needs a Russian `it()` title (capital letter after each sentence). Cover mappers, thunks, client behavior branches, and component interactions per AC.
22
+ Each scenario needs a Russian `it()` title (capital letter after each sentence). Cover mappers, thunks, client behavior branches, and component interactions per AC. Record the mirrored target path under `app/__tests__/unit/`.
21
23
 
22
24
  ## Generator
23
25
 
24
- Implement specs from `unit-test-plan.md`. Reuse project test-store, HTTP mocks, and existing test utilities. Do not change production code.
26
+ Implement specs from `unit-test-plan.md` under the mirrored `app/__tests__/unit/` path. Import the source under test through the `@/` alias. Reuse project test-store, HTTP mocks, and existing test utilities. Do not change production code.
25
27
 
26
28
  ## Healer
27
29
 
@@ -106,8 +106,6 @@ Prefer **`executing`** for pipeline mode. Legacy: `analysis`, `development`, `re
106
106
  /technical-retro <slug>
107
107
  ```
108
108
 
109
- Legacy: `/feature-start`, `/feature-continue`.
110
-
111
109
  ## Creating task dirs
112
110
 
113
111
  Bootstrap `<slug>/` by **writing** `pipeline.json` (Write tool). Runtime/hook owns `status.json` lifecycle; parent may only create a minimal bootstrap if missing. Do **not** use Shell `mkdir -p` — Cursor’s default sandbox returns `Operation not permitted` (especially for repos on macOS Desktop/Documents).
@@ -116,7 +114,6 @@ Bootstrap `<slug>/` by **writing** `pipeline.json` (Write tool). Runtime/hook ow
116
114
 
117
115
  Commit task artifacts if you want them to survive `ai-rules clean cursor`. Or copy finished tasks to `docs/agent-workflow/tasks/<slug>/`.
118
116
 
119
-
120
117
  ## specMode, applyReadiness, memlog
121
118
 
122
119
  - **`specMode`:** `consume` | `generate` | `none` — primary in `brief.md` `## Spec mode`; optional top-level `pipeline.json` `specMode`. `none` skips INDEX/author mode (spike/research).
@@ -15,17 +15,17 @@ Copies:
15
15
  | `REPO_AGENTS.md` | → repo-root `AGENTS.md` (cross-tool) |
16
16
  | `AGENTS.md` | → `.cursor/AGENTS.md` quick-start |
17
17
  | `BUGBOT.md` | Cursor Bugbot review priorities |
18
- | `rules/**` | `.mdc` + README (alwaysApply ≤3); golden rules with Incorrect/Correct + `impact:` |
19
- | `agents/**` | **22** roles (+ README; includes on-demand `codebase-analyzer`) |
20
- | `skills/**` | 9 skills (incl. `playwright-e2e`, `write-adr`, `vue-performance`) |
21
- | `commands/**` | task, task-continue, feature-start/continue, technical-retro |
18
+ | `rules/**` | `.mdc` + README (alwaysApply ≤4 incl. `ai-local-overlay`); golden rules with Incorrect/Correct + `impact:` |
19
+ | `agents/**` | **24** roles (+ README; includes on-demand `codebase-analyzer`, `openspec-author`) |
20
+ | `skills/**` | **13** skills (incl. `playwright-e2e`, `write-adr`, `vue-performance`, `mockup-review`, `ux-design`, `spec-authoring`, `spec-discovery`) |
21
+ | `commands/**` | task, task-continue, technical-retro |
22
22
  | `hooks.json` + `hooks/**` | guard-shell + chain-team-phases; optional `hooks/examples/` cookbook |
23
23
  | `team/**` | fixtures + `conventions.md` + README |
24
24
  | `mcp.json` + `MCP.md` | Context7 + Figma MCP → `.cursor/mcp.json` |
25
25
 
26
- ## alwaysApply (≤3)
26
+ ## alwaysApply (≤4)
27
27
 
28
- `nuxt-app-core`, `package-manager`, `code-quality-and-refactoring`.
28
+ `nuxt-app-core`, `package-manager`, `code-quality-and-refactoring`, `ai-local-overlay`.
29
29
 
30
30
  Requestable (not always-on): `post-change-lint`, `agent-team-*`, `code-review-mr`, `feature-delivery-workflow`, `reference-features`, domain globs.
31
31
 
@@ -54,6 +54,7 @@ Role subagents for the Cursor team pipeline.
54
54
  | Agent | File | Production code |
55
55
  |-------|------|-----------------|
56
56
  | Tech writer | `tech-writer.md` | docs only |
57
+ | OpenSpec author | `openspec-author.md` | `openspec/**` only (proposal/design/tasks/spec deltas; reads `app/**` for evidence) |
57
58
 
58
59
  Copied to `.cursor/agents/` on `ai-rules init cursor --preset nuxt`.
59
60
 
@@ -86,7 +87,6 @@ Default SoT — YAML `model` in each agent file. Optional `steps[].model` (`chea
86
87
  |---------|---------|
87
88
  | `/task <desc>` | Router → dynamic pipeline → first agent |
88
89
  | `/task-continue <slug>` | After a human gate |
89
- | `/feature-start`, `/feature-continue` | Legacy (compatibility) |
90
90
 
91
91
  Rule: `agent-team-orchestrator.mdc`. Plan: `pipeline.json` under `.cursor/team/tasks/<slug>/`.
92
92
 
@@ -97,6 +97,8 @@ Write the owned terminal receipt described under **Artifact contract**. If **FAI
97
97
 
98
98
  Do not fix code — report only. Do not advance to code-reviewer until PASS.
99
99
 
100
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
101
+
100
102
  ## Artifact contract
101
103
 
102
104
  - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition, implementation evidence, pipeline scope, and changed files.
@@ -55,6 +55,8 @@ Write the owned terminal receipt described under **Artifact contract**. If **REQ
55
55
 
56
56
  Do not mix this output with retrospective facilitation — keep review and retro separate.
57
57
 
58
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
59
+
58
60
  ## Design guidance
59
61
 
60
62
  - Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
@@ -81,3 +81,7 @@ Do not perform formal code review or write e2e plans — those are separate agen
81
81
 
82
82
  - When writing or changing code, load / follow rule `anti-sycophancy-discipline`.
83
83
  - When acting on review feedback (`changes_requested` / human comments): verify each item against the codebase before implementing; no performative agreement.
84
+
85
+ ## Receipt binding
86
+
87
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: feature-developer
3
- description: Feature implementation specialist for Nuxt 3 stack. Implements tasks from decomposition.md following feature-delivery workflow. Use after brief approval via /task-continue or /feature-continue, or when explicitly asked to implement an approved task slug.
3
+ description: Feature implementation specialist for Nuxt 3 stack. Implements tasks from decomposition.md following feature-delivery workflow. Use after brief approval via /task-continue, or when explicitly asked to implement an approved task slug.
4
4
  readonly: false
5
5
  model: inherit
6
6
  ---
@@ -13,6 +13,7 @@ You are a senior frontend developer working in a Nuxt 3 monorepo with strict lay
13
13
  2. Read `status.json` — proceed if `in_progress`, `approved`, or `retryAfterFix`.
14
14
  3. Read `pipeline.json` for step context and scope.
15
15
  4. Follow the **`feature-delivery` skill** (layer order, reference features, validation handoff).
16
+ 5. **Verify carry-over at HEAD before applying** (refactor intent only). When the brief comes from a prior review's carry-over findings list, for each item run `git show HEAD:<path>` or `grep` to confirm the finding still applies at the current HEAD; if the file already contains the fix (carry-over was closed in a prior uncommitted batch), mark it as **NO-OP at HEAD** in `implementation.md` and skip the edit; if the file is unchanged, apply the fix and cite file:line. Target ≤2 NO-OP items per refactor pipeline.
16
17
 
17
18
  ## Task execution rules
18
19
 
@@ -40,6 +41,8 @@ Emit the owned implementation receipt with outcome `completed`. Handoff: tasks d
40
41
 
41
42
  Do not perform formal code review — that is the code-reviewer subagent's job.
42
43
 
44
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
45
+
43
46
  ## Design guidance
44
47
 
45
48
  - Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: openspec-author
3
+ description: OpenSpec (spec-driven SDD) specialist. Explores openspec/specs/**, authors/refreshes/archives openspec/changes/** proposal–design–tasks–spec deltas per openspec/config.yaml schema. Reads app/** for evidence; never edits production code. Use when pipeline steps reference openspec/changes, /opsx:propose, /opsx:apply, /opsx:archive, openspec/specs, or scope is a change-id.
4
+ readonly: false
5
+ model: inherit
6
+ ---
7
+
8
+ You are an **OpenSpec** (Fission AI spec-driven SDD) author for a frontend/backend agent team.
9
+
10
+ Your only writes target `openspec/**` (and team artifact manifests). Production code lives behind `feature-developer`; you are **docs / spec only**.
11
+
12
+ ## When to load
13
+
14
+ You are invoked when:
15
+
16
+ - Pipeline step `agent` is `openspec-author`.
17
+ - Pipeline step `scope` is `openspec:<change-id>` (preferred) or `openspec-propose` (legacy alias — treat as `openspec:openspec-<change-id>` only when the handoff brief explicitly names the change-id).
18
+ - Prompt includes `/opsx:propose`, `/opsx:apply`, `/opsx:archive`, `openspec/changes`, `openspec/specs`, `openspec/config.yaml`, or `openspec validate`.
19
+ - Per task-analyst / solution-architect handoff, refresh an existing capability or scaffold a brand-new change.
20
+
21
+ If `openspec/` is absent in the repo, stop and report `blocked` with the message *"openspec/** not initialized — run `openspec init` first"* — never invent directories.
22
+
23
+ ## Inputs
24
+
25
+ 1. `.cursor/team/tasks/<slug>/{brief.md, decomposition.md, architecture.md}` (Claude: `.claude/team/tasks/<slug>/`).
26
+ 2. `.cursor/team/tasks/<slug>/artifact-manifest.json` — read first, consume `artifactInputIds`.
27
+ 3. `openspec/config.yaml` — schema, context block, `rules.proposal | specs | design | tasks`. **Source of truth** for word limits, Non-goals mandate, SHALL statement format, data-flow expectation, and task granularity. Never fork.
28
+ 4. `openspec/specs/<capability>/spec.md` — surviving applied specs (the "as-is" target).
29
+ 5. `openspec/changes/archive/<YYYY-MM-DD>-<change-id>/` — prior decisions (D-1..) and open questions (OQ-1..) reusable across changes.
30
+ 6. Source tree for code-evidence reads only — `app/src/**`, `src/**`, or stack equivalent. **Never edit.** Cite path:line in requirements, scenarios, design notes.
31
+ 7. Pipeline step `scope` — must be `openspec:<change-id>` (e.g. `openspec:MEDCARD-11762-sync-offline-consultation-spec`).
32
+
33
+ ## Phase discipline (mirrors `/opsx:propose` → `/opsx:apply` → `/opsx:archive`)
34
+
35
+ Pipeline step `scope` may encode a single phase or full lifecycle. Match the body to the phase, do not skip phases within a single invocation.
36
+
37
+ ### Phase 1 — Explore
38
+
39
+ 1. Read `openspec/config.yaml`. Confirm `schema:` and the four `rules.*` blocks.
40
+ 2. Read `openspec/specs/**/spec.md` (one file per capability) — note each capability's `## Purpose` and current `## Requirements`.
41
+ 3. Read `openspec/changes/archive/**/proposal.md` for prior decisions and OQ defaults that map to this change.
42
+ 4. Code-archaeology (read-only) on the affected source tree: list concrete routes, flags, slices, thunks, record statuses. Label every observation `code-evidence`.
43
+ 5. Emit a capability delta as `NEW | MODIFIED | REMOVED | RENAMED` with affected file paths.
44
+ 6. If a required source artefact is missing (e.g. `architecture.md` not produced), set `blocked` with the gap, do not invent.
45
+
46
+ ### Phase 2 — Propose
47
+
48
+ Scaffold `openspec/changes/<change-id>/`:
49
+
50
+ ```
51
+ openspec/changes/<change-id>/
52
+ ├── .openspec.yaml # schema mirror, change-id, created date
53
+ ├── proposal.md # Why / What Changes / Capabilities / Non-goals / Impact — under 500 words per config.rules.proposal
54
+ ├── design.md # Context / Goals / Decisions (D-1..) / Data flow (mermaid) / Open questions (OQ-1..)
55
+ ├── tasks.md # 1.1, 1.2, … — AC + verification checklists for future SDD
56
+ └── specs/<capability>/
57
+ └── spec.md # delta block: `## MODIFIED Requirements` and/or `## REMOVED Requirements`
58
+ ```
59
+
60
+ Hard constraints (read `config.yaml rules.proposal` first — they win):
61
+
62
+ - `proposal.md` ≤ 500 words.
63
+ - `## Non-goals` section mandatory (omit → `blocked`).
64
+ - `## What Changes` lists capability deltas **only**; no implementation steps.
65
+ - `## Capabilities` table groups deltas by capability slug; cite spec paths.
66
+ - Spec deltas use `## MODIFIED Requirements` heading (or `## REMOVED Requirements`); Each `### Requirement:` block carries `SHALL` statements and `#### Scenario:` Given/When/Then. Mirror existing capability voice.
67
+ - `design.md` data-flow is mermaid or ascii (no proprietary XML). Document **current as-is** unless the change is explicitly redesign.
68
+ - `tasks.md` 1.1, 1.2, 1.3 — each ≤ 5 acceptance bullets + verification note. **No production code in tasks**; tasks are **for future SDD implementation/tests**, not for rewriting the page now.
69
+
70
+ ### Phase 3 — Apply (validate, do not merge to specs)
71
+
72
+ Run from repo root:
73
+
74
+ ```bash
75
+ openspec validate <change-id> --type change --strict # must pass
76
+ openspec validate --specs --strict # must pass — surviving capabilities
77
+ openspec show <change-id> --json --deltas-only # handoff receipt
78
+ ```
79
+
80
+ On FAIL: fix the offending markdowns (cite config rule that failed), re-run. On second FAIL: stop, emit `blocked`, attach the validator output.
81
+
82
+ Do **not** move the change into `openspec/specs/` — that is the human merge step (`/opsx:apply` after review).
83
+
84
+ ### Phase 4 — Archive (post-merge)
85
+
86
+ After a human gate `applied` confirmation:
87
+
88
+ ```bash
89
+ # Move the approved change into archive; preserve prior archive intact.
90
+ mv openspec/changes/<change-id> openspec/changes/archive/<YYYY-MM-DD>-<change-id>
91
+ ```
92
+
93
+ Update `openspec/changes/archive/INDEX.md` if present. Verify that no surviving capability now references the archived `proposal.md` accidentally.
94
+
95
+ If `scope` carries multiple phases (e.g. `openspec:<change-id>:propose+apply`), one invocation may emit all four files and the validator receipts. If `scope` is single-phase, emit only the matching files.
96
+
97
+ ## Source discipline
98
+
99
+ - **Never invent** product behavior. Cite `path:line` for every requirement that depends on code. Label inferred lines as `> Status: inferred (no AC)` rather than fabricating fields.
100
+ - Reuse archive decisions: if `archive/.../proposal.md` records `D-3: X`, only fork when code-evidence contradicts X — append `D-N+1` rather than rewriting.
101
+ - Resolve OQ defaults from the most recent archive that touched the same capability; otherwise raise the OQ in the new change and stop until the human answers.
102
+ - Capability naming mirrors surviving `openspec/specs/<capability>/spec.md` slugs; new capabilities use the same domain vocabulary as `config.yaml context`.
103
+
104
+ ## Will / Will not
105
+
106
+ **Will**
107
+
108
+ - Read `app/src/**` (or stack equivalent) for evidence; never write.
109
+ - Create or update files under `openspec/changes/<change-id>/**` and the associated `specs/<capability>/spec.md` delta.
110
+ - Move an approved change into `openspec/changes/archive/<YYYY-MM-DD>-<change-id>/`.
111
+ - Run `openspec validate` and `openspec show --deltas-only`; surface FAIL output verbatim.
112
+ - Reference `openspec/config.yaml` rules in any deviation comment.
113
+
114
+ **Will not**
115
+
116
+ - Edit `app/**`, `app/src/**`, `src/**`, or any production-code tree.
117
+ - Edit `docs/specs/**` — that file tree belongs to skill `spec-authoring` (`docs/specs/INDEX.md` + page/feature templates). Hand off via `open_questions` if a request conflates the two.
118
+ - Edit `openspec/specs/**` directly (apply via the change, never in place).
119
+ - Skip the `## Non-goals` section in `proposal.md` even when the user omits it.
120
+ - Use `scope: openspec-propose` in **new** pipelines — it is a legacy alias for `openspec:<change-id>`; keep emitting the correct scope name. (Tech-writer still carries the legacy alias for in-flight replays.)
121
+ - Invent routes, flags, status names, or DTO fields. Cite or raise OQ.
122
+
123
+ ## Artifact contract
124
+
125
+ - **Authoritative inputs:** read `.cursor/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and available architecture/migration/review artifacts.
126
+ - **Owned outputs:** `openspec/changes/<change-id>/**` (proposal.md, design.md, tasks.md, .openspec.yaml, specs/<capability>/spec.md delta) plus the team slot `openspec-change.md` in `.cursor/team/tasks/<slug>/` when the orchestrator asks for a summary handoff. Preserve all foreign entries; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `openspec-change`).
127
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths under `openspec/changes/<change-id>/**`, attach `openspec validate <change-id> --type change --strict` exit code + deltas-only summary, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
128
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
129
+
130
+ ## Output
131
+
132
+ When invoked directly (no pipeline), write the spec handoff at `.cursor/team/tasks/<slug>/openspec-change.md`:
133
+
134
+ ```markdown
135
+ # OpenSpec change: <change-id>
136
+
137
+ ## Phase emitted
138
+ explore | propose | apply | archive | full
139
+
140
+ ## Capabilities touched
141
+ - <slug> — NEW | MODIFIED | REMOVED | RENAMED (cite openspec/specs/<slug>/spec.md or planned spec path)
142
+
143
+ ## Validator receipt
144
+ - `openspec validate <change-id> --type change --strict` → <PASS|FAIL> (exit <n>)
145
+ - `openspec validate --specs --strict` → <PASS|FAIL> (n surviving)
146
+ - `openspec show <change-id> --json --deltas-only` → paths: ...
147
+
148
+ ## Open questions (forwarded to human gate)
149
+ - OQ-N: …
150
+ ```
151
+
152
+ ## Anti-sycophancy
153
+
154
+ Match `code-quality-and-refactoring.mdc`:
155
+
156
+ - Verbatim third-party API (openspec CLI flags) → never invent flags; `// VERIFY: openspec.<flag> @ <version>` if uncertain; consult `npx openspec --help`.
157
+ - Before "is this correct?" — list ≥3 failure modes for the chosen delta (capability obsolescence, schema drift, archive mismatch, prod code-only evidence, conflict with prior D-N).
158
+ - Refactor without tests — N/A (docs only) but if the team lacks an existing spec for the change, raise OQ before proposing.
159
+ - Comments — WHY only when non-obvious (e.g. when forking `config.yaml rules.proposal`); never narrate.
160
+ - Urgency — name the trade-off (e.g. "Use spec-driven character sketch over future-SDD rewrite because config.rules.design forbids redesign") and comply.
161
+
162
+ ## MCP usage (on-demand)
163
+
164
+ Load `mcp-usage` only when needing Context7 for an unknown openspec CLI flag or third-party library. Default: rely on `npx openspec --help` and `openspec/config.yaml` rules; mark `// VERIFY: openspec.<flag>` if behavior is unclear.