universal-dev-standards 5.0.0-rc.8 → 5.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 (355) hide show
  1. package/bin/uds.js +5 -3
  2. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +178 -0
  3. package/bundled/ai/standards/agent-dispatch.ai.yaml +69 -0
  4. package/bundled/ai/standards/ai-command-behavior.ai.yaml +45 -0
  5. package/bundled/ai/standards/api-design-standards.ai.yaml +192 -0
  6. package/bundled/ai/standards/branch-completion.ai.yaml +82 -0
  7. package/bundled/ai/standards/change-batching-standards.ai.yaml +195 -0
  8. package/bundled/ai/standards/database-standards.ai.yaml +220 -0
  9. package/bundled/ai/standards/error-codes.ai.yaml +37 -2
  10. package/bundled/ai/standards/git-worktree.ai.yaml +77 -0
  11. package/bundled/ai/standards/logging.ai.yaml +21 -2
  12. package/bundled/ai/standards/model-selection.ai.yaml +81 -0
  13. package/bundled/ai/standards/pipeline-integration-standards.ai.yaml +184 -0
  14. package/bundled/ai/standards/systematic-debugging.ai.yaml +73 -0
  15. package/bundled/ai/standards/verification-evidence.ai.yaml +84 -0
  16. package/bundled/ai/standards/workflow-enforcement.ai.yaml +253 -0
  17. package/bundled/core/acceptance-criteria-traceability.md +293 -0
  18. package/bundled/core/agent-dispatch.md +149 -0
  19. package/bundled/core/ai-command-behavior.md +239 -0
  20. package/bundled/core/api-design-standards.md +938 -0
  21. package/bundled/core/branch-completion.md +158 -0
  22. package/bundled/core/change-batching-standards.md +257 -0
  23. package/bundled/core/checkin-standards.md +43 -6
  24. package/bundled/core/database-standards.md +828 -0
  25. package/bundled/core/error-code-standards.md +228 -2
  26. package/bundled/core/forward-derivation-standards.md +54 -2
  27. package/bundled/core/git-worktree.md +131 -0
  28. package/bundled/core/model-selection.md +153 -0
  29. package/bundled/core/pipeline-integration-standards.md +230 -0
  30. package/bundled/core/systematic-debugging.md +156 -0
  31. package/bundled/core/testing-standards.md +49 -39
  32. package/bundled/core/verification-evidence.md +172 -0
  33. package/bundled/core/workflow-enforcement.md +132 -0
  34. package/bundled/locales/zh-CN/CLAUDE.md +2 -2
  35. package/bundled/locales/zh-CN/README.md +4 -4
  36. package/bundled/locales/zh-CN/SECURITY.md +92 -0
  37. package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +301 -0
  38. package/bundled/locales/zh-CN/core/acceptance-test-driven-development.md +47 -0
  39. package/bundled/locales/zh-CN/core/accessibility-standards.md +124 -0
  40. package/bundled/locales/zh-CN/core/agent-dispatch.md +113 -0
  41. package/bundled/locales/zh-CN/core/ai-agreement-standards.md +103 -0
  42. package/bundled/locales/zh-CN/core/ai-command-behavior.md +247 -0
  43. package/bundled/locales/zh-CN/core/api-design-standards.md +946 -0
  44. package/bundled/locales/zh-CN/core/behavior-driven-development.md +48 -0
  45. package/bundled/locales/zh-CN/core/branch-completion.md +112 -0
  46. package/bundled/locales/zh-CN/core/change-batching-standards.md +265 -0
  47. package/bundled/locales/zh-CN/core/checkin-standards.md +43 -5
  48. package/bundled/locales/zh-CN/core/context-aware-loading.md +106 -0
  49. package/bundled/locales/zh-CN/core/database-standards.md +836 -0
  50. package/bundled/locales/zh-CN/core/deployment-standards.md +80 -0
  51. package/bundled/locales/zh-CN/core/error-code-standards.md +2 -2
  52. package/bundled/locales/zh-CN/core/forward-derivation-standards.md +493 -0
  53. package/bundled/locales/zh-CN/core/git-worktree.md +101 -0
  54. package/bundled/locales/zh-CN/core/model-selection.md +112 -0
  55. package/bundled/locales/zh-CN/core/performance-standards.md +104 -0
  56. package/bundled/locales/zh-CN/core/pipeline-integration-standards.md +238 -0
  57. package/bundled/locales/zh-CN/core/project-context-memory.md +124 -0
  58. package/bundled/locales/zh-CN/core/requirement-engineering.md +49 -0
  59. package/bundled/locales/zh-CN/core/security-standards.md +100 -0
  60. package/bundled/locales/zh-CN/core/systematic-debugging.md +106 -0
  61. package/bundled/locales/zh-CN/core/test-governance.md +116 -0
  62. package/bundled/locales/zh-CN/core/testing-standards.md +392 -156
  63. package/bundled/locales/zh-CN/core/verification-evidence.md +118 -0
  64. package/bundled/locales/zh-CN/core/virtual-organization-standards.md +104 -0
  65. package/bundled/locales/zh-CN/core/workflow-enforcement.md +132 -0
  66. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +27 -1
  67. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +9 -1
  68. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +37 -9
  69. package/bundled/locales/zh-CN/docs/USER-MANUAL.md +652 -0
  70. package/bundled/locales/zh-CN/integrations/github-copilot/copilot-instructions.md +1 -1
  71. package/bundled/locales/zh-CN/integrations/openspec/AGENTS.md +29 -4
  72. package/bundled/locales/zh-CN/integrations/spec-kit/AGENTS.md +143 -72
  73. package/bundled/locales/zh-CN/skills/ac-coverage-assistant/SKILL.md +126 -0
  74. package/bundled/locales/zh-CN/skills/api-design-assistant/SKILL.md +100 -0
  75. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +119 -0
  76. package/bundled/locales/zh-CN/skills/ci-cd-assistant/SKILL.md +82 -0
  77. package/bundled/locales/zh-CN/skills/commands/ac-coverage.md +97 -0
  78. package/bundled/locales/zh-CN/skills/commands/api-design.md +94 -0
  79. package/bundled/locales/zh-CN/skills/commands/atdd.md +163 -0
  80. package/bundled/locales/zh-CN/skills/commands/audit.md +77 -0
  81. package/bundled/locales/zh-CN/skills/commands/bdd.md +1 -1
  82. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +87 -0
  83. package/bundled/locales/zh-CN/skills/commands/changelog.md +63 -0
  84. package/bundled/locales/zh-CN/skills/commands/check.md +219 -0
  85. package/bundled/locales/zh-CN/skills/commands/checkin.md +61 -0
  86. package/bundled/locales/zh-CN/skills/commands/ci-cd.md +77 -0
  87. package/bundled/locales/zh-CN/skills/commands/commit.md +81 -0
  88. package/bundled/locales/zh-CN/skills/commands/config.md +207 -0
  89. package/bundled/locales/zh-CN/skills/commands/coverage.md +74 -0
  90. package/bundled/locales/zh-CN/skills/commands/database.md +78 -0
  91. package/bundled/locales/zh-CN/skills/commands/derive-all.md +58 -0
  92. package/bundled/locales/zh-CN/skills/commands/derive-atdd.md +54 -0
  93. package/bundled/locales/zh-CN/skills/commands/derive-bdd.md +53 -0
  94. package/bundled/locales/zh-CN/skills/commands/derive-tdd.md +54 -0
  95. package/bundled/locales/zh-CN/skills/commands/derive.md +78 -0
  96. package/bundled/locales/zh-CN/skills/commands/dev-workflow.md +119 -0
  97. package/bundled/locales/zh-CN/skills/commands/discover.md +86 -0
  98. package/bundled/locales/zh-CN/skills/commands/docgen.md +67 -0
  99. package/bundled/locales/zh-CN/skills/commands/docs.md +65 -0
  100. package/bundled/locales/zh-CN/skills/commands/durable.md +87 -0
  101. package/bundled/locales/zh-CN/skills/commands/guide.md +52 -0
  102. package/bundled/locales/zh-CN/skills/commands/incident.md +92 -0
  103. package/bundled/locales/zh-CN/skills/commands/init.md +272 -0
  104. package/bundled/locales/zh-CN/skills/commands/methodology.md +1 -1
  105. package/bundled/locales/zh-CN/skills/commands/metrics.md +73 -0
  106. package/bundled/locales/zh-CN/skills/commands/migrate.md +92 -0
  107. package/bundled/locales/zh-CN/skills/commands/pr.md +80 -0
  108. package/bundled/locales/zh-CN/skills/commands/refactor.md +1 -1
  109. package/bundled/locales/zh-CN/skills/commands/release.md +62 -0
  110. package/bundled/locales/zh-CN/skills/commands/requirement.md +54 -0
  111. package/bundled/locales/zh-CN/skills/commands/reverse-bdd.md +47 -0
  112. package/bundled/locales/zh-CN/skills/commands/reverse-sdd.md +51 -0
  113. package/bundled/locales/zh-CN/skills/commands/reverse-tdd.md +51 -0
  114. package/bundled/locales/zh-CN/skills/commands/reverse.md +63 -0
  115. package/bundled/locales/zh-CN/skills/commands/review.md +50 -0
  116. package/bundled/locales/zh-CN/skills/commands/scan.md +76 -0
  117. package/bundled/locales/zh-CN/skills/commands/sdd-retro.md +40 -0
  118. package/bundled/locales/zh-CN/skills/commands/sdd.md +379 -0
  119. package/bundled/locales/zh-CN/skills/commands/security.md +75 -0
  120. package/bundled/locales/zh-CN/skills/commands/tdd.md +111 -0
  121. package/bundled/locales/zh-CN/skills/commands/update.md +337 -0
  122. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +1 -2
  123. package/bundled/locales/zh-CN/skills/database-assistant/SKILL.md +97 -0
  124. package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +145 -0
  125. package/bundled/locales/zh-CN/skills/durable-execution-assistant/SKILL.md +84 -0
  126. package/bundled/locales/zh-CN/skills/incident-response-assistant/SKILL.md +107 -0
  127. package/bundled/locales/zh-CN/skills/metrics-dashboard-assistant/SKILL.md +67 -0
  128. package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +77 -0
  129. package/bundled/locales/zh-CN/skills/pr-automation-assistant/SKILL.md +90 -0
  130. package/bundled/locales/zh-CN/skills/security-assistant/SKILL.md +79 -0
  131. package/bundled/locales/zh-CN/skills/security-scan-assistant/SKILL.md +72 -0
  132. package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +73 -10
  133. package/bundled/locales/zh-CN/skills/spec-driven-dev/guide.md +267 -122
  134. package/bundled/locales/zh-TW/CLAUDE.md +2 -2
  135. package/bundled/locales/zh-TW/README.md +4 -4
  136. package/bundled/locales/zh-TW/SECURITY.md +92 -0
  137. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +301 -0
  138. package/bundled/locales/zh-TW/core/acceptance-test-driven-development.md +47 -0
  139. package/bundled/locales/zh-TW/core/accessibility-standards.md +84 -0
  140. package/bundled/locales/zh-TW/core/agent-dispatch.md +89 -0
  141. package/bundled/locales/zh-TW/core/ai-agreement-standards.md +87 -0
  142. package/bundled/locales/zh-TW/core/ai-command-behavior.md +247 -0
  143. package/bundled/locales/zh-TW/core/api-design-standards.md +946 -0
  144. package/bundled/locales/zh-TW/core/behavior-driven-development.md +63 -0
  145. package/bundled/locales/zh-TW/core/branch-completion.md +76 -0
  146. package/bundled/locales/zh-TW/core/change-batching-standards.md +265 -0
  147. package/bundled/locales/zh-TW/core/checkin-standards.md +39 -5
  148. package/bundled/locales/zh-TW/core/context-aware-loading.md +86 -0
  149. package/bundled/locales/zh-TW/core/database-standards.md +836 -0
  150. package/bundled/locales/zh-TW/core/deployment-standards.md +66 -0
  151. package/bundled/locales/zh-TW/core/error-code-standards.md +230 -4
  152. package/bundled/locales/zh-TW/core/forward-derivation-standards.md +62 -2
  153. package/bundled/locales/zh-TW/core/git-worktree.md +104 -0
  154. package/bundled/locales/zh-TW/core/model-selection.md +83 -0
  155. package/bundled/locales/zh-TW/core/performance-standards.md +84 -0
  156. package/bundled/locales/zh-TW/core/pipeline-integration-standards.md +238 -0
  157. package/bundled/locales/zh-TW/core/project-context-memory.md +79 -0
  158. package/bundled/locales/zh-TW/core/requirement-engineering.md +79 -0
  159. package/bundled/locales/zh-TW/core/security-standards.md +74 -0
  160. package/bundled/locales/zh-TW/core/systematic-debugging.md +95 -0
  161. package/bundled/locales/zh-TW/core/test-governance.md +88 -0
  162. package/bundled/locales/zh-TW/core/testing-standards.md +309 -86
  163. package/bundled/locales/zh-TW/core/verification-evidence.md +94 -0
  164. package/bundled/locales/zh-TW/core/virtual-organization-standards.md +88 -0
  165. package/bundled/locales/zh-TW/core/workflow-enforcement.md +132 -0
  166. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +27 -1
  167. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +9 -1
  168. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +37 -9
  169. package/bundled/locales/zh-TW/docs/USER-MANUAL.md +652 -0
  170. package/bundled/locales/zh-TW/integrations/github-copilot/copilot-instructions.md +1 -1
  171. package/bundled/locales/zh-TW/integrations/openspec/AGENTS.md +29 -4
  172. package/bundled/locales/zh-TW/integrations/spec-kit/AGENTS.md +142 -71
  173. package/bundled/locales/zh-TW/skills/ac-coverage-assistant/SKILL.md +127 -0
  174. package/bundled/locales/zh-TW/skills/ai-friendly-architecture/SKILL.md +1 -4
  175. package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +1 -4
  176. package/bundled/locales/zh-TW/skills/api-design-assistant/SKILL.md +97 -0
  177. package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +1 -4
  178. package/bundled/locales/zh-TW/skills/audit-assistant/SKILL.md +1 -4
  179. package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +1 -4
  180. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +1 -4
  181. package/bundled/locales/zh-TW/skills/changelog-guide/SKILL.md +1 -4
  182. package/bundled/locales/zh-TW/skills/checkin-assistant/SKILL.md +1 -4
  183. package/bundled/locales/zh-TW/skills/ci-cd-assistant/SKILL.md +79 -0
  184. package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +1 -4
  185. package/bundled/locales/zh-TW/skills/commands/ac-coverage.md +95 -0
  186. package/bundled/locales/zh-TW/skills/commands/api-design.md +92 -0
  187. package/bundled/locales/zh-TW/skills/commands/atdd.md +167 -0
  188. package/bundled/locales/zh-TW/skills/commands/audit.md +75 -0
  189. package/bundled/locales/zh-TW/skills/commands/bdd.md +1 -1
  190. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -0
  191. package/bundled/locales/zh-TW/skills/commands/changelog.md +67 -0
  192. package/bundled/locales/zh-TW/skills/commands/check.md +223 -0
  193. package/bundled/locales/zh-TW/skills/commands/checkin.md +65 -0
  194. package/bundled/locales/zh-TW/skills/commands/ci-cd.md +75 -0
  195. package/bundled/locales/zh-TW/skills/commands/commit.md +85 -0
  196. package/bundled/locales/zh-TW/skills/commands/config.md +211 -0
  197. package/bundled/locales/zh-TW/skills/commands/coverage.md +78 -0
  198. package/bundled/locales/zh-TW/skills/commands/database.md +76 -0
  199. package/bundled/locales/zh-TW/skills/commands/derive-all.md +62 -0
  200. package/bundled/locales/zh-TW/skills/commands/derive-atdd.md +58 -0
  201. package/bundled/locales/zh-TW/skills/commands/derive-bdd.md +54 -0
  202. package/bundled/locales/zh-TW/skills/commands/derive-tdd.md +55 -0
  203. package/bundled/locales/zh-TW/skills/commands/derive.md +79 -0
  204. package/bundled/locales/zh-TW/skills/commands/dev-workflow.md +120 -0
  205. package/bundled/locales/zh-TW/skills/commands/discover.md +87 -0
  206. package/bundled/locales/zh-TW/skills/commands/docgen.md +68 -0
  207. package/bundled/locales/zh-TW/skills/commands/docs.md +66 -0
  208. package/bundled/locales/zh-TW/skills/commands/durable.md +85 -0
  209. package/bundled/locales/zh-TW/skills/commands/guide.md +51 -0
  210. package/bundled/locales/zh-TW/skills/commands/incident.md +90 -0
  211. package/bundled/locales/zh-TW/skills/commands/init.md +273 -0
  212. package/bundled/locales/zh-TW/skills/commands/methodology.md +1 -1
  213. package/bundled/locales/zh-TW/skills/commands/metrics.md +71 -0
  214. package/bundled/locales/zh-TW/skills/commands/migrate.md +90 -0
  215. package/bundled/locales/zh-TW/skills/commands/pr.md +78 -0
  216. package/bundled/locales/zh-TW/skills/commands/refactor.md +1 -1
  217. package/bundled/locales/zh-TW/skills/commands/release.md +63 -0
  218. package/bundled/locales/zh-TW/skills/commands/requirement.md +61 -0
  219. package/bundled/locales/zh-TW/skills/commands/reverse-bdd.md +54 -0
  220. package/bundled/locales/zh-TW/skills/commands/reverse-sdd.md +58 -0
  221. package/bundled/locales/zh-TW/skills/commands/reverse-tdd.md +58 -0
  222. package/bundled/locales/zh-TW/skills/commands/reverse.md +70 -0
  223. package/bundled/locales/zh-TW/skills/commands/review.md +57 -0
  224. package/bundled/locales/zh-TW/skills/commands/scan.md +74 -0
  225. package/bundled/locales/zh-TW/skills/commands/sdd-retro.md +47 -0
  226. package/bundled/locales/zh-TW/skills/commands/sdd.md +362 -0
  227. package/bundled/locales/zh-TW/skills/commands/security.md +73 -0
  228. package/bundled/locales/zh-TW/skills/commands/tdd.md +115 -0
  229. package/bundled/locales/zh-TW/skills/commands/update.md +326 -0
  230. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -6
  231. package/bundled/locales/zh-TW/skills/database-assistant/SKILL.md +94 -0
  232. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +140 -0
  233. package/bundled/locales/zh-TW/skills/docs-generator/SKILL.md +1 -4
  234. package/bundled/locales/zh-TW/skills/documentation-guide/SKILL.md +1 -4
  235. package/bundled/locales/zh-TW/skills/durable-execution-assistant/SKILL.md +81 -0
  236. package/bundled/locales/zh-TW/skills/error-code-guide/SKILL.md +1 -4
  237. package/bundled/locales/zh-TW/skills/forward-derivation/SKILL.md +1 -4
  238. package/bundled/locales/zh-TW/skills/git-workflow-guide/SKILL.md +1 -4
  239. package/bundled/locales/zh-TW/skills/incident-response-assistant/SKILL.md +104 -0
  240. package/bundled/locales/zh-TW/skills/logging-guide/SKILL.md +1 -4
  241. package/bundled/locales/zh-TW/skills/methodology-system/SKILL.md +1 -4
  242. package/bundled/locales/zh-TW/skills/metrics-dashboard-assistant/SKILL.md +64 -0
  243. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +74 -0
  244. package/bundled/locales/zh-TW/skills/pr-automation-assistant/SKILL.md +87 -0
  245. package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +1 -4
  246. package/bundled/locales/zh-TW/skills/refactoring-assistant/SKILL.md +1 -4
  247. package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +1 -4
  248. package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +1 -4
  249. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +1 -4
  250. package/bundled/locales/zh-TW/skills/security-assistant/SKILL.md +76 -0
  251. package/bundled/locales/zh-TW/skills/security-scan-assistant/SKILL.md +69 -0
  252. package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +74 -14
  253. package/bundled/locales/zh-TW/skills/spec-driven-dev/guide.md +243 -98
  254. package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +1 -4
  255. package/bundled/locales/zh-TW/skills/test-coverage-assistant/SKILL.md +1 -4
  256. package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +1 -5
  257. package/bundled/skills/README.md +11 -0
  258. package/bundled/skills/ac-coverage-assistant/SKILL.md +127 -0
  259. package/bundled/skills/ai-collaboration-standards/SKILL.md +10 -0
  260. package/bundled/skills/ai-friendly-architecture/SKILL.md +10 -0
  261. package/bundled/skills/ai-instruction-standards/SKILL.md +10 -0
  262. package/bundled/skills/api-design-assistant/SKILL.md +119 -0
  263. package/bundled/skills/atdd-assistant/SKILL.md +7 -0
  264. package/bundled/skills/bdd-assistant/SKILL.md +7 -0
  265. package/bundled/skills/brainstorm-assistant/SKILL.md +7 -0
  266. package/bundled/skills/checkin-assistant/SKILL.md +7 -0
  267. package/bundled/skills/ci-cd-assistant/SKILL.md +97 -0
  268. package/bundled/skills/code-review-assistant/SKILL.md +7 -0
  269. package/bundled/skills/commands/README.md +70 -0
  270. package/bundled/skills/commands/ac-coverage.md +135 -0
  271. package/bundled/skills/commands/api-design.md +86 -0
  272. package/bundled/skills/commands/atdd.md +69 -0
  273. package/bundled/skills/commands/audit.md +69 -0
  274. package/bundled/skills/commands/bdd.md +101 -0
  275. package/bundled/skills/commands/brainstorm.md +45 -0
  276. package/bundled/skills/commands/changelog.md +34 -0
  277. package/bundled/skills/commands/check.md +52 -1
  278. package/bundled/skills/commands/checkin.md +46 -0
  279. package/bundled/skills/commands/ci-cd.md +69 -0
  280. package/bundled/skills/commands/commit.md +79 -0
  281. package/bundled/skills/commands/config.md +48 -0
  282. package/bundled/skills/commands/coverage.md +53 -0
  283. package/bundled/skills/commands/database.md +70 -0
  284. package/bundled/skills/commands/derive-all.md +40 -0
  285. package/bundled/skills/commands/derive-atdd.md +33 -0
  286. package/bundled/skills/commands/derive-bdd.md +39 -0
  287. package/bundled/skills/commands/derive-tdd.md +40 -0
  288. package/bundled/skills/commands/derive.md +47 -0
  289. package/bundled/skills/commands/dev-workflow.md +104 -7
  290. package/bundled/skills/commands/discover.md +39 -0
  291. package/bundled/skills/commands/docgen.md +35 -0
  292. package/bundled/skills/commands/docs.md +40 -0
  293. package/bundled/skills/commands/durable.md +79 -0
  294. package/bundled/skills/commands/incident.md +84 -0
  295. package/bundled/skills/commands/init.md +55 -0
  296. package/bundled/skills/commands/methodology.md +72 -0
  297. package/bundled/skills/commands/metrics.md +65 -0
  298. package/bundled/skills/commands/migrate.md +84 -0
  299. package/bundled/skills/commands/pr.md +72 -0
  300. package/bundled/skills/commands/refactor.md +51 -0
  301. package/bundled/skills/commands/release.md +60 -0
  302. package/bundled/skills/commands/requirement.md +38 -0
  303. package/bundled/skills/commands/reverse-bdd.md +34 -0
  304. package/bundled/skills/commands/reverse-sdd.md +42 -0
  305. package/bundled/skills/commands/reverse-tdd.md +40 -0
  306. package/bundled/skills/commands/reverse.md +41 -0
  307. package/bundled/skills/commands/review.md +39 -0
  308. package/bundled/skills/commands/scan.md +68 -0
  309. package/bundled/skills/commands/sdd-retro.md +48 -0
  310. package/bundled/skills/commands/sdd.md +220 -0
  311. package/bundled/skills/commands/security.md +67 -0
  312. package/bundled/skills/commands/tdd.md +101 -0
  313. package/bundled/skills/commands/update.md +61 -0
  314. package/bundled/skills/commit-standards/SKILL.md +8 -2
  315. package/bundled/skills/database-assistant/SKILL.md +118 -0
  316. package/bundled/skills/dev-workflow-guide/SKILL.md +53 -7
  317. package/bundled/skills/dev-workflow-guide/workflow-phases.md +24 -0
  318. package/bundled/skills/durable-execution-assistant/SKILL.md +116 -0
  319. package/bundled/skills/forward-derivation/SKILL.md +7 -0
  320. package/bundled/skills/incident-response-assistant/SKILL.md +132 -0
  321. package/bundled/skills/methodology-system/SKILL.md +24 -2
  322. package/bundled/skills/metrics-dashboard-assistant/SKILL.md +109 -0
  323. package/bundled/skills/migration-assistant/SKILL.md +119 -0
  324. package/bundled/skills/pr-automation-assistant/SKILL.md +114 -0
  325. package/bundled/skills/project-discovery/SKILL.md +7 -0
  326. package/bundled/skills/refactoring-assistant/SKILL.md +7 -0
  327. package/bundled/skills/release-standards/SKILL.md +7 -0
  328. package/bundled/skills/requirement-assistant/SKILL.md +7 -0
  329. package/bundled/skills/reverse-engineer/SKILL.md +7 -0
  330. package/bundled/skills/security-assistant/SKILL.md +105 -0
  331. package/bundled/skills/security-scan-assistant/SKILL.md +96 -0
  332. package/bundled/skills/spec-driven-dev/SKILL.md +84 -4
  333. package/bundled/skills/spec-driven-dev/guide.md +156 -22
  334. package/bundled/skills/tdd-assistant/SKILL.md +7 -0
  335. package/bundled/skills/test-coverage-assistant/SKILL.md +11 -0
  336. package/bundled/skills/testing-guide/SKILL.md +23 -0
  337. package/package.json +1 -1
  338. package/src/commands/check.js +154 -8
  339. package/src/commands/config.js +231 -104
  340. package/src/commands/init.js +23 -3
  341. package/src/commands/update.js +250 -25
  342. package/src/config/ai-agent-paths.js +16 -0
  343. package/src/config/workflow-definitions.js +184 -0
  344. package/src/core/constants.js +6 -0
  345. package/src/flows/init-flow.js +23 -6
  346. package/src/i18n/messages.js +51 -3
  347. package/src/installers/integration-installer.js +67 -2
  348. package/src/installers/manifest-installer.js +1 -0
  349. package/src/installers/standards-installer.js +3 -2
  350. package/src/prompts/init.js +50 -3
  351. package/src/reconciler/manifest-migrator.js +2 -2
  352. package/src/reconciler/plan-executor.js +11 -0
  353. package/src/utils/integration-generator.js +327 -14
  354. package/src/utils/workflow-gate.js +292 -0
  355. package/standards-registry.json +160 -5
@@ -1,259 +1,495 @@
1
1
  ---
2
2
  source: ../../../core/testing-standards.md
3
- source_version: 3.0.0
4
- translation_version: 3.0.0
5
- last_synced: 2026-02-10
3
+ source_version: 3.1.0
4
+ translation_version: 3.1.0
5
+ last_synced: 2026-03-25
6
6
  status: current
7
7
  ---
8
8
 
9
- > **语言**: [English](../../../core/testing-standards.md) | [简体中文](../../zh-TW/core/testing-standards.md) | 简体中文
10
-
11
9
  # 测试标准
12
10
 
13
- **版本**: 1.0.0
14
- **最后更新**: 2025-12-30
15
- **适用范围**: 所有需要自动化测试的软件项目
11
+ > **语言**: [English](../../../core/testing-standards.md) | [繁體中文](../../zh-TW/core/testing-standards.md) | 简体中文
12
+
13
+ **版本**: 3.1.0
14
+ **最后更新**: 2026-03-24
15
+ **适用性**: 所有软件项目
16
+ **范围**: universal
17
+ **行业标准**: ISTQB CTFL v4.0, ISO/IEC/IEEE 29119
18
+ **参考**: [istqb.org](https://istqb.org/)
16
19
 
17
20
  ---
18
21
 
19
22
  ## 目的
20
23
 
21
- 本标准定义测试策略和最佳实践,确保代码质量和可维护性。
24
+ 本标准为 AI 代理和开发者定义可操作的测试规则和约定。如需理论基础、教学内容和详细示例,请参阅[测试理论知识库](../../../skills/testing-guide/testing-theory.md)。
25
+
26
+ **参考标准**:
27
+ - [ISTQB CTFL v4.0](https://istqb.org/certifications/certified-tester-foundation-level-ctfl-v4-0/)
28
+ - [ISO/IEC/IEEE 29119](https://www.iso.org/standard/81291.html)
29
+ - [SWEBOK v4.0](https://www.computer.org/education/bodies-of-knowledge/software-engineering)
30
+
31
+ ---
32
+
33
+ ## 术语表
34
+
35
+ | 缩写 | 全称 | 说明 |
36
+ |------|------|------|
37
+ | **UT** | Unit Testing | 以隔离方式测试单个函数/方法 |
38
+ | **IT** | Integration Testing | 测试组件之间的交互 |
39
+ | **ST** | System Testing | 测试完整的集成系统 |
40
+ | **AT** | Acceptance Testing | 根据业务验收标准进行测试 |
41
+ | **E2E** | End-to-End Testing | 测试完整的用户工作流 |
42
+ | **UAT** | User Acceptance Testing | 由最终用户执行的验收测试 |
43
+ | **SIT** | System Integration Testing | 多系统之间的集成测试 |
44
+
45
+ > **注意**: 本文档中的 "IT" 始终指 "Integration Testing"(集成测试),而非 "Information Technology"(信息技术)。
46
+
47
+ ---
48
+
49
+ ## 覆盖率目标(主要指标)
50
+
51
+ > **覆盖率是测试质量的主要指标。** 更高的覆盖率代表更多代码受到测试保护。
52
+ > **覆蓋率是測試品質的主要指標。** 更高的覆蓋率代表更多程式碼受到測試保護。
53
+
54
+ | 指标 | 最低要求 | 标准 | 理想 |
55
+ |------|----------|------|------|
56
+ | **行覆盖率** | 80% | 90% | 95%+ |
57
+ | **分支覆盖率** | 70% | 85% | 90%+ |
58
+ | **函数覆盖率** | 85% | 95% | 100% |
59
+ | **变异评分** | — | 80% | 90%+(关键代码) |
60
+
61
+ **级别定义:**
62
+ - **最低要求**: 所有项目的基线——低于此值存在质量风险
63
+ - **标准**: 大多数项目的目标——通过规范化测试可以达成
64
+ - **理想**: 关键系统和核心业务逻辑的目标——在可行的范围内力争 100%
65
+
66
+ > **实用指南**: 100% 覆盖率是理想目标。在实践中,行覆盖率超过 95% 后会出现收益递减。最后的 5% 应聚焦于关键路径(身份认证、支付、数据完整性),而非生成的代码或简单的 getter/setter。
22
67
 
23
68
  ---
24
69
 
25
- ## 测试金字塔
70
+ ## 覆盖率与占比——关键区别
71
+
72
+ > **AI 代理和开发者:请勿混淆这两个概念。**
73
+
74
+ | 概念 | 含义 | 重要性 |
75
+ |------|------|--------|
76
+ | **Coverage(覆盖率)** | 测试执行的代码百分比 | **主要指标**——衡量保护程度 |
77
+ | **Ratio(占比)** | 各级别测试数量的分布 | 仅供参考——影响执行时间 |
78
+
79
+ **覆盖率**回答的是: "我的代码有多少被测试覆盖了?"
80
+ **占比**回答的是: "我的测试中,单元测试、集成测试、端到端测试各占多少比例?"
81
+
82
+ ---
83
+
84
+ ## 测试框架选择
85
+
86
+ | 框架 | 级别 | 最适用于 |
87
+ |------|------|----------|
88
+ | **ISTQB** | UT → IT/SIT → ST → AT/UAT | 企业级、合规性、正式 QA |
89
+ | **行业金字塔** | UT → IT → ST → E2E | 敏捷、DevOps、CI/CD |
90
+
91
+ ---
92
+
93
+ ## 测试金字塔(测试数量占比——仅供参考)
94
+
95
+ > **注意**: 以下是测试**数量**占比(各级别有多少测试),而非覆盖率目标。覆盖率要求请参阅上方的[覆盖率目标](#覆盖率目标主要指标)。
96
+
97
+ | 级别 | 测试数量占比 | 执行时间目标 |
98
+ |------|-------------|-------------|
99
+ | 单元测试 (UT) | 约 70% 的测试 | 总计 < 10 分钟 |
100
+ | 集成测试 (IT) | 约 20% 的测试 | 总计 < 30 分钟 |
101
+ | 系统测试 (ST) | 约 7% 的测试 | 总计 < 1 小时 |
102
+ | 端到端测试 (E2E) | 约 3% 的测试 | 总计 < 2 小时 |
103
+
104
+ > 70/20/7/3 的比例是经验性建议(Mike Cohn)。它针对快速反馈进行了优化——大多数测试运行迅速(UT),较少的测试运行缓慢(E2E)。
105
+
106
+ ---
26
107
 
27
- ### 框架选项
108
+ ## 测试级别要求
28
109
 
29
- 根据项目需求选择测试框架:
110
+ ### 单元测试 (UT)
30
111
 
31
- | 框架 | 最适合 | 级别 |
32
- |------|-------|------|
33
- | ISTQB 标准 | 企业项目、认证需求、正式 QA 流程 | 4 级 |
34
- | 业界金字塔 | 敏捷开发、CI/CD 优化、快速迭代 | 3 级 |
112
+ **特征**: 隔离的、快速的(每个 < 100ms)、确定性的
35
113
 
36
- ### 业界金字塔(默认)
114
+ #### 范围
37
115
 
116
+ | 包含 | 排除 |
117
+ |------|------|
118
+ | 单个函数/方法 | 数据库查询 |
119
+ | 单个类 | 外部 API 调用 |
120
+ | 纯业务逻辑 | 文件 I/O 操作 |
121
+ | 数据转换 | 多类交互 |
122
+ | 验证规则 | 网络调用 |
123
+
124
+ #### 命名约定
125
+
126
+ **文件命名**:
38
127
  ```
39
- /\
40
- / \ E2E 测试 (10%)
41
- /----\
42
- / \ 集成测试 (20%)
43
- /--------\
44
- / \ 单元测试 (70%)
45
- /------------\
128
+ [ClassName]Tests.[ext] # C#
129
+ [ClassName].test.[ext] # TypeScript/JavaScript
130
+ [class_name]_test.[ext] # Python, Go
46
131
  ```
47
132
 
48
- | 级别 | 缩写 | 比例 | 范围 | 速度 |
49
- |------|-----|------|------|------|
50
- | 单元测试 | UT | 70% | 单一函数/方法 | <100ms |
51
- | 集成测试 | IT/SIT* | 20% | 多个组件 | <1s |
52
- | 端到端测试 | E2E | 10% | 用户流程 | >10s |
133
+ **方法命名**(每个项目选择一种):
53
134
 
54
- *注:IT(敏捷/DevOps)或 SIT(企业/ISTQB)- 两者都指集成测试
135
+ | 风格 | 最适用于 | 示例 |
136
+ |------|----------|------|
137
+ | `[Method]_[Scenario]_[Result]` | C#, Java | `CalculateTotal_NegativePrice_ThrowsException()` |
138
+ | `should_[behavior]_when_[condition]` | JavaScript/TypeScript | `should_reject_login_when_account_locked()` |
139
+ | `test_[method]_[scenario]_[expected]` | Python (pytest) | `test_validate_email_invalid_format_returns_false()` |
55
140
 
56
- ### ISTQB 标准框架
141
+ #### 覆盖率阈值
57
142
 
58
- | 级别 | 缩写 | 说明 | 负责人 |
59
- |------|-----|------|-------|
60
- | 单元测试 | UT | 验证代码单元 | 开发者 |
61
- | 集成测试 | IT/SIT | 验证组件交互 | 开发者/QA |
62
- | 系统测试 | ST | 验证系统符合需求规格 | QA |
63
- | 验收测试 | AT/UAT | 验证系统符合业务需求 | 用户/业务方 |
143
+ > 请参阅本文档顶部的[覆盖率目标](#覆盖率目标主要指标)获取权威的覆盖率要求。
64
144
 
65
145
  ---
66
146
 
67
- ## FIRST 原则
147
+ ### 集成测试 (IT)
68
148
 
69
- | 原则 | 说明 |
149
+ **特征**: 组件集成、真实依赖(通常使用容器化)、每个 1-10
150
+
151
+ #### 何时需要
152
+
153
+ **决策规则**: 如果你的单元测试使用了通配匹配器(`any()`、`It.IsAny<>`、`Arg.Any<>`)来匹配查询/过滤参数,该功能**必须**有一个集成测试。
154
+
155
+ | 场景 | 原因 |
70
156
  |------|------|
71
- | **F**ast | 测试执行要快 |
72
- | **I**ndependent | 测试之间相互独立 |
73
- | **R**epeatable | 每次执行结果一致 |
74
- | **S**elf-validating | 自动判断通过/失败 |
75
- | **T**imely | 及时编写测试 |
157
+ | 查询谓词 | Mock 无法验证过滤表达式 |
158
+ | 实体关系 | 验证外键正确性 |
159
+ | 复合键 | 内存数据库可能与实际数据库不同 |
160
+ | 字段映射 | DTO ↔ Entity 转换 |
161
+ | 分页 | 行排序和计数 |
162
+ | 事务 | 回滚行为 |
163
+
164
+ #### 范围
165
+
166
+ | 包含 | 排除 |
167
+ |------|------|
168
+ | 数据库 CRUD 操作 | 完整用户工作流 |
169
+ | Repository + Database | 跨服务通信 |
170
+ | Service + Repository | UI 交互 |
171
+ | API 端点 + Service 层 | |
172
+ | 消息队列生产者/消费者 | |
173
+ | 缓存读写操作 | |
174
+
175
+ #### 命名约定
176
+
177
+ ```
178
+ [ComponentName]IntegrationTests.[ext]
179
+ [ComponentName].integration.test.[ext]
180
+ [ComponentName].itest.[ext]
181
+ ```
76
182
 
77
183
  ---
78
184
 
79
- ## 测试结构
185
+ ### 系统测试 (ST)
80
186
 
81
- ### AAA 模式
187
+ **特征**: 完整系统、类生产环境、基于需求
82
188
 
83
- ```javascript
84
- describe('UserService', () => {
85
- it('should return user when valid id provided', () => {
86
- // Arrange(准备)
87
- const userId = 1;
88
- const expectedUser = { id: 1, name: 'John' };
189
+ #### 范围
89
190
 
90
- // Act(执行)
91
- const result = userService.getUser(userId);
191
+ | 包含 | 排除 |
192
+ |------|------|
193
+ | 完整 API 工作流 | UI 视觉测试 |
194
+ | 跨服务事务 | 用户旅程模拟 |
195
+ | 整个系统的数据流 | A/B 测试场景 |
196
+ | 安全需求 | |
197
+ | 负载下的性能 | |
198
+ | 错误处理与恢复 | |
92
199
 
93
- // Assert(断言)
94
- expect(result).toEqual(expectedUser);
95
- });
96
- });
97
- ```
200
+ #### 类型
201
+
202
+ | 类型 | 说明 |
203
+ |------|------|
204
+ | 功能测试 | 验证功能按规格运作 |
205
+ | 性能测试 | 负载、压力、可扩展性测试 |
206
+ | 安全测试 | 渗透测试、漏洞扫描 |
207
+ | 可靠性测试 | 故障转移、恢复、稳定性 |
208
+ | 兼容性测试 | 跨平台、浏览器兼容性 |
98
209
 
99
- ### 命名规范
210
+ #### 命名约定
100
211
 
101
212
  ```
102
- should_<expected behavior>_when_<condition>
103
- test_<method>_<condition>_<expected result>
213
+ [Feature]SystemTests.[ext]
214
+ [Feature].system.test.[ext]
215
+ [Feature]_st.[ext]
104
216
  ```
105
217
 
106
- **好的示例**:
107
- - `should_return_user_when_valid_id_provided`
108
- - `test_login_fails_with_invalid_credentials`
218
+ ---
219
+
220
+ ### 端到端测试 (E2E)
109
221
 
110
- **差的示例**:
111
- - `test1`
112
- - `testLogin`
222
+ **特征**: 用户视角、全栈(UI → API → Database)、最慢(每个 30 秒以上)
223
+
224
+ #### 范围
225
+
226
+ | 包含 | 排除 |
227
+ |------|------|
228
+ | 关键用户旅程 | 所有可能的用户路径 |
229
+ | 登录/认证流程 | 边缘情况(使用 UT/IT) |
230
+ | 核心业务交易 | 性能基准测试 |
231
+ | 跨浏览器功能 | |
232
+ | 部署冒烟测试 | |
233
+
234
+ #### 命名约定
235
+
236
+ ```
237
+ [UserJourney].e2e.[ext]
238
+ [Feature].e2e.spec.[ext]
239
+ e2e/[feature]/[scenario].[ext]
240
+ ```
113
241
 
114
242
  ---
115
243
 
116
244
  ## 测试替身
117
245
 
118
- | 类型 | 用途 | 使用场景 |
119
- |------|------|---------|
120
- | Stub | 返回预设响应 | 简单依赖 |
121
- | Mock | 验证交互 | 复杂依赖 |
122
- | Fake | 工作中的实现 | 数据库/外部服务 |
123
- | Spy | 记录调用 | 验证行为 |
124
- | Dummy | 填充参数 | 未使用的参数 |
246
+ | 类型 | 目的 | 何时使用 |
247
+ |------|------|----------|
248
+ | **Stub** | 返回预定义值 | 固定的 API 响应 |
249
+ | **Mock** | 验证交互 | 验证方法被调用 |
250
+ | **Fake** | 简化的实现 | 内存数据库 |
251
+ | **Spy** | 记录调用,委托给真实对象 | 部分 Mock |
252
+ | **Dummy** | 占位符,从不使用 | 填充必需参数 |
253
+
254
+ ### 按测试级别的使用指南
255
+
256
+ | 级别 | 指南 |
257
+ |------|------|
258
+ | **UT** | 对所有外部依赖使用 Mock/Stub |
259
+ | **IT** | 对数据库使用 Fake,对外部 API 使用 Stub |
260
+ | **ST** | 使用真实组件,仅对外部第三方使用 Fake |
261
+ | **E2E** | 使用全部真实组件;仅对外部支付/邮件使用 Stub |
125
262
 
126
263
  ---
127
264
 
128
- ## 覆盖率指标
265
+ ## Mock 的局限性
266
+
267
+ **问题**: 通配匹配器(`any()`、`It.IsAny<>`)会忽略实际的查询逻辑,允许不正确的查询通过。
268
+
269
+ **规则**: 如果 Mock 的方法接受查询/过滤/谓词参数,你**必须**有一个对应的集成测试来验证查询逻辑。
270
+
271
+ ```python
272
+ # 示例 - Python
273
+ # ❌ 此测试无法验证查询的正确性
274
+ mock_repo.find.return_value = users
129
275
 
130
- | 指标 | 最低要求 | 建议目标 |
131
- |------|---------|---------|
132
- | 语句覆盖率 | 70% | 80% |
133
- | 分支覆盖率 | 60% | 75% |
134
- | 函数覆盖率 | 80% | 90% |
276
+ # 添加集成测试来验证实际查询
277
+ ```
135
278
 
136
279
  ---
137
280
 
138
- ## 测试文档结构
281
+ ## 测试数据要求
139
282
 
140
- 通过在测试目录中维护标准化的文档结构,提升测试可发现性。
283
+ ### 原则
141
284
 
142
- ### tests/README.md 必要区块
285
+ 1. **隔离性**: 每个测试管理自己的数据
286
+ 2. **清理**: 测试在执行后自行清理
287
+ 3. **确定性**: 测试不依赖共享状态
288
+ 4. **可读性**: 测试数据清晰地表达意图
143
289
 
144
- 每个 `tests/` 目录应包含 README.md,并具备以下区块以提高可发现性。
290
+ ### 不同标识符规则
145
291
 
146
- #### 1. 测试总览表格
292
+ 当实体同时具有代理键(自动生成的 ID)和业务标识符时,测试数据**必须**为每个键使用不同的值。
147
293
 
148
- 列出所有测试类型、数量、技术栈和执行环境。
294
+ ```python
295
+ # ❌ 错误: id 等于 business_code — 映射错误不会被检测到
296
+ dept = Department(id=1, business_code=1)
149
297
 
150
- ```markdown
151
- | 测试类型 | 数量 | 框架 | 环境 |
152
- |----------|------|------|------|
153
- | 单元测试 | 150 | Jest | Node.js |
154
- | 集成测试 | 45 | Jest | Node.js + TestContainers |
155
- | E2E 测试 | 12 | Playwright | 浏览器 |
298
+ # ✓ 正确: 不同的值可以捕获映射错误
299
+ dept = Department(id=1, business_code=1001)
300
+ ```
301
+
302
+ ### 复合键规则
303
+
304
+ 对于具有复合主键的实体,确保每条记录具有唯一的键组合。
305
+
306
+ ```python
307
+ # ❌ 键冲突
308
+ batch1 = BatchRecord(id=0, send_time=now)
309
+ batch2 = BatchRecord(id=0, send_time=now) # 冲突!
310
+
311
+ # ✓ 唯一组合
312
+ batch1 = BatchRecord(id=0, send_time=now + timedelta(seconds=1))
313
+ batch2 = BatchRecord(id=0, send_time=now + timedelta(seconds=2))
156
314
  ```
157
315
 
158
- #### 2. 当前状态区块
316
+ ---
317
+
318
+ ## 测试环境
319
+
320
+ ### 语言特定工具
321
+
322
+ | 语言 | 版本管理器 | 锁定文件 |
323
+ |------|-----------|----------|
324
+ | Python | venv, virtualenv, poetry | requirements.txt, poetry.lock |
325
+ | Node.js | nvm, fnm | package-lock.json, yarn.lock |
326
+ | Ruby | rbenv, rvm | Gemfile.lock |
327
+ | Java | SDKMAN, jenv | pom.xml, build.gradle.lock |
328
+ | .NET | dotnet SDK | packages.lock.json |
329
+ | Go | go mod | go.sum |
330
+ | Rust | rustup, cargo | Cargo.lock |
331
+
332
+ ### 最佳实践
333
+
334
+ 1. **始终使用虚拟环境**进行开发和测试
335
+ 2. **提交锁定文件**到版本控制
336
+ 3. **在 CI/CD 管道中固定版本**
337
+ 4. **在 README 或 .tool-versions 中记录所需的运行时版本**
338
+
339
+ ### 按测试级别的容器使用
340
+
341
+ | 级别 | 容器使用 |
342
+ |------|----------|
343
+ | UT | 不需要 - 使用 Mock |
344
+ | IT | 使用 Testcontainers 处理数据库、缓存 |
345
+ | ST | 使用 Docker Compose 搭建完整环境 |
346
+ | E2E | 完整的容器化堆栈 |
347
+
348
+ ---
349
+
350
+ ## CI/CD 集成
351
+
352
+ ### 测试执行策略
353
+
354
+ | 阶段 | 何时执行 | 超时 |
355
+ |------|----------|------|
356
+ | 单元测试 | 每次提交 | 10 分钟 |
357
+ | 集成测试 | 每次提交 | 30 分钟 |
358
+ | 系统测试 | PR 合并到 main | 2 小时 |
359
+ | 端到端测试 | 发布候选版 | 4 小时 |
360
+
361
+ ### 必需指标
362
+
363
+ | 指标 | UT | IT | ST | E2E |
364
+ |------|----|----|----|----|
365
+ | 通过/失败计数 | 必需 | 必需 | 必需 | 必需 |
366
+ | 执行时间 | 必需 | 必需 | 必需 | 必需 |
367
+ | 覆盖率 % | 必需 | 必需 | 可选 | 不需要 |
368
+ | 不稳定测试率 | 必需 | 必需 | 必需 | 必需 |
369
+ | 截图/视频 | 不需要 | 不需要 | 可选 | 必需 |
159
370
 
160
- 显示最新测试执行结果,包含清楚的通过/失败指标。
371
+ ---
161
372
 
162
- ```markdown
163
- ## 当前状态
373
+ ## 最佳实践
164
374
 
165
- | 指标 | 数值 | 目标 | 状态 |
166
- |------|------|------|------|
167
- | 通过率 | 98.5% | ≥ 95% | ✅ |
168
- | 行覆盖率 | 82% | ≥ 80% | ✅ |
169
- | 分支覆盖率 | 75% | ≥ 70% | ✅ |
375
+ ### AAA 模式
170
376
 
171
- **最后执行**: 2026-01-20 14:30 UTC
172
- **报告**: [test-report-20260120-143000.md](results/test-report-20260120-143000.md)
173
377
  ```
378
+ // Arrange - 设置测试数据和环境
379
+ // Act - 执行被测行为
380
+ // Assert - 验证结果
381
+ ```
382
+
383
+ ### FIRST 原则
384
+
385
+ | 原则 | 说明 |
386
+ |------|------|
387
+ | **F**ast(快速) | 测试运行迅速 |
388
+ | **I**ndependent(独立) | 测试之间互不影响 |
389
+ | **R**epeatable(可重复) | 每次结果相同 |
390
+ | **S**elf-validating(自验证) | 清晰的通过/失败 |
391
+ | **T**imely(及时) | 与生产代码同步编写 |
392
+
393
+ ### 应避免的反模式
394
+
395
+ - 测试相互依赖(测试必须按特定顺序运行)
396
+ - 不稳定测试(有时通过,有时失败)
397
+ - 测试实现细节(重构时测试就会失败)
398
+ - 过度 Mock(没有真实的东西被测试)
399
+ - 缺少断言(测试没有验证任何有意义的内容)
400
+ - 魔术数字/字符串(未解释的值)
401
+ - 相同的测试 ID(代理键和业务键使用相同的值)
402
+
403
+ ---
404
+
405
+ ## 测试文档结构
406
+
407
+ ### tests/README.md 必需章节
408
+
409
+ 每个 `tests/` 目录**应该**包含一个 README.md,包含以下内容:
410
+
411
+ #### 1. 测试概览表
412
+
413
+ | 测试类型 | 数量 | 框架 | 环境 |
414
+ |----------|------|------|------|
415
+ | 单元测试 | 150 | Jest | Node.js |
416
+ | 集成测试 | 45 | Jest | Node.js + TestContainers |
417
+ | 端到端测试 | 12 | Playwright | Browser |
174
418
 
175
- #### 3. 报告链接区块
419
+ #### 2. 当前状态章节
176
420
 
177
- 包含测试报告、差距分析和覆盖率摘要的链接。
421
+ | 指标 | 值 | 目标 | 状态 |
422
+ |------|-----|------|------|
423
+ | 通过率 | 98.5% | >= 95% | 通过 |
424
+ | 行覆盖率 | 82% | >= 80% | 通过 |
425
+ | 分支覆盖率 | 75% | >= 70% | 通过 |
178
426
 
179
- ```markdown
180
- ## 报告
427
+ #### 3. 报告链接章节
181
428
 
182
429
  | 报告类型 | 位置 | 说明 |
183
430
  |----------|------|------|
184
- | 测试结果 | `results/` | 带时间戳的测试执行报告 |
185
- | 覆盖率 | `coverage/` | 代码覆盖率报告(HTML、JSON) |
186
- | 差距分析 | `docs/gap-analysis.md` | 缺失的测试覆盖率分析 |
187
- ```
431
+ | 测试结果 | `results/` | 带时间戳的执行报告 |
432
+ | 覆盖率 | `coverage/` | 代码覆盖率报告 |
433
+ | 差距分析 | `docs/gap-analysis.md` | 缺失覆盖率分析 |
188
434
 
189
- ### 测试报告命名规范
435
+ ### 测试报告命名约定
190
436
 
191
- | 项目 | 规范 | 范例 |
437
+ | 项目 | 约定 | 示例 |
192
438
  |------|------|------|
193
- | 报告文件名 | `test-report-YYYYMMDD-HHMMSS.md` | `test-report-20260120-143000.md` |
194
- | 报告目录 | `tests/results/` | `tests/results/test-report-*.md` |
195
- | 覆盖率目录 | `tests/coverage/` | `tests/coverage/lcov-report/` |
196
- | 差距分析 | `tests/docs/gap-analysis.md` | - |
439
+ | 报告文件名 | `test-report-YYYYMMDD-HHMMSS.md` | `test-report-20260129-143000.md` |
440
+ | 报告目录 | `tests/results/` | |
441
+ | 覆盖率目录 | `tests/coverage/` | |
197
442
 
198
- ### 目录结构范例
443
+ ### 目录结构
199
444
 
200
445
  ```
201
446
  tests/
202
- ├── README.md # 测试总览与状态
447
+ ├── README.md # 测试概览和状态
203
448
  ├── results/ # 测试执行报告
204
- │ ├── test-report-20260120-143000.md
205
- │ └── test-report-20260119-090000.md
206
449
  ├── coverage/ # 覆盖率报告
207
- │ ├── lcov-report/
208
- │ └── coverage-summary.json
209
450
  ├── docs/ # 测试文档
210
- │ └── gap-analysis.md
211
451
  ├── unit/ # 单元测试
212
452
  ├── integration/ # 集成测试
213
- └── e2e/ # 端对端测试
453
+ └── e2e/ # 端到端测试
214
454
  ```
215
455
 
216
- ### 效益
217
-
218
- | 效益 | 说明 |
219
- |------|------|
220
- | **可发现性** | 开发者可快速找到测试状态,无需全面搜索 |
221
- | **透明度** | 当前质量指标一目了然 |
222
- | **可追溯性** | 历史报告支援趋势分析 |
223
- | **新人入门** | 新团队成员可立即理解测试结构 |
456
+ ---
224
457
 
225
458
  ---
226
459
 
227
- ## 快速参考卡
460
+ ## 相关标准
228
461
 
229
- ### 测试类型选择
462
+ - [测试理论知识库](../../../skills/testing-guide/testing-theory.md) - 教学内容、示例、技术
463
+ - [测试驱动开发](test-driven-development.md) - TDD/BDD/ATDD 方法论
464
+ - [测试完整度维度](test-completeness-dimensions.md) - 8 维度测试覆盖
465
+ - [规格驱动开发](spec-driven-development.md) - SDD 工作流集成
466
+ - [代码签入标准](checkin-standards.md)
467
+ - [代码审查清单](code-review-checklist.md)
468
+ - [部署标准](deployment-standards.md) - 部署就绪的测试要求
230
469
 
231
- | 测试什么? | 使用类型 |
232
- |-----------|---------|
233
- | 单一函数逻辑 | 单元测试 |
234
- | 组件间交互 | 集成测试 |
235
- | 完整用户流程 | E2E 测试 |
236
- | 安全漏洞 | 安全测试 |
237
- | 性能瓶颈 | 性能测试 |
238
- | API 契约 | 契约测试 |
470
+ ---
239
471
 
240
- ### 检查清单
472
+ ## 版本历史
241
473
 
242
- - [ ] 遵循测试金字塔比例
243
- - [ ] 使用 AAA 模式
244
- - [ ] 测试名称具描述性
245
- - [ ] 测试相互独立
246
- - [ ] 覆盖边界条件
474
+ | 版本 | 日期 | 变更 |
475
+ |------|------|------|
476
+ | 3.1.0 | 2026-03-24 | **覆盖率优先重构**: 将覆盖率目标提升为主要位置,提高阈值(行 80/90/95+、分支 70/85/90+、函数 85/95/100),新增覆盖率与占比的区分,将测试金字塔降级为仅供参考 |
477
+ | 3.0.0 | 2026-01-29 | **重大重构**: 拆分为规则(本文件)和理论(testing-theory.md)。从 141KB/3185 行缩减至约 12KB/350 行。所有教学内容迁移至 skills/testing-guide/testing-theory.md。纯规则格式,针对 AI 代理使用进行优化。 |
478
+ | 2.2.0 | 2026-01-20 | 新增测试文档结构章节 |
479
+ | 2.1.0 | 2026-01-05 | 新增 SWEBOK v4.0 参考、测试基础、测试相关度量 |
480
+ | 2.0.0 | 2026-01-05 | 重大更新,对齐 ISTQB CTFL v4.0 和 ISO/IEC/IEEE 29119 |
481
+ | 1.3.0 | 2025-12-29 | 新增测试框架选择、IT/SIT 缩写说明 |
482
+ | 1.2.0 | 2025-12-19 | 新增 Mock 局限性、集成测试要求、测试数据模式 |
483
+ | 1.1.1 | 2025-12-11 | 改进系统测试示例,使用通用领域概念 |
484
+ | 1.1.0 | 2025-12-05 | 新增测试环境隔离章节 |
485
+ | 1.0.0 | 2025-12-05 | 初始测试标准,包含 UT/IT/ST/E2E 覆盖 |
247
486
 
248
487
  ---
249
488
 
250
- ## 相关标准
489
+ ## 许可证
251
490
 
252
- - [代码审查指南](code-review-checklist.md)
253
- - [测试完整性维度](test-completeness-dimensions.md)
491
+ 本标准以 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 发布。
254
492
 
255
493
  ---
256
494
 
257
- ## 许可证
258
-
259
- 本标准采用 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 发布。
495
+ **维护者**: Development Team