universal-dev-standards 5.15.1 → 5.17.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 (84) hide show
  1. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
  2. package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
  3. package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +1 -1
  4. package/bundled/core/acceptance-criteria-traceability.md +46 -0
  5. package/bundled/core/forward-derivation-standards.md +19 -0
  6. package/bundled/core/knowledge-graph-memory.md +2 -2
  7. package/bundled/core/spec-driven-development.md +21 -3
  8. package/bundled/locales/zh-CN/CHANGELOG.md +23 -3
  9. package/bundled/locales/zh-CN/README.md +1 -1
  10. package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
  11. package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
  12. package/bundled/locales/zh-CN/core/spec-driven-development.md +16 -2
  13. package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
  14. package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
  15. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
  16. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
  17. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
  18. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
  19. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
  20. package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
  21. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
  22. package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
  23. package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
  24. package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
  25. package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
  26. package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
  27. package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
  28. package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
  29. package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
  30. package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
  31. package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
  32. package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
  33. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
  34. package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
  35. package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
  36. package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
  37. package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
  38. package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
  39. package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
  40. package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
  41. package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
  42. package/bundled/locales/zh-TW/CHANGELOG.md +23 -3
  43. package/bundled/locales/zh-TW/README.md +1 -1
  44. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
  45. package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
  46. package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
  47. package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
  48. package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
  49. package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +2 -2
  50. package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
  51. package/bundled/locales/zh-TW/core/spec-driven-development.md +20 -2
  52. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
  53. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
  54. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
  55. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
  56. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
  57. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
  58. package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
  59. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
  60. package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +5 -5
  61. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
  62. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
  63. package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
  64. package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +3 -2
  65. package/bundled/locales/zh-TW/skills/plan/SKILL.md +3 -2
  66. package/bundled/locales/zh-TW/skills/push/SKILL.md +3 -2
  67. package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
  68. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
  69. package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
  70. package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
  71. package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
  72. package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
  73. package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
  74. package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
  75. package/bundled/skills/brainstorm-assistant/guide.md +256 -661
  76. package/bundled/skills/commands/brainstorm.md +51 -30
  77. package/bundled/skills/knowledge-graph/SKILL.md +5 -5
  78. package/bundled/skills/knowledge-graph/guide.md +4 -4
  79. package/bundled/skills/spec-driven-dev/SKILL.md +27 -0
  80. package/package.json +2 -2
  81. package/src/commands/check.js +11 -2
  82. package/src/lint/i18n.js +109 -23
  83. package/standards-registry.json +4 -4
  84. package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
@@ -1,19 +1,20 @@
1
1
  ---
2
2
  source: ../../../../skills/commands/brainstorm.md
3
- source_version: 1.0.0
4
- translation_version: 1.0.0
5
- last_synced: 2026-03-19
3
+ source_version: 3.0.0
4
+ source_hash: 3212203924de
5
+ translation_version: 3.0.0
6
+ last_synced: 2026-06-01
6
7
  ---
7
8
 
8
9
  ---
9
10
  name: brainstorm
10
- description: "[UDS] Structured AI-assisted brainstorming before spec creation"
11
+ description: "[UDS] 在编写规格前进行结构化 AI 辅助头脑风暴"
11
12
  argument-hint: "[问题或功能构想 | problem or feature idea]"
12
13
  ---
13
14
 
14
- # 脑力激荡助手
15
+ # 头脑风暴助手
15
16
 
16
- 在撰写规格前进行结构化发想。通过引导式脑力激荡,将模糊构想转化为可执行的功能提案。
17
+ 在编写规格前进行结构化发想。通过 persona 集成式头脑风暴,将模糊构想转化为可执行的功能提案。
17
18
 
18
19
  ## 用法
19
20
 
@@ -24,33 +25,37 @@ argument-hint: "[问题或功能构想 | problem or feature idea]"
24
25
  ## 工作流程
25
26
 
26
27
  ```
27
- FRAME ──► DIVERGE ──► CONVERGE ──► OUTPUT
28
- 定义问题 发散思考 收敛评估 输出提案
28
+ PRE-FLIGHT ──► FRAME ──► DIVERGE ──────────► CONVERGE ─────────► OUTPUT
29
+ 防锚定 定义问题 persona 集成+透镜 多评审面板+硬角色反驳 输出提案
29
30
  ```
30
31
 
31
- | 阶段 | 目标 | 关键技法 |
32
- |------|------|----------|
32
+ | 阶段 | 目标 | 关键技法(v3) |
33
+ |------|------|----------------|
34
+ | **PRE-FLIGHT** | 防止 AI 锚定 | 用户先写 3 个想法;不用类比种子 |
33
35
  | **FRAME** | 清楚定义问题 | 5 Whys, HMW, Stakeholder Map |
34
- | **DIVERGE** | 生成大量想法 | HMW, SCAMPER, Six Thinking Hats |
35
- | **CONVERGE** | 评估与排序 | Evaluation Matrix, Dot Voting |
36
- | **OUTPUT** | 可执行的报告 | Brainstorm Report template |
36
+ | **DIVERGE** | 逼出视角多样性 | persona 集成 + 多样性透镜 |
37
+ | **CONVERGE** | 经偏误检查的选择 | 多评审面板 + Devil's Advocate/Steelman |
38
+ | **OUTPUT** | 可执行的报告 | Brainstorm Report 模板 |
37
39
 
38
40
  ## 技法
39
41
 
40
42
  | 技法 | 适用场景 |
41
43
  |------|----------|
42
- | **5 Whys** | 找到根本原因 |
43
- | **HMW** | 将问题重构为机会 |
44
- | **SCAMPER** | 改善现有功能 |
45
- | **Six Thinking Hats** | 多角度分析 |
46
- | **Dot Voting** | 快速排序 |
44
+ | **persona 集成** | 强制视角多样性(v3 核心) |
45
+ | **多样性透镜** | 类比 / 反转 / 形态 |
46
+ | **多评审面板** | 降偏误评分(v3 核心) |
47
+ | **Devil's Advocate + Steelman** | 硬角色反驳 |
48
+ | **5 Whys / HMW / SCAMPER / 六顶帽** | 经典框定与发散 |
47
49
 
48
50
  ## 范例
49
51
 
50
52
  ```bash
51
- /brainstorm # Start interactive session
52
- /brainstorm "user retention" # Brainstorm around a topic
53
- /brainstorm --technique scamper # Use a specific technique
53
+ /brainstorm # Start interactive session
54
+ /brainstorm "user retention" # Brainstorm around a topic
55
+ /brainstorm --enhanced "user retention" # Parallel persona ensemble (if host supports it)
56
+ /brainstorm --personas "designer,economist,skeptic" # Custom personas
57
+ /brainstorm --lens analogical "onboarding" # Force the analogical lens
58
+ /brainstorm --quick "reduce checkout friction" # Fast 3-idea mode
54
59
  ```
55
60
 
56
61
  ## 输出格式
@@ -62,9 +67,10 @@ FRAME ──► DIVERGE ──► CONVERGE ──► OUTPUT
62
67
  [Refined problem from FRAME phase]
63
68
 
64
69
  ## Top 3 Recommendations
65
- 1. **[Idea]** — Score: X.X — [Why recommended]
66
- 2. **[Idea]** — Score: X.X — [Why recommended]
67
- 3. **[Idea]** — Score: X.X — [Why recommended]
70
+ 1. **[Idea]** — Agg. X.X ✓ Passed rebuttal Persona: [..] — [Why recommended]
71
+
72
+ ## Diversity Note
73
+ [How many distinct personas/lenses the surviving ideas span]
68
74
 
69
75
  ## Next Steps
70
76
  - [ ] Proceed to `/requirement` with top idea
@@ -73,15 +79,76 @@ FRAME ──► DIVERGE ──► CONVERGE ──► OUTPUT
73
79
 
74
80
  ## 后续步骤
75
81
 
76
- 脑力激荡后,典型的工作流程是:
82
+ 头脑风暴后,典型的工作流程是:
77
83
 
78
84
  1. `/brainstorm` - 结构化发想(本命令)
79
85
  2. `/requirement` - 撰写用户故事和需求
80
86
  3. `/sdd` - 创建规格文档
81
87
  4. `/derive-all` 或 `/tdd` - 以测试保护进行实现
82
88
 
89
+ ## AI 代理行为
90
+
91
+ > 遵循 [AI Command Behavior Standards](../../core/ai-command-behavior.md)
92
+
93
+ ### 进入路由
94
+
95
+ | 输入 | AI 动作 |
96
+ |------|---------|
97
+ | `/brainstorm` | 启动 PRE-FLIGHT,请用户先写 问题+3 想法+反向排除 |
98
+ | `/brainstorm "topic"` | 以指定主题启动 PRE-FLIGHT,再进入 FRAME |
99
+ | `/brainstorm --personas "a,b,c"` | 以自定义 persona 组进入 DIVERGE |
100
+ | `/brainstorm --lens <name>` | 以指定多样性透镜为主进入 DIVERGE |
101
+ | `/brainstorm --enhanced` | 若宿主支持子代理则并行跑 persona/评审,否则静默退回 baseline |
102
+
103
+ ### 交互脚本
104
+
105
+ #### PRE-FLIGHT 阶段
106
+ 1. 请用户先写 问题(一句)+3 个初始想法+最不想要的解法类型
107
+ 2. 拒绝「像 X 但给 Y」种子,改写为底层问题
108
+
109
+ 🛑 **STOP**: 收到三项输入前不生成任何想法(`--skip-preflight` 例外,显示锚定警告)
110
+
111
+ #### FRAME 阶段
112
+ 1. 厘清问题陈述(5 Whys 找根因)
113
+ 2. 重构为 HMW 问题;识别利益相关者
114
+
115
+ 🛑 **STOP**: 问题定义后等待用户确认
116
+
117
+ #### DIVERGE 阶段
118
+ 1. 逐一以默认 persona(领域专家/怀疑者/跨域类比者/成本约束者/用户代言)思维链生成想法
119
+ 2. **分支隔离**:生成各 persona 时不互相预览,全部产完才一起呈现
120
+ 3. 至少套用一个多样性透镜(类比/假设反转/形态矩阵)
121
+ 4. 以多样性(覆盖的 persona/透镜数)而非数量为继续门槛
122
+
123
+ #### CONVERGE 阶段
124
+ 1. 以 3 个独立评审(工程可行性/用户影响/战略一致)各自评分后聚合
125
+ 2. 对前 3 名跑硬角色 Devil's Advocate(论证会失败)+ Steelman;用户以 (a)修改/(b)反驳/(c)移除 回应
126
+ 3. 排序并标记通过反驳的想法
127
+
128
+ 🛑 **STOP**: 展示 Brainstorm Report 后等待用户决定下一步
129
+
130
+ ### 停止点
131
+
132
+ | 停止点 | 等待内容 |
133
+ |--------|----------|
134
+ | PRE-FLIGHT 提交前 | 收到用户三项输入 |
135
+ | 问题定义后 | 确认问题正确 |
136
+ | 反驳轮每个反对理由 | 用户 (a)/(b)/(c) 回应 |
137
+ | 报告展示后 | 决定进入 `/requirement` 或 `/sdd` |
138
+
139
+ ### 错误处理
140
+
141
+ | 错误条件 | AI 动作 |
142
+ |----------|---------|
143
+ | 主题太宽泛 | 引导缩小范围 |
144
+ | 使用「像 X 但给 Y」种子 | 改写为底层问题再继续(反种子 guardrail) |
145
+ | 指定的 persona/透镜不存在 | 列出可用选项供选择 |
146
+ | `--enhanced` 但宿主不支持子代理 | 静默退回 baseline,照常进行 |
147
+ | 前 3 名全来自同一 persona/透镜 | 标示并在输出前再跑一个透镜 |
148
+
83
149
  ## 参考
84
150
 
85
151
  * [Brainstorm Assistant Skill](../brainstorm-assistant/SKILL.md)
152
+ * [Brainstorm Assistant Guide](../brainstorm-assistant/guide.md)
86
153
  * [Requirement Assistant](../requirement-assistant/SKILL.md)
87
154
  * [Spec-Driven Development](../spec-driven-dev/SKILL.md)
@@ -1,11 +1,12 @@
1
1
  ---
2
2
  source: ../../../../skills/commit-standards/SKILL.md
3
3
  source_version: 1.0.0
4
+ source_hash: 8535f438ced8
4
5
  translation_version: 1.0.0
5
- last_synced: 2026-02-10
6
+ last_synced: 2026-06-01
6
7
  status: current
7
8
  description: |
8
- 根据 Conventional Commits 规范产生格式正确的 commit message。
9
+ [UDS] 根据 Conventional Commits 规范产生格式正确的 commit message。
9
10
  使用时机:提交代码、撰写 commit message、检查提交格式。
10
11
  关键字:commit, conventional commits, 提交, 消息, feat, fix, refactor。
11
12
  ---
@@ -18,31 +19,34 @@ description: |
18
19
 
19
20
  ## 工作流程
20
21
 
22
+ 0. **检测语言** - 读取 `.standards/manifest.json` → 检查 `options.output_language`。若找不到,默认为 `english`。
21
23
  1. **检查状态** - 执行 `git status` 和 `git diff --staged` 了解变更内容
22
24
  2. **分析变更** - 判断类型(feat、fix、refactor 等)和范围
23
- 3. **产生消息** - 根据以下格式建立 commit message
25
+ 3. **产生消息** - 按检测到的语言,依以下对应格式建立 commit message(见下方)
24
26
  4. **确认并提交** - 在执行 `git commit` 前询问用户确认
25
27
 
26
28
  ### 消息格式
27
29
 
28
30
  ```
29
31
  <type>(<scope>): <subject>
32
+
30
33
  <body>
34
+
31
35
  <footer>
32
36
  ```
33
37
 
34
38
  ## 提交类型
35
39
 
36
- | 类型 | 使用时机 | When to Use |
37
- |------|---------|-------------|
38
- | `feat` | 新功能 | New feature |
39
- | `fix` | 修复错误 | Bug fix |
40
- | `refactor` | 重构(无功能变更) | Code refactoring |
41
- | `docs` | 文档更新 | Documentation |
42
- | `style` | 格式调整(无逻辑变更) | Formatting |
43
- | `test` | 测试相关 | Tests |
44
- | `perf` | 性能优化 | Performance |
45
- | `chore` | 维护任务 | Maintenance |
40
+ | 类型 | 使用时机 |
41
+ |------|---------|
42
+ | `feat` | 新功能 |
43
+ | `fix` | 修复错误 |
44
+ | `refactor` | 重构(无功能变更) |
45
+ | `docs` | 文档更新 |
46
+ | `style` | 格式调整(无逻辑变更) |
47
+ | `test` | 测试相关 |
48
+ | `perf` | 性能优化 |
49
+ | `chore` | 维护任务 |
46
50
 
47
51
  ## 规则
48
52
 
@@ -50,6 +54,60 @@ description: |
50
54
  - **Body**:说明**为什么**进行变更,而非仅描述变更了什么
51
55
  - **Footer**:使用 `BREAKING CHANGE:` 标记破坏性变更,使用 `Fixes #123` 关联 issue
52
56
 
57
+ ## 双语格式
58
+
59
+ 当 `output_language` 为 `bilingual` 时,你必须使用以下格式:
60
+
61
+ ```
62
+ <type>(<scope>): <English subject>. <中文主旨>.
63
+
64
+ <English body — explain what and why in English>
65
+
66
+ <中文正文 — 用中文说明做了什么及为什么>
67
+
68
+ <footer>
69
+ ```
70
+
71
+ ### 必须遵守的规则
72
+
73
+ 1. 英文正文在前,中文正文在后
74
+ 2. 英文正文与中文正文之间以空白行分隔
75
+ 3. 严禁在同一段落内混用语言
76
+ 4. 严禁省略中文正文——两种语言皆为必填
77
+ 5. Footer(BREAKING CHANGE、Fixes #、Co-authored-by)置于两段正文之后的最末端
78
+
79
+ ### 双语示例
80
+
81
+ ```
82
+ feat(auth): Add OAuth2 Google login support. 新增 OAuth2 Google 登录支持.
83
+
84
+ Implement Google OAuth2 authentication flow for user login.
85
+
86
+ - Add Google OAuth2 SDK integration
87
+ - Create callback endpoint for OAuth flow
88
+ - Store refresh tokens securely
89
+
90
+ 实现 Google OAuth2 认证流程供用户登录。
91
+
92
+ - 集成 Google OAuth2 SDK
93
+ - 建立 OAuth 流程回调端点
94
+ - 安全存储刷新令牌
95
+
96
+ Closes #123
97
+ ```
98
+
99
+ ## 繁体中文格式
100
+
101
+ 当 `output_language` 为 `traditional-chinese` 时,使用中文类型与正文:
102
+
103
+ ```
104
+ 功能(认证): 新增 OAuth2 Google 登录支持
105
+
106
+ 实现 Google OAuth2 认证流程供用户登录。
107
+
108
+ 关闭 #123
109
+ ```
110
+
53
111
  ## 使用方式
54
112
 
55
113
  - `/commit` - 自动分析 staged 的变更并建议 commit message
@@ -60,11 +118,15 @@ description: |
60
118
  `/commit` 完成后,AI 助手应建议:
61
119
 
62
120
  > **提交完成。建议下一步:**
63
- > - 执行 `git push` 推送到远端
64
- > - 准备发布时 → 执行 `/changelog` + `/release`
65
- > - 发现重复模式或规范摩擦 → 执行 `/audit --report` 回报
121
+ > - 执行 `git push` 推送到远端 ⭐ **推荐** — 推送到远端
122
+ > - 准备发布时 → 执行 `/changelog` + `/release` — 准备发布时执行
123
+ > - 发现重复模式或规范摩擦 → 执行 `/audit --report` 回报 — 检测到模式或摩擦时回报反馈
66
124
 
67
125
  ## 参考
68
126
 
69
127
  - 详细指南:[guide.md](./guide.md)
70
128
  - 核心规范:[commit-message-guide.md](../../../../core/commit-message-guide.md)
129
+
130
+ ## AI 代理行为
131
+
132
+ > 完整的 AI 行为定义请参阅对应的命令文件:[`/commit`](../commands/commit.md#ai-agent-behavior--ai-代理行为)
@@ -1,20 +1,57 @@
1
1
  ---
2
2
  source: ../../../../skills/contract-test-assistant/SKILL.md
3
3
  source_version: 1.0.0
4
+ source_hash: f67623eb913a
4
5
  translation_version: 1.0.0
5
- last_synced: 2026-03-26
6
+ last_synced: 2026-06-01
6
7
  status: current
7
8
  description: |
8
- 引导 API 和微服务的合约测试策略。
9
- 使用时机:API 合约、微服务、消费者驱动测试。
10
- 关键字:contract test, Pact, OpenAPI, 合约测试。
9
+ [UDS] 引导 API 和微服务的契约测试策略。
10
+ 使用时机:API 契约、微服务、消费者驱动测试。
11
+ 关键字:contract test, Pact, OpenAPI, 契约测试。
11
12
  ---
12
13
 
13
- # 合约测试助手
14
+ # 契约测试助手
14
15
 
15
16
  > **语言**: [English](../../../../skills/contract-test-assistant/SKILL.md) | 简体中文
16
17
 
17
- 引导 API 和微服务的合约测试策略选择、设置和验证。
18
+ 引导 API 和微服务的契约测试策略选择、设置和验证。
19
+
20
+ ## 什么是契约测试?
21
+
22
+ 契约测试通过测试消费者和提供者之间的协议(契约)来验证服务间的通信正确性,不需要所有服务同时运行。
23
+
24
+ ## 策略选择
25
+
26
+ | 策略 | 适用场景 | 工具 |
27
+ |------|---------|------|
28
+ | **消费者驱动(Consumer-Driven)** | 内部微服务,团队同时拥有两端 | Pact |
29
+ | **提供者驱动(Provider-Driven)** | 公开 API,OpenAPI 优先设计 | OpenAPI + Prism |
30
+ | **双向(Bi-Directional)** | 混合所有权,渐进采用 | Pact + OpenAPI |
31
+
32
+ ## 工作流程
33
+
34
+ ```
35
+ ASSESS ──► CHOOSE ──► DEFINE ──► IMPLEMENT ──► VERIFY
36
+ 评估架构 选择策略 定义契约 实现测试 验证契约
37
+ ```
38
+
39
+ ### 1. ASSESS — 评估架构
40
+ - 有多少服务互相通信?
41
+ - 谁拥有消费者端、谁拥有提供者端?
42
+
43
+ ### 2. CHOOSE — 选择策略
44
+ - 消费者驱动(Pact)vs 提供者驱动(OpenAPI)
45
+
46
+ ### 3. DEFINE — 定义契约
47
+ - 编写消费者期望或 OpenAPI 规格
48
+
49
+ ### 4. IMPLEMENT — 实现测试
50
+ - 消费者测试生成契约
51
+ - 提供者测试验证契约
52
+
53
+ ### 5. VERIFY — 执行验证
54
+ - CI 流水线在每个 PR 上验证契约
18
55
 
19
56
  ## 指令
20
57
 
@@ -23,33 +60,55 @@ description: |
23
60
  | `/contract-test` | 交互式策略选择 |
24
61
  | `/contract-test consumer` | 引导消费者测试设置 |
25
62
  | `/contract-test provider` | 引导提供者测试设置 |
26
- | `/contract-test verify` | 检查合约覆盖率 |
63
+ | `/contract-test verify` | 检查契约覆盖率 |
27
64
 
28
- ## 参考
65
+ ## 契约覆盖率报告
66
+
67
+ ```markdown
68
+ ## 契约覆盖率报告
69
+
70
+ | 消费者 | 提供者 | 端点 | 状态 |
71
+ |--------|--------|------|------|
72
+ | web-app | user-api | GET /users/:id | ✅ 已验证 |
73
+ | web-app | user-api | POST /users | ✅ 已验证 |
74
+ | mobile-app | auth-api | POST /login | ⚠️ 仅消费者端 |
75
+ | admin-ui | report-api | GET /reports | ❌ 无契约 |
29
76
 
30
- - 详细指南:[contract-testing.md](../../../../options/testing/contract-testing.md)
31
- - 技能指南:[guide.md](./guide.md)
77
+ **覆盖率**:50%(2/4 个端点两端均验证)
78
+ ```
32
79
 
80
+ ## 与其他技能的集成
33
81
 
34
- ## Next Steps Guidance | 下一步引導
82
+ | 技能 | 集成方式 |
83
+ |------|---------|
84
+ | `/api-design` | 设计时定义 API 契约 |
85
+ | `/ci-cd` | 流水线中加入契约验证 |
86
+ | `/testing` | 契约测试作为测试策略一部分 |
87
+ | `/migrate` | API 迁移时捕获 legacy response fixture,验证新实现保持结构性等价 |
35
88
 
36
- After `/contract-test` completes:
89
+ ### 迁移契约测试(替换实现时)
37
90
 
38
- > **合約測試引導完成。建議下一步:**
39
- > - 執行 `/ci-cd` 將合約驗證加入 CI 管線
40
- > - 執行 `/api-design` 完善 API 設計
41
- > - 執行 `/testing` 整合到整體測試策略
91
+ API endpoint 从一个技术栈迁移至另一个(PHP → .NET、Express → Spring 等),对 **legacy 参考 fixture** 的 contract test 可捕捉「缺失字段」「rename」「层级漂移」等新 DTO 单元测试无法覆盖的缺陷。详见 [migration-assistant § API Migration Contract Tests](../migration-assistant/SKILL.md#api-migration-contract-tests--api-遷移合約測試) 获取 fixture 捕获协议与审计检查清单。
42
92
 
43
- ## Reference | 參考
93
+ ## 下一步引导
94
+
95
+ `/contract-test` 完成后:
96
+
97
+ > **契约测试引导完成。建议下一步:**
98
+ > - 执行 `/ci-cd` 将契约验证加入 CI 流水线
99
+ > - 执行 `/api-design` 完善 API 设计
100
+ > - 执行 `/testing` 集成到整体测试策略
101
+
102
+ ## 参考
44
103
 
45
- - Detailed guide: [contract-testing.md](../../options/testing/contract-testing.md)
46
- - Related: [api-design-assistant](../api-design-assistant/SKILL.md)
104
+ - 详细指南:[contract-testing.md](../../options/testing/contract-testing.md)
105
+ - 相关:[api-design-assistant](../api-design-assistant/SKILL.md)
47
106
 
48
- ## AI Agent Behavior | AI 代理行為
107
+ ## AI 代理行为
49
108
 
50
- When `/contract-test` is invoked:
51
- 1. **Assess**Ask about architecture (monolith, microservices, number of APIs)
52
- 2. **Recommend**Suggest strategy based on architecture
53
- 3. **Guide**Walk through setup for chosen strategy
54
- 4. **Generate**Create example contract test files
55
- 5. **Verify**If `verify` subcommand, scan for contracts and report coverage
109
+ `/contract-test` 被调用时:
110
+ 1. **评估(Assess)**询问架构(单体、微服务、API 数量)
111
+ 2. **推荐(Recommend)**依架构建议策略
112
+ 3. **引导(Guide)**逐步引导所选策略的设置
113
+ 4. **生成(Generate)**创建示例契约测试文件
114
+ 5. **验证(Verify)**若为 `verify` 子指令,扫描契约并报告覆盖率
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: deploy
3
+ source: ../../../../skills/deploy-assistant/SKILL.md
4
+ source_version: 1.0.0
5
+ translation_version: 1.0.0
6
+ last_synced: 2026-06-02
7
+ source_hash: ff56e7be5b67
8
+ status: current
9
+ scope: universal
10
+ description: |
11
+ [UDS] 无 CI/CD 平台环境下的可靠部署指引(不依赖 GitHub Actions / GitLab CI)。
12
+ Use when: deploying to VPS, air-gapped servers, or environments without CI/CD infrastructure.
13
+ Keywords: deployment, no-cicd, shell script, blue-green, smoke test, rollback, 无CI/CD, 部署.
14
+ allowed-tools: Read, Bash(cat VERSION:*), Bash(git describe:*), Bash(which nginx:*), Bash(which rsync:*)
15
+ argument-hint: "[项目类型: node/python/docker/go]"
16
+ ---
17
+
18
+ # 无 CI/CD 部署助手
19
+
20
+ > **语言**: [English](../../../../skills/deploy-assistant/SKILL.md) | 简体中文
21
+
22
+ 引导无 CI/CD 平台环境下的可靠部署,采用三层架构:防错、验证、快速恢复。
23
+
24
+ ## 三层部署架构
25
+
26
+ ```
27
+ Layer 1:防止错误部署 Layer 2:验证正确性 Layer 3:快速恢复
28
+ set -euo pipefail Smoke Test + /health Blue-Green 切换
29
+ 版本 tag 强制 版本号比对 rollback.sh < 30s
30
+ deploy.lock 并发守卫 验证失败自动回滚
31
+ ```
32
+
33
+ ## 引导式问答
34
+
35
+ | 问题 | 选项 | 影响 |
36
+ |------|------|------|
37
+ | 项目类型 | node / python / go / docker | 构建命令 |
38
+ | 部署目标 | SSH+rsync / Docker Compose | 传输方式 |
39
+ | Blue-Green 支持 | yes / no | rollback.sh 是否生成 |
40
+ | 健康检查 URL | URL 输入 | verify.sh 目标 |
41
+ | 版本来源 | VERSION 文件 / package.json / git tag | 版本比对逻辑 |
42
+
43
+ ## 生成的脚本组
44
+
45
+ ### deploy.sh — 主要部署脚本
46
+
47
+ ```bash
48
+ #!/usr/bin/env bash
49
+ set -euo pipefail
50
+
51
+ LOCK_FILE="/tmp/deploy.lock"
52
+ trap "rm -f $LOCK_FILE" EXIT
53
+
54
+ # 防并发守卫
55
+ if [ -f "$LOCK_FILE" ]; then
56
+ echo "❌ 已有部署进行中(PID: $(cat $LOCK_FILE))"
57
+ exit 1
58
+ fi
59
+ echo $$ > "$LOCK_FILE"
60
+
61
+ # 版本 tag 强制
62
+ CURRENT_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || echo "")
63
+ if [ -z "$CURRENT_TAG" ]; then
64
+ echo "❌ HEAD 没有版本 tag。请执行:git tag vX.Y.Z && git push --tags"
65
+ exit 1
66
+ fi
67
+
68
+ echo "[1/4] 执行测试..."
69
+ # {TEST_COMMAND}
70
+
71
+ echo "[2/4] 构建产物..."
72
+ # {BUILD_COMMAND}
73
+
74
+ echo "[3/4] 同步至服务器..."
75
+ rsync -avz --delete ./dist/ {USER}@{SERVER}:/app/
76
+
77
+ echo "[4/4] 验证部署..."
78
+ ./verify.sh || { echo "验证失败,启动回滚..."; ./rollback.sh; exit 1; }
79
+
80
+ echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"version\":\"$CURRENT_TAG\",\"operator\":\"$(whoami)\",\"result\":\"success\"}" >> /var/log/deployments.jsonl
81
+ echo "✅ 部署成功:$CURRENT_TAG"
82
+ ```
83
+
84
+ ### verify.sh — Smoke Test
85
+
86
+ ```bash
87
+ #!/usr/bin/env bash
88
+ set -euo pipefail
89
+
90
+ HEALTH_URL="${HEALTH_URL:-{HEALTH_URL}}"
91
+ EXPECTED_VERSION=$(cat VERSION)
92
+
93
+ for i in $(seq 1 3); do
94
+ RESPONSE=$(curl -sf --max-time 10 "$HEALTH_URL" 2>/dev/null) && break
95
+ echo "健康检查第 $i/3 次失败,5 秒后重试..."
96
+ sleep 5
97
+ done
98
+
99
+ ACTUAL_VERSION=$(echo "$RESPONSE" | python3 -c "import json,sys; print(json.load(sys.stdin)['version'])")
100
+
101
+ if [ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]; then
102
+ echo "❌ 版本不符!预期 $EXPECTED_VERSION,实际 $ACTUAL_VERSION"
103
+ exit 1
104
+ fi
105
+
106
+ echo "✅ 版本验证通过:$ACTUAL_VERSION"
107
+ ```
108
+
109
+ ### rollback.sh — Blue-Green 回滚
110
+
111
+ ```bash
112
+ #!/usr/bin/env bash
113
+ set -euo pipefail
114
+
115
+ CURRENT=$(readlink /app/current 2>/dev/null || echo "/app/blue")
116
+ TARGET=$([[ "$CURRENT" == *"green"* ]] && echo "/app/blue" || echo "/app/green")
117
+
118
+ ln -sfn "$TARGET" /app/current
119
+ nginx -s reload
120
+
121
+ echo "✅ 已回滚至 $TARGET ($(date -u +%Y-%m-%dT%H:%M:%SZ))"
122
+ echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"event\":\"rollback\",\"from\":\"$CURRENT\",\"to\":\"$TARGET\",\"operator\":\"$(whoami)\"}" >> /var/log/deployments.jsonl
123
+ ```
124
+
125
+ ### Makefile
126
+
127
+ ```makefile
128
+ .PHONY: deploy rollback verify status
129
+
130
+ deploy:
131
+ @./deploy.sh
132
+
133
+ rollback:
134
+ @./rollback.sh
135
+
136
+ verify:
137
+ @./verify.sh
138
+
139
+ status:
140
+ @echo "当前 slot:$$(readlink /app/current 2>/dev/null || echo 'N/A')"
141
+ @curl -s $${HEALTH_URL:-http://localhost/health} | python3 -m json.tool 2>/dev/null || echo "健康检查失败"
142
+ ```
143
+
144
+ ## 输出确认清单
145
+
146
+ 脚本生成后,AI 助手必须确认:
147
+
148
+ - [ ] `deploy.sh` 含 `set -euo pipefail`
149
+ - [ ] `deploy.sh` 含 deploy.lock 并发守卫
150
+ - [ ] `verify.sh` 比对版本号(不只是 HTTP 200)
151
+ - [ ] `rollback.sh` 在 verify 失败时自动触发
152
+ - [ ] `Makefile` 提供 `make deploy / make rollback / make status`
153
+
154
+ ## 使用方式
155
+
156
+ ```bash
157
+ /deploy # 交互模式 — 自动检测项目类型
158
+ /deploy node # Node.js 项目,直接生成
159
+ /deploy docker # Docker Compose 部署模式
160
+ /deploy --verify-only # 仅生成 verify.sh
161
+ ```
162
+
163
+ ## 下一步引导
164
+
165
+ `/deploy` 完成后,AI 助手应建议:
166
+
167
+ > **部署脚本已生成,建议下一步:**
168
+ > - `chmod +x deploy.sh verify.sh rollback.sh` — 设置执行权限
169
+ > - `make verify` — 测试健康检查配置
170
+ > - `git tag v1.0.0 && git push --tags` — 创建版本 tag
171
+ > - `make deploy` — 执行第一次部署
172
+
173
+ ## 参考
174
+
175
+ - 核心标准:[no-cicd-deployment.md](../../../../core/no-cicd-deployment.md)
176
+ - 核心标准:[deployment-standards.md](../../../../core/deployment-standards.md)
177
+ - 核心标准:[deployment-standards.md § Defensive Deployment Ordering](../../../../core/deployment-standards.md#defensive-deployment-ordering) — **强制**遵循 extract-verify-then-delete 顺序
178
+ - 核心标准:[packaging-standards.md § Archive Format Integrity](../../../../core/packaging-standards.md#archive-format-integrity) — 消费 archive 前先验证格式
179
+ - 相关:[ci-cd-assistant](../ci-cd-assistant/SKILL.md) — 适用于有 CI/CD 的环境
180
+
181
+ ## 版本历史
182
+
183
+ | 版本 | 日期 | 变更说明 |
184
+ |------|------|----------|
185
+ | 1.0.0 | 2026-04-26 | 初始版本 — XSPEC-085 Phase 1b |
186
+
187
+ ## 授权
188
+
189
+ CC BY 4.0 — 文档内容