universal-dev-standards 5.14.0 → 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.
- package/bin/uds.js +2 -0
- package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
- package/bundled/ai/standards/ai-instruction-standards.ai.yaml +190 -3
- package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
- package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +83 -0
- package/bundled/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/core/ai-instruction-standards.md +136 -11
- package/bundled/core/forward-derivation-standards.md +19 -0
- package/bundled/core/knowledge-graph-memory.md +119 -0
- package/bundled/locales/COVERAGE.md +226 -0
- package/bundled/locales/zh-CN/CHANGELOG.md +42 -3
- package/bundled/locales/zh-CN/README.md +1 -1
- package/bundled/locales/zh-CN/SECURITY.md +1 -1
- package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/locales/zh-CN/core/ai-instruction-standards.md +111 -5
- package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
- package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
- package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
- package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
- package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
- package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
- package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
- package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
- package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
- package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
- package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
- package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
- package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
- package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
- package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
- package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
- package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
- package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
- package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
- package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
- package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
- package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
- package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
- package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
- package/bundled/locales/zh-TW/CHANGELOG.md +46 -3
- package/bundled/locales/zh-TW/README.md +1 -1
- package/bundled/locales/zh-TW/SECURITY.md +1 -1
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
- package/bundled/locales/zh-TW/core/ai-instruction-standards.md +130 -5
- package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
- package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
- package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
- package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
- package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +127 -0
- package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
- package/bundled/locales/zh-TW/core/self-review-protocol.md +9 -1
- package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +192 -0
- package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +5 -1
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
- package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
- package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
- package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +187 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +108 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
- package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
- package/bundled/locales/zh-TW/skills/journey-test-assistant/SKILL.md +222 -0
- package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +56 -0
- package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
- package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
- package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
- package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +173 -0
- package/bundled/locales/zh-TW/skills/plan/SKILL.md +240 -0
- package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +5 -1
- package/bundled/locales/zh-TW/skills/push/SKILL.md +242 -0
- package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
- package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
- package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
- package/bundled/locales/zh-TW/skills/skill-builder/SKILL.md +165 -0
- package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
- package/bundled/locales/zh-TW/skills/spec-derivation/SKILL.md +83 -0
- package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
- package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
- package/bundled/locales/zh-TW/skills/sweep/SKILL.md +149 -0
- package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
- package/bundled/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/skills/ai-collaboration-standards/SKILL.md +1 -1
- package/bundled/skills/ai-friendly-architecture/SKILL.md +1 -1
- package/bundled/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/skills/api-design-assistant/SKILL.md +1 -1
- package/bundled/skills/audit-assistant/SKILL.md +1 -1
- package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
- package/bundled/skills/brainstorm-assistant/guide.md +256 -661
- package/bundled/skills/ci-cd-assistant/SKILL.md +1 -1
- package/bundled/skills/commands/brainstorm.md +51 -30
- package/bundled/skills/contract-test-assistant/SKILL.md +1 -1
- package/bundled/skills/database-assistant/SKILL.md +1 -1
- package/bundled/skills/deploy-assistant/SKILL.md +1 -1
- package/bundled/skills/documentation-guide/SKILL.md +1 -1
- package/bundled/skills/error-code-guide/SKILL.md +1 -1
- package/bundled/skills/git-workflow-guide/SKILL.md +1 -1
- package/bundled/skills/incident-response-assistant/SKILL.md +1 -1
- package/bundled/skills/journey-test-assistant/SKILL.md +1 -1
- package/bundled/skills/knowledge-graph/SKILL.md +58 -0
- package/bundled/skills/knowledge-graph/guide.md +69 -0
- package/bundled/skills/logging-guide/SKILL.md +1 -1
- package/bundled/skills/observability-assistant/SKILL.md +1 -1
- package/bundled/skills/orchestrate/SKILL.md +1 -1
- package/bundled/skills/plan/SKILL.md +1 -1
- package/bundled/skills/pr-automation-assistant/SKILL.md +1 -1
- package/bundled/skills/project-structure-guide/SKILL.md +1 -1
- package/bundled/skills/push/SKILL.md +1 -1
- package/bundled/skills/retrospective-assistant/SKILL.md +1 -1
- package/bundled/skills/reverse-engineer/SKILL.md +1 -1
- package/bundled/skills/runbook-assistant/SKILL.md +1 -1
- package/bundled/skills/security-assistant/SKILL.md +1 -1
- package/bundled/skills/security-scan-assistant/SKILL.md +1 -1
- package/bundled/skills/slo-assistant/SKILL.md +1 -1
- package/bundled/skills/sweep/SKILL.md +1 -1
- package/bundled/skills/testing-guide/SKILL.md +1 -1
- package/package.json +2 -2
- package/src/commands/check.js +80 -0
- package/src/commands/init.js +8 -1
- package/src/commands/update.js +49 -14
- package/src/i18n/messages.js +32 -5
- package/src/installers/skills-installer.js +49 -0
- package/src/lint/i18n.js +424 -0
- package/src/utils/config-manager.js +39 -0
- package/src/utils/skills-installer.js +39 -7
- package/standards-registry.json +16 -4
- 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
|
+
引導跨三大支柱的 observability 實作:Logs、Metrics 與 Traces。
|
|
11
|
+
使用時機:建立監控、選擇 metric 類型、實作 tracing、評估成熟度。
|
|
12
|
+
關鍵字:observability, metrics, traces, logs, golden signals, OpenTelemetry, 可觀測性, 監控。
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Observability Assistant
|
|
16
|
+
|
|
17
|
+
> **語言**:[English](../../../../skills/observability-assistant/guide.md) | 繁體中文
|
|
18
|
+
|
|
19
|
+
**版本**:1.0.0
|
|
20
|
+
**最後更新**:2026-04-01
|
|
21
|
+
**適用範圍**:Claude Code Skills
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 用途
|
|
26
|
+
|
|
27
|
+
本 skill 透過提供三大支柱(Logs、Metrics、Traces)、metric 類型選擇、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
|
+
| Skill | 整合點 | 說明 |
|
|
140
|
+
|-------|-------------------|-------------|
|
|
141
|
+
| `/slo` | 以 SLO 為基礎的告警 | 以 metrics 作為 SLI 資料來源;burn rate 告警參照 Golden Signals |
|
|
142
|
+
| `/incident` | 事件診斷 | 三大支柱提供診斷資料;correlation 加速 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. 若未找到,**預設採用標準 observability 實務**
|
|
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/Error Budget
|
|
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
|
+
本 skill 以 [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 | 初始發布(從上游遷移) |
|
|
@@ -3,8 +3,12 @@ name: project-structure-guide
|
|
|
3
3
|
source: ../../../../skills/project-structure-guide/SKILL.md
|
|
4
4
|
source_version: 1.1.0
|
|
5
5
|
translation_version: 1.1.0
|
|
6
|
-
last_synced: 2026-
|
|
6
|
+
last_synced: 2026-05-28
|
|
7
7
|
status: current
|
|
8
|
+
description: |
|
|
9
|
+
[UDS] 引導依語言特性最佳實踐組織專案目錄結構。
|
|
10
|
+
Use when: creating projects, reorganizing structure, adding modules, setting up builds, deciding file placement.
|
|
11
|
+
Keywords: project, structure, directory, layout, gitignore, scaffold, file placement, 專案結構, 目錄配置.
|
|
8
12
|
---
|
|
9
13
|
|
|
10
14
|
# 專案結構指南
|