aodw-skill 0.7.3

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 (188) hide show
  1. package/.aodw/01-core/ai-interaction-rules.md +218 -0
  2. package/.aodw/01-core/ai-knowledge-rules.md +302 -0
  3. package/.aodw/01-core/ai-project-overview-rules.md +284 -0
  4. package/.aodw/01-core/aodw-constitution-summary.md +20 -0
  5. package/.aodw/01-core/aodw-constitution.md +419 -0
  6. package/.aodw/01-core/csf-thinking-framework.md +373 -0
  7. package/.aodw/01-core/git-discipline.md +226 -0
  8. package/.aodw/01-core/module-doc-rules.md +90 -0
  9. package/.aodw/02-workflow/aodw-development-stages.md +235 -0
  10. package/.aodw/02-workflow/rt-id-generation-rules.md +267 -0
  11. package/.aodw/02-workflow/rt-manager-summary.md +15 -0
  12. package/.aodw/02-workflow/rt-manager.md +399 -0
  13. package/.aodw/02-workflow/spec-full-profile-summary.md +13 -0
  14. package/.aodw/02-workflow/spec-full-profile.md +391 -0
  15. package/.aodw/02-workflow/spec-lite-profile.md +313 -0
  16. package/.aodw/02-workflow/ui-workflow-rules.md +334 -0
  17. package/.aodw/03-standards/ai-coding-rules-common.md +89 -0
  18. package/.aodw/03-standards/ai-coding-rules.md +370 -0
  19. package/.aodw/03-standards/stacks/java-springboot/ai-coding-rules-backend.md +100 -0
  20. package/.aodw/03-standards/stacks/python-fastapi/ai-coding-rules-backend.md +612 -0
  21. package/.aodw/03-standards/stacks/react-typescript/ai-coding-rules-frontend.md +291 -0
  22. package/.aodw/03-standards/stacks/vue2/ai-coding-rules-frontend.md +97 -0
  23. package/.aodw/03-standards/ui-kit/ui-kit.md +163 -0
  24. package/.aodw/04-auditors/aodw-development-auditor-rules.md +470 -0
  25. package/.aodw/04-auditors/aodw-full-auditor-rules.md +365 -0
  26. package/.aodw/04-auditors/aodw-requirement-auditor-rules.md +408 -0
  27. package/.aodw/05-tooling/ai-tools-init-rules.md +465 -0
  28. package/.aodw/06-project/ai-overview.md +116 -0
  29. package/.aodw/06-project/modules-index.yaml +11 -0
  30. package/.aodw/07-optimization/token-usage-analysis.md +253 -0
  31. package/.aodw/README.md +26 -0
  32. package/.aodw/RELEASE-CHECKLIST.md +144 -0
  33. package/.aodw/config.yaml +2 -0
  34. package/.aodw/manifest.yaml +98 -0
  35. package/.aodw/templates/SOURCE-TO-DISTRIBUTION-GUIDE.md +276 -0
  36. package/.aodw/templates/TEMPLATE-APPLICATION-GUIDE.md +246 -0
  37. package/.aodw/templates/aodw-kernel-loader-template.md +70 -0
  38. package/.aodw/templates/audit-report-template.md +232 -0
  39. package/.aodw/templates/changelog-template.md +16 -0
  40. package/.aodw/templates/checklists/coding-standards-template.md +110 -0
  41. package/.aodw/templates/csf-review-template.md +201 -0
  42. package/.aodw/templates/impact-template.md +17 -0
  43. package/.aodw/templates/invariants-template.md +12 -0
  44. package/.aodw/templates/module-readme-template.md +39 -0
  45. package/.aodw/templates/plan-lite-template.md +11 -0
  46. package/.aodw/templates/rt-decision-template.md +13 -0
  47. package/.aodw/templates/rt-intake-template.md +33 -0
  48. package/.aodw/templates/rt-meta-template.yaml +43 -0
  49. package/.aodw/templates/spec-lite-template.md +17 -0
  50. package/.aodw/templates/tests-template.md +13 -0
  51. package/.aodw/templates/tools-config/README.md +80 -0
  52. package/.aodw/templates/tools-config/backend/black.config.template.toml +6 -0
  53. package/.aodw/templates/tools-config/backend/pre-commit.config.template.yaml +16 -0
  54. package/.aodw/templates/tools-config/backend/ruff.config.template.toml +23 -0
  55. package/.aodw/templates/tools-config/frontend/eslint.config.template.json +113 -0
  56. package/.aodw/templates/tools-config/frontend/prettier.config.template.json +10 -0
  57. package/.aodw/templates/tools-config/frontend/tsconfig.paths.template.json +11 -0
  58. package/.aodw/workflow-guide.md +51 -0
  59. package/AODW_Adapters/README.md +143 -0
  60. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-check.md +7 -0
  61. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-done.md +7 -0
  62. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-full.md +7 -0
  63. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-governance.md +7 -0
  64. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-impact.md +7 -0
  65. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-init.md +7 -0
  66. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-invariants.md +7 -0
  67. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-lite.md +7 -0
  68. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-module.md +7 -0
  69. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-new.md +7 -0
  70. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-open.md +7 -0
  71. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-pause.md +7 -0
  72. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-resume.md +7 -0
  73. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-tests.md +7 -0
  74. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw-upgrade.md +7 -0
  75. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/.agent/rules/aodw.md +35 -0
  76. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-check.md +16 -0
  77. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-done.md +16 -0
  78. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-full.md +14 -0
  79. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-governance.md +13 -0
  80. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-impact.md +13 -0
  81. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-init.md +13 -0
  82. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-invariants.md +13 -0
  83. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-lite.md +14 -0
  84. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-module.md +13 -0
  85. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-new.md +30 -0
  86. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-open.md +10 -0
  87. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-pause.md +12 -0
  88. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-resume.md +12 -0
  89. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-tests.md +13 -0
  90. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw-upgrade.md +12 -0
  91. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/antigravity/global_workflows/aodw.md +18 -0
  92. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/claude/CLAUDE.md +17 -0
  93. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-check.md +30 -0
  94. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-done.md +52 -0
  95. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-full.md +31 -0
  96. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-governance.md +34 -0
  97. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-impact.md +25 -0
  98. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-init.md +75 -0
  99. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-invariants.md +29 -0
  100. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-lite.md +23 -0
  101. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-module.md +24 -0
  102. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-new.md +70 -0
  103. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-open.md +19 -0
  104. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-pause.md +19 -0
  105. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-resume.md +20 -0
  106. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-tests.md +26 -0
  107. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw-upgrade.md +27 -0
  108. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/aodw.md +69 -0
  109. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/deploypromote.md +20 -0
  110. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/commands/featuretotester.md +32 -0
  111. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/deploy/feature_to_master_push_test_local.sh +390 -0
  112. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/deploy/promote_only.sh +210 -0
  113. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/deploy/rollback_prod.sh +99 -0
  114. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/cursor/.cursor/rules/aodw.mdc +26 -0
  115. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-check.md +29 -0
  116. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-done.md +52 -0
  117. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-full.md +30 -0
  118. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-governance.md +33 -0
  119. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-impact.md +24 -0
  120. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-init.md +75 -0
  121. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-invariants.md +28 -0
  122. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-lite.md +22 -0
  123. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-module.md +23 -0
  124. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-new.md +92 -0
  125. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-open.md +18 -0
  126. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-pause.md +18 -0
  127. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-resume.md +19 -0
  128. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-tests.md +25 -0
  129. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw-upgrade.md +26 -0
  130. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/.agent/rules/aodw.md +68 -0
  131. package/AODW_Adapters/_backup/v3.1.0-pre-refactor/gemini/GEMINI.md +17 -0
  132. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-analyze.md +15 -0
  133. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-complete.md +15 -0
  134. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-control.md +14 -0
  135. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-decide.md +16 -0
  136. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-governance.md +7 -0
  137. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-implement.md +16 -0
  138. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-init.md +7 -0
  139. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-intake.md +15 -0
  140. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-open.md +7 -0
  141. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-simplified.md +107 -0
  142. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/.agent/rules/aodw-verify.md +14 -0
  143. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-analyze.md +24 -0
  144. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-complete.md +23 -0
  145. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-control.md +21 -0
  146. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-decide.md +26 -0
  147. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-governance.md +13 -0
  148. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-implement.md +21 -0
  149. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-init.md +13 -0
  150. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-intake.md +28 -0
  151. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-open.md +10 -0
  152. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw-verify.md +20 -0
  153. package/AODW_Adapters/_backup/v4.0.0-simplified/antigravity/global_workflows/aodw.md +18 -0
  154. package/AODW_Adapters/antigravity/.agent/rules/aodw.md +74 -0
  155. package/AODW_Adapters/claude/CLAUDE.md +70 -0
  156. package/AODW_Adapters/cursor/.cursor/commands/README.md +37 -0
  157. package/AODW_Adapters/cursor/.cursor/rules/aodw.mdc +77 -0
  158. package/AODW_Adapters/gemini/.agent/rules/aodw-analyze.md +15 -0
  159. package/AODW_Adapters/gemini/.agent/rules/aodw-complete.md +15 -0
  160. package/AODW_Adapters/gemini/.agent/rules/aodw-control.md +14 -0
  161. package/AODW_Adapters/gemini/.agent/rules/aodw-decide.md +16 -0
  162. package/AODW_Adapters/gemini/.agent/rules/aodw-governance.md +33 -0
  163. package/AODW_Adapters/gemini/.agent/rules/aodw-implement.md +16 -0
  164. package/AODW_Adapters/gemini/.agent/rules/aodw-init.md +75 -0
  165. package/AODW_Adapters/gemini/.agent/rules/aodw-intake.md +15 -0
  166. package/AODW_Adapters/gemini/.agent/rules/aodw-open.md +18 -0
  167. package/AODW_Adapters/gemini/.agent/rules/aodw-verify.md +14 -0
  168. package/AODW_Adapters/gemini/.agent/rules/aodw.md +70 -0
  169. package/AODW_Adapters/gemini/GEMINI.md +17 -0
  170. package/AODW_Adapters/general/.github/copilot-instructions.md +34 -0
  171. package/AODW_Adapters/general/AGENTS.md +70 -0
  172. package/README.md +118 -0
  173. package/bin/aodw.js +627 -0
  174. package/bin/commands/init-overview.js +801 -0
  175. package/bin/commands/init-tools.js +811 -0
  176. package/bin/commands/new.js +235 -0
  177. package/bin/commands/serve.js +79 -0
  178. package/bin/processors/index.js +109 -0
  179. package/bin/update-adapters-from-template.js +89 -0
  180. package/bin/utils/config.js +56 -0
  181. package/docs/README.md +26 -0
  182. package/docs/adapter-evaluation.md +55 -0
  183. package/docs/backend-guidelines.md +335 -0
  184. package/docs/frontend-guidelines.md +266 -0
  185. package/docs/installation-variants.md +88 -0
  186. package/docs/migration-guide-0.2.0.md +250 -0
  187. package/docs/platform-matrix.md +83 -0
  188. package/package.json +40 -0
@@ -0,0 +1,370 @@
1
+ # AI Coding Rules
2
+ 适用于 Cursor / Claude / Codeium 等所有 AI 工具。
3
+
4
+ 本文件定义 AI 在修改代码前后必须遵守的行为规范。
5
+ 任何 AI 开发助手在本仓库中工作时,都应视本文件为“行为准则”。
6
+
7
+ ---
8
+
9
+ ## 0. 必读文档
10
+
11
+ 在进行任何非琐碎(非机械重复)操作前,AI 必须:
12
+
13
+ 1. **读取核心文档**:
14
+ - `.aodw/01-core/aodw-constitution.md`
15
+ - `.aodw/06-project/ai-overview.md`
16
+ - `.aodw/03-standards/ai-coding-rules.md`(本文件)
17
+ - `.aodw/01-core/ai-knowledge-rules.md`
18
+
19
+ 2. **按需加载开发规范**(根据任务类型):
20
+ - **通用编码规范**:必须读取 `.aodw/03-standards/ai-coding-rules-common.md`(文件大小、复杂度、拆分原则等)
21
+ - **如果涉及前端开发**:必须读取对应的栈规范(React: `stacks/react-typescript/...`, Vue2: `stacks/vue2/...`)
22
+ - **如果涉及后端开发**:必须读取对应的栈规范(Python: `stacks/python-fastapi/...`, Java: `stacks/java-springboot/...`)
23
+ - **如果涉及 UI 设计**:必须读取 `.aodw/ai-coding-rules-ui.md`(如果存在)
24
+
25
+ **判断任务类型的依据**:
26
+ - **代码路径**:
27
+ - 包含 `frontend/`、`src/pages/`、`src/features/` 等 → 前端
28
+ - 包含 `backend/`、`api/`、`services/` 等 → 后端
29
+ - **文件类型**:
30
+ - `.tsx`、`.ts`(在 frontend 目录下)→ 前端
31
+ - `.py`、`.go`、`.java` 等 → 后端
32
+ - **RT 文档**:
33
+ - `intake.md` 或 `spec.md` 中明确说明的任务类型
34
+ - **用户明确说明**:
35
+ - 用户明确说"前端"、"后端"等关键词
36
+
37
+ 3. **读取当前 RT 目录**(如存在):
38
+ - `RT/RT-XXX/**`
39
+
40
+ 4. **读取相关模块 README**:
41
+ - 根据代码路径与 `ai-overview.md` 中的映射,查找对应的模块文档。
42
+
43
+ 如上信息缺失,AI 应主动提示用户并建议创建或补全。
44
+
45
+ ---
46
+
47
+ ## 1. 基本原则
48
+
49
+ 1. **以终为始**
50
+ - 先明确目标与期望行为,再考虑具体改动。
51
+ 2. **最小必要修改**
52
+ - 优先选择最小、可验证、可回滚的改动;
53
+ - 避免大面积“顺手重构”。
54
+ 3. **不破坏 Invariants**
55
+ - 在修改前查阅 `invariants.md`、`ai-overview.md` 中的不变条件;
56
+ - 如确需修改,必须走 Spec-Full 流程并更新相关文档。
57
+ 4. **文档先行,代码随后**
58
+ - 重要变更应在 spec / plan / impact / invariants 中有记录。
59
+
60
+ ---
61
+
62
+ ## 2. 影响分析(Impact Analysis)
63
+
64
+ 在提出任何解决方案之前,AI 必须生成一份影响分析,并写入当前 RT 的 `impact.md`(或更新之)。
65
+
66
+ 建议结构:
67
+
68
+ ```markdown
69
+ ## 影响分析 (Impact Analysis)
70
+
71
+ ### 1. 问题触发点
72
+ - 入口(界面 / 接口 / 调度任务):
73
+ - 简要复现路径:
74
+
75
+ ### 2. 直接相关模块
76
+ - 控制器 / 路由:
77
+ - Service:
78
+ - Repository / DAO:
79
+ - UI 组件:
80
+
81
+ ### 3. 间接影响
82
+ - 依赖的共享组件:
83
+ - 事件 / 消息链:
84
+ - 可能受影响的上下游:
85
+
86
+ ### 4. 风险点
87
+ - 潜在数据损坏风险:
88
+ - 潜在安全风险:
89
+ - 潜在性能风险:
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 3. 不可破坏原则(Invariants)
95
+
96
+ 在动任何代码前,AI 必须:
97
+
98
+ 1. 打开并检查:
99
+ - `RT/RT-XXX/invariants.md`(如果存在)
100
+ - `.aodw/06-project/ai-overview.md` 中的系统级 Invariants
101
+ 2. 在 `invariants.md` 中列出本次改动必须保持的条件,例如:
102
+
103
+ ```markdown
104
+ ## 不可破坏行为 (Invariants)
105
+
106
+ - 保持 /api/v1/orders/{id} 的响应结构不变;
107
+ - 保证已存在的订单查询过滤逻辑不受影响;
108
+ - 保持用户权限检查机制不被绕过。
109
+ ```
110
+
111
+ 如发现当前行为已违反 invariants,应先修正文档或代码使其一致,再进行进一步改动。
112
+
113
+ ---
114
+
115
+ ## 4. 方案设计(Solution Design)
116
+
117
+ AI 提出变更方案时,应:
118
+
119
+ 1. 至少给出 2–3 个不同方案(包括“维持现状但在文档中记录”的选项,如适用);
120
+ 2. 对每个方案简要说明:
121
+ - 修改位置;
122
+ - 优点;
123
+ - 缺点;
124
+ - 对风险点的影响;
125
+ 3. 提供一个 **推荐方案**,并说明推荐理由;
126
+ 4. 允许用户选择“推荐方案”或指定其他选项。
127
+
128
+ 在 Spec-Full 流程中,方案设计应记录在 `plan.md`;
129
+ 在 Spec-Lite 流程中,记录在 `plan-lite.md`。
130
+
131
+ ---
132
+
133
+ ## 5. 修改策略(Safe Modification Strategy)
134
+
135
+ 在修改代码时,AI 应遵守:
136
+
137
+ 1. **局部化修改**
138
+ - 除非走 Spec-Full 且有充分设计,不进行大范围重构;
139
+ - 尽量只修改与本 RT 相关的模块 / 文件。
140
+ 2. **分步提交**
141
+ - 逻辑修改与格式化 / 重排分开提交;
142
+ - 如一次 RT 需要多阶段修改,可分多次提交。
143
+ 3. **保持兼容**
144
+ - 在不破坏 Invariants 的前提下,避免改变对外可见行为;
145
+ - 如需要引入 breaking change,必须通过 Spec-Full 并在 `changelog.md` 中记录清晰。
146
+
147
+ ---
148
+
149
+ ## 6. 测试策略(Testing Strategy)
150
+
151
+ 在任何非琐碎修改之后,AI 必须:
152
+
153
+ 1. 在 `RT/RT-XXX/tests.md` 中补充或更新测试点,内容包括:
154
+ - 需要新增的单元测试;
155
+ - 需要回归的集成 / API 测试;
156
+ - 特别需要关注的边界条件;
157
+ 2. 如项目存在自动化测试框架:
158
+ - 建议具体的测试文件与用例位置;
159
+ - 如可能,直接生成或修改测试代码。
160
+
161
+ 示例条目:
162
+
163
+ ```markdown
164
+ - [ ] 为 OrderService.addItem 添加当库存不足时的异常分支测试(tests/orders/order_service.test.ts)
165
+ - [ ] 回归测试:用户从“我的订单”页面进入订单详情时的数据加载与权限检查
166
+ ```
167
+
168
+
169
+ ---
170
+
171
+ ## 7. Git Discipline(完成与合并规则)
172
+
173
+ 所有 Git 操作必须严格遵循 `.aodw/01-core/git-discipline.md` 中定义的规范,包括:
174
+
175
+ - **分支命名**:`feature/RT-XXX-short-name`
176
+ - **提交信息格式**:Conventional Commits + `Refs: RT-XXX`
177
+ - **标签规范**:`done-RT-XXX`
178
+ - **合并策略**:根据团队约定选择 merge / rebase
179
+ - **知识蒸馏**:合并前必须完成文档同步(详见 `git-discipline.md` Section 5)
180
+
181
+ AI 在完成 RT 时,应提示用户执行完整的 Git Discipline 流程,或使用团队内部的自动化脚本。
182
+
183
+
184
+
185
+ ---
186
+
187
+ ## 8. 代码复杂度与输出规范 (Complexity & Output Standards)
188
+
189
+ > **注意**:本节的详细规范已移至 `.aodw/03-standards/ai-coding-rules-common.md`。
190
+ > 所有开发任务都必须读取该文件,了解文件大小限制、复杂度控制、拆分原则和输出策略。
191
+
192
+ **必须读取**:`.aodw/03-standards/ai-coding-rules-common.md`
193
+
194
+ 该文件包含:
195
+ - 全局文件长度限制(软上限)
196
+ - 函数/方法/类限制
197
+ - 拆分原则 (Splitting Principle)
198
+ - 输出策略 (Output Strategy)
199
+ - 复杂度控制
200
+ - 代码质量检查
201
+
202
+ ---
203
+
204
+ ## 9. 开发规范索引 (Development Standards Index)
205
+
206
+ 本文件采用模块化设计,根据不同任务类型按需加载相应的开发规范。
207
+
208
+ ### 9.1 通用编码规范
209
+
210
+ **文件**:`.aodw/03-standards/ai-coding-rules-common.md`
211
+
212
+ **适用场景**:所有类型的代码开发
213
+
214
+ **内容**:
215
+ - 文件大小限制
216
+ - 函数/方法/类限制
217
+ - 拆分原则
218
+ - 输出策略
219
+ - 复杂度控制
220
+
221
+ **加载要求**:**必须读取**(所有开发任务)
222
+
223
+ ---
224
+
225
+ ### 9.2 前端开发规范
226
+
227
+ **文件**:`.aodw/03-standards/stacks/react-typescript/ai-coding-rules-frontend.md`
228
+
229
+ **适用场景**:
230
+ - 前端开发(React + TypeScript + Vite)
231
+ - UI 组件开发
232
+ - 前端工具配置
233
+
234
+ **内容**:
235
+ - 技术栈确认
236
+ - 工具配置检查(ESLint + Prettier)
237
+ - 目录结构规范
238
+ - 命名规范
239
+ - TypeScript 规范
240
+ - React 编码规范
241
+ - Tailwind & Radix 使用规范
242
+ - AI 实现流程约束
243
+ - 前端代码提交前检查清单
244
+
245
+ **加载要求**:**如果涉及前端开发,必须读取**
246
+
247
+ **判断依据**:
248
+ - 代码路径包含 `frontend/`、`src/pages/`、`src/features/` 等
249
+ - 文件类型为 `.tsx`、`.ts`(在 frontend 目录下)
250
+ - RT 文档中明确说明为前端任务
251
+ - 用户明确说明为前端开发
252
+
253
+ ---
254
+
255
+ ### 9.3 前端开发规范 (Vue 2)
256
+
257
+ **文件**:`.aodw/03-standards/stacks/vue2/ai-coding-rules-frontend.md`
258
+
259
+ **适用场景**:
260
+ - 前端开发(Vue 2.6 + Webpack 4)
261
+ - UI 组件开发
262
+ - 旧项目维护
263
+
264
+ **加载要求**:**如果涉及 Vue 2 开发,必须读取**
265
+
266
+ **判断依据**:
267
+ - `package.json` 中包含 `"vue": "^2.x"`
268
+ - 文件类型为 `.vue`
269
+ - 用户明确说明为 Vue 2 开发
270
+
271
+ ---
272
+
273
+ ### 9.4 后端开发规范 (Python FastAPI)
274
+
275
+ **文件**:`.aodw/03-standards/stacks/python-fastapi/ai-coding-rules-backend.md`
276
+
277
+ **适用场景**:
278
+ - 后端开发(FastAPI / Python、Node.js、Go 等)
279
+ - API 开发
280
+ - 数据库操作
281
+ - 后端工具配置
282
+
283
+ **内容**:
284
+ - 技术栈确认
285
+ - 工具配置检查(Ruff、Black 等)
286
+ - 目录结构规范
287
+ - 命名规范
288
+ - API 设计规范
289
+ - 数据库操作规范
290
+ - 安全规范
291
+ - 性能优化
292
+ - 测试规范
293
+ - 后端代码提交前检查清单
294
+
295
+ **加载要求**:**如果涉及后端开发,必须读取**
296
+
297
+ **判断依据**:
298
+ - 代码路径包含 `backend/`、`api/`、`services/` 等
299
+ - 文件类型为 `.py`、`.go`、`.java` 等
300
+ - RT 文档中明确说明为后端任务
301
+ - 用户明确说明为后端开发
302
+
303
+ ---
304
+
305
+ ### 9.5 后端开发规范 (Java SpringBoot)
306
+
307
+ **文件**:`.aodw/03-standards/stacks/java-springboot/ai-coding-rules-backend.md`
308
+
309
+ **适用场景**:
310
+ - 后端开发(Java 21 + Spring Boot 2.7)
311
+ - 企业级应用开发
312
+
313
+ **加载要求**:**如果涉及 Java 开发,必须读取**
314
+
315
+ **判断依据**:
316
+ - 代码路径包含 `src/main/java`
317
+ - 文件类型为 `.java`、`pom.xml`
318
+ - 用户明确说明为 Java 开发
319
+
320
+ ---
321
+
322
+ ### 9.6 UI 设计规范(将来)
323
+
324
+ **文件**:`.aodw/ai-coding-rules-ui.md`
325
+
326
+ **适用场景**:
327
+ - UI 设计
328
+ - 设计系统规范
329
+ - 组件库使用规范
330
+
331
+ **加载要求**:**如果涉及 UI 设计,必须读取**(如果文件存在)
332
+
333
+ ---
334
+
335
+ ### 9.7 工具初始化规则
336
+
337
+ **文件**:`.aodw/05-tooling/ai-tools-init-rules.md`
338
+
339
+ **适用场景**:
340
+ - 用户说"初始化工具"、"设置开发工具"、"配置工具"等
341
+ - 编码前检测到工具未初始化
342
+
343
+ **内容**:
344
+ - 触发条件
345
+ - 执行流程(检测项目类型、检测工具状态、交互式引导、验证配置)
346
+ - 配置文件合并策略
347
+ - 安装命令参考
348
+ - 配置模板位置
349
+ - 状态文件格式
350
+ - 交互规范
351
+
352
+ **加载要求**:**如果用户表达工具初始化意图,或检测到工具未初始化,必须读取**
353
+
354
+ ---
355
+
356
+ ### 9.8 规范加载流程
357
+
358
+ AI 在执行开发任务时,必须按以下流程加载规范:
359
+
360
+ 1. **第一步**:读取核心文档(见第 0 节)
361
+ 2. **第二步**:判断任务类型(根据代码路径、文件类型、RT 文档、用户说明)
362
+ 3. **第三步**:按需加载开发规范:
363
+ - **必须**读取 `.aodw/03-standards/ai-coding-rules-common.md`(通用规范)
364
+ - **如果涉及前端 (React)**:读取 `.aodw/03-standards/stacks/react-typescript/ai-coding-rules-frontend.md`
365
+ - **如果涉及前端 (Vue 2)**:读取 `.aodw/03-standards/stacks/vue2/ai-coding-rules-frontend.md`
366
+ - **如果涉及后端 (Python)**:读取 `.aodw/03-standards/stacks/python-fastapi/ai-coding-rules-backend.md`
367
+ - **如果涉及后端 (Java)**:读取 `.aodw/03-standards/stacks/java-springboot/ai-coding-rules-backend.md`
368
+ - **如果涉及 UI 设计**:读取 `.aodw/ai-coding-rules-ui.md`(如果存在)
369
+ - **如果用户表达工具初始化意图**:读取 `.aodw/05-tooling/ai-tools-init-rules.md`
370
+ 4. **第四步**:根据规范执行开发任务
@@ -0,0 +1,100 @@
1
+ # AI Coding Rules - Backend Development
2
+
3
+ > **注意**:本文件是 `.aodw/03-standards/ai-coding-rules.md` 的子规范文件。
4
+ > 请先阅读主文件了解通用编码原则,再阅读本文件了解后端特定规范。
5
+
6
+ **适用场景**:
7
+ - 后端开发(Spring Boot 2.7.18 + Java 21)
8
+ - API 开发 (RESTful)
9
+ - 数据库操作 (MySQL / MyBatis / Spring Data JPA)
10
+ - 后端工具配置
11
+
12
+ ---
13
+
14
+ ## 1. 技术栈确认
15
+
16
+ 适用项目技术栈:
17
+ - **核心框架**:Spring Boot 2.7.18
18
+ - **JDK 版本**:Java 21
19
+ - **依赖管理**:Maven
20
+ - **注册/配置中心**:Nacos
21
+ - **数据库**:MySQL
22
+ - **持久层中间件**:xg-cloud-mysql (基于 Spring Boot Starter)
23
+ - **缓存**:Redis
24
+ - **消息中间件**:RabbitMQ
25
+
26
+ ---
27
+
28
+ ## 2. 目录结构规范
29
+
30
+ ### 2.1 标准 Maven 结构
31
+ ```
32
+ backend/
33
+ src/
34
+ main/
35
+ java/
36
+ com/xgjktech/pms/
37
+ business/ # 业务核心模块
38
+ sys/ # 系统管理模块
39
+ bpsp/ # 任务同步模块
40
+ base/ # 基础组件与配置
41
+ resources/
42
+ bootstrap.properties
43
+ logback-spring.xml
44
+ test/ # 单元测试与集成测试
45
+ pom.xml # 依赖定义
46
+ ```
47
+
48
+ ### 2.2 模块内分层 (Layered Architecture)
49
+ - **controller**: 路由入口,仅负责参数校验与响应封装。
50
+ - **service**: 业务逻辑层,核心业务实现。
51
+ - **mapper / dao**: 数据访问层,SQL 映射或 JPA Repository。
52
+ - **data/entity**: 数据库实体类。
53
+ - **data/vo**: 接口返回对象。
54
+ - **data/param**: 接口请求参数。
55
+
56
+ ---
57
+
58
+ ## 3. 命名规范
59
+
60
+ - **类名**: PascalCase (如 `ProjectService`)。
61
+ - **接口名**: 无需 `I` 前缀。
62
+ - **方法/变量**: camelCase。
63
+ - **Mapper XML**: 建议与 Mapper 接口同名且位于对应包路径下。
64
+
65
+ ---
66
+
67
+ ## 4. Spring Boot 编码规范
68
+
69
+ ### 4.1 注解使用
70
+ - 优先使用构造函数注入 (`@RequiredArgsConstructor`) 代替 `@Autowired`。
71
+ - 控制器统一使用 `@RestController` 和 `@RequestMapping`。
72
+
73
+ ### 4.2 异常处理
74
+ - 严禁捕获异常后不做任何处理。
75
+ - 业务异常应抛出自定义异常类,由全局异常处理器统一拦截。
76
+
77
+ ### 4.3 数据库操作
78
+ - 严禁在循环内执行 SQL 查询。
79
+ - 复杂 SQL 必须写在 Mapper XML 中。
80
+
81
+ ---
82
+
83
+ ## 5. 依赖管理 (Maven)
84
+
85
+ - **pom.xml**:
86
+ - 代码变更涉及新依赖时,必须更新 `pom.xml`。
87
+ - 优先检查 `xg-common-parent` 中定义的版本,避免冲突。
88
+ - 依赖范围必须准确(compile, provided, test 等)。
89
+
90
+ ---
91
+
92
+ ## 6. AI 实现流程约束
93
+
94
+ ### 6.1 生成粒度
95
+ - 遵循“一个文件一次生成”原则。
96
+ - 复杂功能应先生成 Entity/Repository,再生成 Service,最后生成 Controller。
97
+
98
+ ### 6.2 代码质量
99
+ - 所有的 POJO 类建议使用 `@Data` (Lombok) 以减少冗余。
100
+ - API 接口必须符合 RESTful 设计原则。