universal-dev-standards 5.15.1 → 5.16.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 (80) 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/locales/zh-CN/CHANGELOG.md +13 -3
  8. package/bundled/locales/zh-CN/README.md +1 -1
  9. package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
  10. package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
  11. package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
  12. package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
  13. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
  14. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
  15. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
  16. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
  17. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
  18. package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
  19. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
  20. package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
  21. package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
  22. package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
  23. package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
  24. package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
  25. package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
  26. package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
  27. package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
  28. package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
  29. package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
  30. package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
  31. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
  32. package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
  33. package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
  34. package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
  35. package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
  36. package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
  37. package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
  38. package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
  39. package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
  40. package/bundled/locales/zh-TW/CHANGELOG.md +13 -3
  41. package/bundled/locales/zh-TW/README.md +1 -1
  42. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
  43. package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
  44. package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
  45. package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
  46. package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
  47. package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +2 -2
  48. package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
  49. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
  50. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
  51. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
  52. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
  53. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
  54. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
  55. package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
  56. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
  57. package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +5 -5
  58. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
  59. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
  60. package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
  61. package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +3 -2
  62. package/bundled/locales/zh-TW/skills/plan/SKILL.md +3 -2
  63. package/bundled/locales/zh-TW/skills/push/SKILL.md +3 -2
  64. package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
  65. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
  66. package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
  67. package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
  68. package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
  69. package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
  70. package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
  71. package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
  72. package/bundled/skills/brainstorm-assistant/guide.md +256 -661
  73. package/bundled/skills/commands/brainstorm.md +51 -30
  74. package/bundled/skills/knowledge-graph/SKILL.md +5 -5
  75. package/bundled/skills/knowledge-graph/guide.md +4 -4
  76. package/package.json +2 -2
  77. package/src/commands/check.js +11 -2
  78. package/src/lint/i18n.js +109 -23
  79. package/standards-registry.json +4 -4
  80. package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
@@ -0,0 +1,188 @@
1
+ ---
2
+ source: ../../../../skills/observability-assistant/guide.md
3
+ source_version: 1.0.0
4
+ translation_version: 1.0.0
5
+ last_synced: 2026-06-02
6
+ source_hash: 760e3ec43846
7
+ status: current
8
+ scope: universal
9
+ description: |
10
+ 指导跨三大支柱(Logs、Metrics、Traces)实施可观测性。
11
+ 使用场景:搭建监控、选择指标类型、实施追踪、评估成熟度。
12
+ 关键词:observability、metrics、traces、logs、golden signals、OpenTelemetry、可观测性、监控。
13
+ ---
14
+
15
+ # Observability Assistant
16
+
17
+ > **语言**:English | [繁体中文](../../locales/zh-TW/skills/observability-assistant/SKILL.md)
18
+
19
+ **版本**:1.0.0
20
+ **最后更新**:2026-04-01
21
+ **适用范围**:Claude Code Skills
22
+
23
+ ---
24
+
25
+ ## 目的
26
+
27
+ 本技能通过提供三大支柱(Logs、Metrics、Traces)、指标类型选择、Golden Signals 监控以及成熟度自评等方面的指导,帮助团队构建可观测的系统。
28
+
29
+ ---
30
+
31
+ ## 快速参考(YAML 压缩版)
32
+
33
+ ```yaml
34
+ # === THREE PILLARS 三大支柱 ===
35
+ three_pillars:
36
+ logs:
37
+ captures: "Discrete events with context / 帶上下文的離散事件"
38
+ use_for: "Debugging, audit trails, error details"
39
+ granularity: "High (per-event)"
40
+ metrics:
41
+ captures: "Numerical measurements over time / 隨時間變化的數值量測"
42
+ use_for: "Dashboards, alerting, capacity planning"
43
+ granularity: "Low (aggregated)"
44
+ traces:
45
+ captures: "Request flow across services / 跨服務的請求流"
46
+ use_for: "Latency analysis, dependency mapping"
47
+ granularity: "Medium (per-request)"
48
+
49
+ correlation:
50
+ metric_to_trace: "Use Exemplars to link anomalous metric → specific trace"
51
+ trace_to_logs: "Use trace_id + span_id embedded in logs"
52
+ logs_to_metric: "Aggregate log patterns into metrics (e.g., error rate)"
53
+ key_fields: ["trace_id", "service.name"]
54
+
55
+ # === METRIC TYPES 指標類型 ===
56
+ metric_types:
57
+ counter:
58
+ behavior: "Monotonically increasing (resets on restart) / 只增不減"
59
+ examples: ["request count", "error count", "bytes sent"]
60
+ gauge:
61
+ behavior: "Point-in-time value, can go up or down / 當前值,可升可降"
62
+ examples: ["temperature", "queue depth", "active connections"]
63
+ histogram:
64
+ behavior: "Distribution across buckets / 跨桶分布"
65
+ examples: ["request duration", "response size"]
66
+ summary:
67
+ behavior: "Client-computed percentiles / 客戶端計算百分位"
68
+ examples: ["legacy systems needing client-side quantiles"]
69
+
70
+ metric_type_decision:
71
+ only_goes_up: "→ Counter"
72
+ need_distribution: "→ Histogram"
73
+ current_state_value: "→ Gauge"
74
+ legacy_client_percentiles: "→ Summary"
75
+
76
+ naming: "<domain>.<entity>.<action>.<unit>"
77
+ # e.g., http.server.request.duration.seconds
78
+
79
+ # === GOLDEN SIGNALS 黃金信號 ===
80
+ golden_signals:
81
+ latency:
82
+ what: "Request duration P50/P95/P99 / 請求延遲"
83
+ metric: "http.server.request.duration.seconds"
84
+ alert: "P99 > threshold sustained 5 min"
85
+ traffic:
86
+ what: "Requests per second (RPS) / 每秒請求數"
87
+ metric: "http.server.request.total (Counter, rate)"
88
+ alert: "Sudden drop >50% or spike >200%"
89
+ errors:
90
+ what: "Error rate = 5xx / total / 錯誤率"
91
+ metric: "http.server.request.total{status=~'5..'}"
92
+ alert: "Error rate > X% sustained 5 min"
93
+ saturation:
94
+ what: "Resource utilization / 資源飽和度"
95
+ metrics: ["system.cpu.utilization", "system.memory.utilization", "db.client.connection.pool.usage"]
96
+ alert: "Resource > 80% sustained 10 min"
97
+
98
+ # === MATURITY MODEL 成熟度模型 ===
99
+ maturity:
100
+ L0_no_observability:
101
+ characteristics: "No structured logs; debugging via SSH + tail -f / 無結構化日誌"
102
+ upgrade: "Implement structured logging; centralize collection"
103
+ L1_basic_logging:
104
+ characteristics: "Structured JSON logs; centralized; basic search / 結構化日誌+集中收集"
105
+ upgrade: "Add business metrics; create first dashboard"
106
+ L2_metrics_driven:
107
+ characteristics: "Logs + Metrics; dashboards; basic alerting / 日誌+指標+儀表板"
108
+ upgrade: "Enable distributed tracing; SLO-based alerting"
109
+ L3_full_observability:
110
+ characteristics: "All three pillars; correlation; SLO alerts; Golden Signals / 三支柱完整"
111
+ upgrade: "Add anomaly detection; auto-remediation"
112
+ L4_intelligent:
113
+ characteristics: "AIOps; predictive alerting; automatic remediation / 智慧化可觀測"
114
+ upgrade: "Maintain, optimize, share learnings"
115
+
116
+ self_assessment:
117
+ - "Can you find logs for a specific request across all services? (L1+)"
118
+ - "Can you view dashboards showing error rate and latency? (L2+)"
119
+ - "Can you trace a request from ingress to database and back? (L3+)"
120
+ - "Does your system auto-detect anomalies before users report? (L4)"
121
+
122
+ # === INSTRUMENTATION CHECKLIST 儀器化清單 ===
123
+ pre_production_checklist:
124
+ - "Structured logging enabled (JSON + trace_id)"
125
+ - "HTTP/gRPC entry metrics (count, duration histogram, error rate)"
126
+ - "Critical business operation custom metrics"
127
+ - "Distributed tracing enabled (sampling rate set, W3C headers)"
128
+ - "Health check endpoints (liveness + readiness)"
129
+ - "Dashboard covering Golden Signals"
130
+ - "Alert rules defined (SLO burn rate)"
131
+ - "Log retention configured"
132
+ - "Sensitive data excluded from logs/traces"
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 与相关技能整合 / Integration with Related Skills
138
+
139
+ | 技能 | 整合点 | 说明 |
140
+ |-------|-------------------|-------------|
141
+ | `/slo` | 基于 SLO 的告警 | 将 metrics 作为 SLI 数据源;burn rate 告警引用 Golden Signals |
142
+ | `/incident` | 事件诊断 | 三大支柱提供诊断数据;关联分析加快 MTTD/MTTR |
143
+ | `/observability --alerting` | 告警设计 | Golden Signals 为告警规则创建提供依据 |
144
+
145
+ ---
146
+
147
+ ## 配置检测
148
+
149
+ ### 检测顺序
150
+
151
+ 1. 检查 `CONTRIBUTING.md` 中是否有 "Disabled Skills" 区块
152
+ 2. 检查 `CONTRIBUTING.md` 中是否有 "Observability Standards" 区块
153
+ 3. 若未找到,**默认采用标准的可观测性实践**
154
+
155
+ ---
156
+
157
+ ## 详细指引
158
+
159
+ 完整标准请参阅:
160
+ - [Observability Standards](../../core/observability-standards.md)
161
+ - [Logging Standards](../../core/logging-standards.md)
162
+
163
+ ---
164
+
165
+ ## 相关标准
166
+
167
+ - [Observability Standards](../../core/observability-standards.md) - 核心标准
168
+ - [SLO Standards](../../core/slo-standards.md) - SLI/SLO/错误预算
169
+ - [Alerting Standards](../../core/alerting-standards.md) - 告警设计
170
+ - [Performance Standards](../../core/performance-standards.md) - 性能目标
171
+ - [SLO Assistant](../slo-assistant/SKILL.md) - SLO 工作流程
172
+ - [Runbook Assistant](../runbook-assistant/SKILL.md) - 运维操作流程
173
+
174
+ ---
175
+
176
+ ## 版本历史
177
+
178
+ | 版本 | 日期 | 变更 |
179
+ |---------|------|---------|
180
+ | 1.0.0 | 2026-04-01 | 首次发布 |
181
+
182
+ ---
183
+
184
+ ## 许可证
185
+
186
+ 本技能依据 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 发布。
187
+
188
+ **来源**:[universal-dev-standards](https://github.com/AsiaOstrich/universal-dev-standards)
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: orchestrate
3
+ source: ../../../../skills/orchestrate/SKILL.md
4
+ source_version: 2.0.0
5
+ translation_version: 2.0.0
6
+ last_synced: 2026-06-02
7
+ source_hash: 40e97479c7da
8
+ scope: universal
9
+ description: |
10
+ [UDS] 以 Claude 原生 Agent tool 编排多任务执行计划(DAG-based,无外部引擎)。
11
+ Use when: executing a plan.json file with parallel/sequential task dependencies.
12
+ Keywords: orchestrate, plan, execute, DAG, task plan, 编排, 执行计划, 并行.
13
+ argument-hint: "<plan.json> [--dry-run]"
14
+ ---
15
+
16
+ # /orchestrate — 任务计划编排 Skill
17
+
18
+ > **语言**: [English](../../../../skills/orchestrate/SKILL.md) | 简体中文
19
+
20
+ ## 用法
21
+
22
+ ```
23
+ /orchestrate <plan.json> # 执行计划
24
+ /orchestrate <plan.json> --dry-run # 仅验证,不执行
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 执行流程
30
+
31
+ ### Step 1:读取与解析计划(Claude-native)
32
+
33
+ 使用 Read tool 读取 plan.json,直接由 Claude 解析:
34
+
35
+ 1. 读取 JSON 文件,解析为任务清单
36
+ 2. 验证结构:`tasks` 非空、每个 task 含 `id`、`title`、`spec`
37
+ 3. 安全扫描:检查 `task.spec` 是否含危险指令(`rm -rf /`、`DROP DATABASE`、`git push --force`)
38
+ - 若发现安全问题,列出所有问题并**询问用户是否继续**
39
+ 4. 拓扑排序:依 `depends_on` 字段将 tasks 分组为执行层(layers)
40
+ - Layer 0:没有依赖的 tasks(可并行)
41
+ - Layer N:依赖全部在 Layer 0..N-1 中的 tasks
42
+
43
+ 若 `validation.valid` 为 false,输出错误信息并停止。
44
+
45
+ ---
46
+
47
+ ### Step 2:呈现执行计划
48
+
49
+ 向用户显示解析结果:
50
+
51
+ ```
52
+ 计划:<project> 品质:<quality>
53
+ ──────────────────────────────────
54
+ Layer 0 (并行):T-001, T-002
55
+ Layer 1 (序列):T-003 (依赖 T-001)
56
+ Layer 2 (序列):T-004 (依赖 T-002, T-003)
57
+ ──────────────────────────────────
58
+ 共 4 个任务,3 个执行层
59
+ ```
60
+
61
+ 若使用 `--dry-run`:显示以上摘要后**立即停止**,不启动任何 Agent。
62
+
63
+ ---
64
+
65
+ ### Step 3:逐层执行
66
+
67
+ 对 `layers` 数组中的每一层:
68
+
69
+ 1. **同层并行**:同一层的 tasks 在同一消息中启动多个 Agent tool
70
+ 2. **Agent tool 参数**:
71
+ - `prompt`:task.spec + acceptance_criteria + user_intent 组合而成的执行提示
72
+ - `isolation: "worktree"`:每个 task 在独立 git worktree 执行
73
+ - `description`:`"Task {task.id}: {task.title}"`
74
+ 3. **等待完成**:所有同层 agents 完成后,才进入下一层
75
+
76
+ **Agent 提示模板**:
77
+ ```
78
+ Task: {task.title}
79
+
80
+ Spec:
81
+ {task.spec}
82
+
83
+ Acceptance Criteria:
84
+ {task.acceptance_criteria 逐条列出}
85
+
86
+ User Intent:
87
+ {task.user_intent}
88
+
89
+ After completing the task, run: {task.verify_command}
90
+ ```
91
+
92
+ ---
93
+
94
+ ### Step 4:依赖失败处理
95
+
96
+ 如果某个 task 的 agent 回报失败:
97
+ - 标记该 task 为 `failed`
98
+ - 后续层中 `depends_on` 包含该 task ID 的所有 tasks 标记为 `skipped`
99
+ - 继续执行不受影响的 tasks
100
+ - 最终报告中标示失败原因
101
+
102
+ ---
103
+
104
+ ### Step 5:Quality Gate
105
+
106
+ 每个 task 完成后,若 task 定义了 `verify_command`:
107
+
108
+ 1. 使用 Bash tool 执行 `verify_command`
109
+ 2. **成功**:记录 `status: "success"`
110
+ 3. **失败**:
111
+ - 若 `quality` 为 `"strict"` 或 `"standard"`:启动 Fix Loop
112
+ - Fix Loop:将错误输出回传给 agent,重新执行(最多 3 次)
113
+ - 超过重试上限:标记为 `failed`
114
+
115
+ ---
116
+
117
+ ### Step 6:Judge 审查(可选)
118
+
119
+ 如果 task 定义了 `judge: true`:
120
+ - 启动一个额外的 Agent tool 进行审查
121
+ - 提示:`审查 task {id} 的 git diff,依照 code-review 标准检查`
122
+ - Judge 结果附加到最终报告
123
+
124
+ ---
125
+
126
+ ### Step 7:产出报告
127
+
128
+ 汇整所有 task 结果,输出执行报告:
129
+
130
+ ```json
131
+ {
132
+ "summary": {
133
+ "total_tasks": 4,
134
+ "succeeded": 3,
135
+ "failed": 1,
136
+ "skipped": 0,
137
+ "total_duration_ms": 120000
138
+ },
139
+ "tasks": [
140
+ { "task_id": "T-001", "status": "success", "duration_ms": 30000 },
141
+ { "task_id": "T-002", "status": "failed", "error": "..." },
142
+ { "task_id": "T-003", "status": "skipped", "reason": "依赖任务失败" }
143
+ ]
144
+ }
145
+ ```
146
+
147
+ ---
148
+
149
+ ## 品质配置档
150
+
151
+ | Profile | 行为 |
152
+ |---------|------|
153
+ | `strict` | 全部检查 + Fix Loop 最多 5 次 |
154
+ | `standard` | lint + test + Fix Loop 最多 3 次(默认) |
155
+ | `minimal` | 仅跑 verify_command,不 Fix Loop |
156
+ | `none` | 不执行任何验证 |
157
+
158
+ ---
159
+
160
+ ## 重要注意事项
161
+
162
+ - 每个 Agent tool 的 `isolation: "worktree"` 会自动创建 git worktree
163
+ - `depends_on: []` 的 tasks 在同一层内全部并行
164
+ - 使用简体中文回复用户
165
+
166
+ ---
167
+
168
+ ## 版本历程
169
+
170
+ | 版本 | 日期 | 变更 |
171
+ |------|------|------|
172
+ | 2.0.0 | 2026-04-28 | 升格为 UDS 正式 Skill;Step 1 改为 Claude-native 解析(移除 plan-resolver-cli.js 依赖);新增 Quality Gate / Fix Loop 章节(XSPEC-097 Phase 3) |
173
+ | 1.0.0 | 2026-04-09 | 初始发布(从上游迁移) |
@@ -0,0 +1,240 @@
1
+ ---
2
+ name: plan
3
+ source: ../../../../skills/plan/SKILL.md
4
+ source_version: 2.0.0
5
+ translation_version: 2.0.0
6
+ last_synced: 2026-06-02
7
+ source_hash: 6fbb1a1b8040
8
+ scope: universal
9
+ description: |
10
+ [UDS] 从 Spec 文档、OpenSpec 变更或自由文本需求生成 plan.json。
11
+ Use when: converting specifications into executable task plans for /orchestrate.
12
+ Keywords: plan, spec, task plan, 计划, 规格, 任务, plan.json, DAG.
13
+ argument-hint: "[spec-file.md | openspec-dir/ | \"需求描述文本\" | (交互模式)]"
14
+ ---
15
+
16
+ # /plan — 从 Spec 自动生成 plan.json
17
+
18
+ > **语言**: [English](../../../../skills/plan/SKILL.md) | 简体中文
19
+
20
+ ## 用法
21
+
22
+ ```
23
+ /plan <spec-file.md> # Spec 模式(自有格式 / SpecKit)
24
+ /plan <openspec-change-dir/> # OpenSpec 模式
25
+ /plan "需求描述文本" # 需求模式
26
+ /plan # 交互模式(自动检测)
27
+ ```
28
+
29
+ ---
30
+
31
+ ## 执行流程
32
+
33
+ ### Step 1:输入识别与格式检测
34
+
35
+ 根据参数类型判断使用模式:
36
+
37
+ **参数是 .md 文件:**
38
+ 1. 读取文件内容
39
+ 2. 检测格式:
40
+ - 含 `## Requirements` **且** `## Technical Design` → **自有格式**(SPEC-NNN-*.md)
41
+ - 含 `## Summary` **且** `## Detailed Design` → **SpecKit 格式**
42
+ - 其他 .md → 尝试解析为通用 Spec(按自有格式处理,缺少的字段由 AI 补充)
43
+
44
+ **参数是目录:**
45
+ 1. 检查是否含 `proposal.md` + `tasks.md` → **OpenSpec 格式**
46
+ 2. 否则报错:「此目录不符合 OpenSpec 结构」
47
+
48
+ **参数是字符串描述(非文件路径):**
49
+ → **需求模式**
50
+
51
+ **无参数:**
52
+ → **交互模式**
53
+ 1. 检测 `openspec/` 目录存在? → 列出 changes 让用户选择
54
+ 2. 检测 `specs/*.md` 存在? → 列出可用 Spec 让用户选择
55
+ 3. 都没有 → 进入需求模式问答
56
+
57
+ ---
58
+
59
+ ### Step 2:项目 Context 收集
60
+
61
+ 读取目标项目的关键信息:
62
+
63
+ 1. **CLAUDE.md / AGENTS.md** — 语言、框架、测试工具、开发规范
64
+ 2. **package.json / pyproject.toml** — 可用 scripts(build, test, lint)
65
+
66
+ 从 Context 推断:
67
+ - 主要语言(TypeScript / Python / 其他)
68
+ - 默认 verify_command(如 `pnpm build && pnpm test`、`pytest -x`)
69
+ - 默认 lint_command(如 `pnpm lint`、`ruff check .`)
70
+
71
+ ---
72
+
73
+ ### Step 3:Spec 解析
74
+
75
+ 依检测到的格式,解析 Spec 内容:
76
+
77
+ #### 自有格式(SPEC-NNN-*.md)
78
+
79
+ 提取以下区段:
80
+ - **Summary / Motivation** → 理解背景与需求动机
81
+ - **Requirements (REQ-NNN)** → 功能需求列表
82
+ - **Acceptance Criteria (AC-N)** → Given/When/Then 验收条件
83
+ - **Technical Design** → Phase 分层、每个 Phase 的实现项目
84
+ - **Test Plan** → 测试清单
85
+ - **Risks** → 风险评估
86
+
87
+ #### OpenSpec(change 目录)
88
+
89
+ 读取以下文件:
90
+ - `proposal.md` → Why(动机)、What Changes(变更项目)、Impact
91
+ - `tasks.md` → `- [ ]` checklist 项目
92
+ - `design.md`(若存在)→ 技术决策
93
+ - `specs/*/spec.md`(若存在)→ Requirements(SHALL / MUST 语句)、Scenarios
94
+
95
+ #### SpecKit(SPEC-ID.md)
96
+
97
+ 提取以下区段:
98
+ - **Summary / Motivation** → 背景
99
+ - **Detailed Design** → 技术实现步骤
100
+ - **Acceptance Criteria** → checkbox 验收条件
101
+ - **Dependencies** → 外部依赖
102
+ - **Risks** → 风险
103
+
104
+ ---
105
+
106
+ ### Step 4:Task 切分
107
+
108
+ 依格式套用不同映射规则:
109
+
110
+ #### 自有格式映射规则
111
+
112
+ | Spec 区段 | plan.json 字段 | 映射规则 |
113
+ |-----------|---------------|----------|
114
+ | Technical Design > Phase | 一组 tasks | 每个 Phase 的每个实现项目 = 1 个 task |
115
+ | Phase 实现项目描述 | `task.spec` | 合并:项目描述 + 相关 REQ + 技术细节 |
116
+ | Acceptance Criteria (AC-N) | `task.acceptance_criteria` | 分配到最相关的 task |
117
+ | Summary / Motivation | `task.user_intent` | 提取与 task 最相关的意图 |
118
+ | Test Plan | `task.verify_command` | 推断测试命令 |
119
+
120
+ #### OpenSpec 映射规则
121
+
122
+ | OpenSpec 文件 | plan.json 字段 | 映射规则 |
123
+ |--------------|---------------|----------|
124
+ | `tasks.md` 的 checklist 项目 | tasks | 每个 `- [ ]` 项目 = 1 个 task |
125
+ | `proposal.md` > Why | `task.user_intent` | 所有 tasks 共用 |
126
+ | `proposal.md` > What Changes | 融入 `task.spec` | 提供变更上下文 |
127
+ | `design.md` 技术细节 | 融入 `task.spec` | 补充实现指引 |
128
+ | `specs/*/spec.md` > Scenarios | `task.acceptance_criteria` | 每个 Scenario 映射为一条 criteria |
129
+ | `specs/*/spec.md` > Requirements | 融入 `task.spec` | SHALL / MUST 语句转为具体实现指引 |
130
+
131
+ ---
132
+
133
+ ### Step 5:依赖推断
134
+
135
+ 为 tasks 建立 `depends_on` 关系:
136
+
137
+ 1. **Phase / Stage 顺序**:后面的 Phase 的第一个 task depends_on 前面 Phase 的最后一个 task
138
+ 2. **同 Phase 内顺序**:类型定义 → 实现 → 集成 → 测试
139
+ 3. **文件依赖**:A 创建的文件被 B import → B depends_on A
140
+ 4. **无依赖的 tasks**:`depends_on: []`(可并行)
141
+
142
+ ---
143
+
144
+ ### Step 6:verify_command 推断
145
+
146
+ 依以下优先顺序推断:
147
+
148
+ 1. **Test Plan / Scenarios 有明确测试项** → 对应测试命令
149
+ 2. **TypeScript 项目** → `pnpm build && pnpm test`
150
+ 3. **Python 项目** → `pytest -x`
151
+ 4. **其他** → 使用 Step 2 收集的项目 scripts
152
+ 5. **无法推断** → 不设(后续质量警告会提醒)
153
+
154
+ ---
155
+
156
+ ### Step 7:质量设置
157
+
158
+ - 默认 `quality: "standard"`
159
+ - 用户可在交互确认时调整
160
+
161
+ ---
162
+
163
+ ### Step 8:组装 plan.json
164
+
165
+ ```json
166
+ {
167
+ "project": "<项目名称>",
168
+ "quality": "standard",
169
+ "defaults": {
170
+ "max_turns": 30,
171
+ "max_budget_usd": 2.0,
172
+ "verify_command": "<推断的默认验证命令>"
173
+ },
174
+ "tasks": [
175
+ {
176
+ "id": "T-001",
177
+ "title": "<task 标题>",
178
+ "spec": "<详细的 task 规格说明>",
179
+ "depends_on": [],
180
+ "verify_command": "<task 层级验证命令(可选)>",
181
+ "acceptance_criteria": ["<验收条件 1>"],
182
+ "user_intent": "<用户意图>"
183
+ }
184
+ ]
185
+ }
186
+ ```
187
+
188
+ **注意事项:**
189
+ - Task ID 格式:`T-NNN`(如 T-001, T-002)
190
+ - `spec` 字段应详尽——它是 agent 执行任务的唯一规格输入
191
+ - `acceptance_criteria` 每条都必须是可观察、可验证的
192
+
193
+ ---
194
+
195
+ ### Step 9:验证(Claude-native)
196
+
197
+ Claude 对 plan.json 执行以下验证(无需外部引擎):
198
+
199
+ 1. **结构验证**:`tasks` 数组存在且非空、每个 task 含必填字段(id, title, spec)
200
+ 2. **DAG 合法性**:`depends_on` 中的所有 ID 均存在、无循环依赖
201
+ 3. **安全扫描**:task.spec 不含危险命令(`rm -rf /`、`DROP DATABASE`、`git push --force`)
202
+ 4. **质量警告**:task 缺少 verify_command、spec 过短(< 20 字)等
203
+
204
+ 若发现问题,在呈现前先自动修正(若可修正)或标示警告。
205
+
206
+ ---
207
+
208
+ ### Step 10:呈现与确认
209
+
210
+ 向用户呈现生成结果:
211
+
212
+ 1. **摘要表格**:
213
+ ```
214
+ | Task ID | 标题 | 依赖 | 验证命令 |
215
+ |---------|------|------|----------|
216
+ | T-001 | ... | - | ... |
217
+ | T-002 | ... | T-001| ... |
218
+ ```
219
+
220
+ 2. **DAG 拓扑**:
221
+ ```
222
+ Layer 0: T-001, T-002(并行)
223
+ Layer 1: T-003(依赖 T-001)
224
+ Layer 2: T-004(依赖 T-002, T-003)
225
+ ```
226
+
227
+ 3. **质量设置**:`quality: standard`
228
+
229
+ 4. **质量警告**(若有)
230
+
231
+ 5. **询问用户**:确认或修改?确认后写入文件(默认路径:`plans/<spec-name>.plan.json`)
232
+
233
+ ---
234
+
235
+ ## 版本历程
236
+
237
+ | 版本 | 日期 | 变更 |
238
+ |------|------|------|
239
+ | 2.0.0 | 2026-04-28 | 升格为 UDS 正式 Skill;移除 [DEVAP] 标记;Step 9 改为 Claude-native 验证(XSPEC-097 Phase 3) |
240
+ | 1.0.0 | 2026-04-09 | 初始发布(从上游迁移) |