Skip to content

Commit 5a9f849

Browse files
author
薛華慶, james.hsueh
committed
doc: update documents
1 parent ec33cdb commit 5a9f849

File tree

4 files changed

+238
-165
lines changed

4 files changed

+238
-165
lines changed

README.md

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GSI-Protocol(中文)
22

3-
> **Gherkin → 結構 → 實作**
3+
> **Gherkin → 架構 → 實作**
44
>
55
> 一個語言無關的工作流程,使用 AI 代理和 BDD 原則建立可驗證的軟體功能。
66
@@ -12,15 +12,16 @@ GSI-Protocol 是一個 Claude Code 工作流程插件,實作了**規格驅動
1212

1313
### 核心理念
1414

15-
**"規格 → 結構 → 實作"**
15+
**"規格 → 架構 → 實作 → 驗證"**
1616

17-
將業務邏輯、技術架構和程式撰寫分離到不同階段,以最小化 AI 幻覺並最大化精確度。
17+
將業務邏輯、技術架構、程式撰寫和品質保證分離到不同階段,以最小化 AI 幻覺並最大化精確度。
1818

1919
### 主要特性
2020

2121
- 🌍 **語言無關**:支援 Python、TypeScript、Go、Java、Rust、C# 等等
2222
- 🎯 **框架獨立**:不綁定任何特定函式庫或框架
2323
- 📝 **基於 BDD**:使用 Gherkin 撰寫清晰、可測試的規格
24+
- 🏗️ **專案感知**:自動掃描並遵循既有專案架構
2425
-**可驗證**:自動根據規格進行驗證
2526
- 🔄 **模組化**:可獨立執行各階段或完整工作流程
2627

@@ -70,8 +71,8 @@ cd your-project
7071
# 手動模式 - 逐步執行
7172
/sdd-spec Create a shopping cart with add, remove, checkout
7273
/sdd-arch features/shopping_cart.feature
73-
/sdd-impl features/shopping_cart.feature structure/shopping_cart_structure.ts
74-
/sdd-verify features/shopping_cart.feature implementation/shopping_cart_impl.ts
74+
/sdd-impl features/shopping_cart.feature
75+
/sdd-verify features/shopping_cart.feature
7576
```
7677

7778
---
@@ -94,21 +95,21 @@ cd your-project
9495
### 四個階段
9596

9697
```
97-
階段 1:規格(PM)
98+
Phase 1:規格(PM)
9899
99100
Gherkin .feature 檔案
100101
101-
階段 2:結構(架構師)
102+
Phase 2:架構(架構師)
102103
103-
資料模型 + 介面
104+
架構設計文件(繁中 Markdown)
104105
105-
階段 3:實作(工程師)
106+
Phase 3:實作(工程師)
106107
107-
可運行的程式碼
108+
可運行的程式碼(依專案架構)
108109
109-
階段 4:驗證(QA)
110+
Phase 4:驗證(QA)
110111
111-
已驗證功能
112+
驗證結論報告
112113
```
113114

114115
### 指令
@@ -142,34 +143,38 @@ Feature: VIP Discount
142143
Then final price should be 800 USD
143144
```
144145

145-
**階段 2:結構** (`structure/vip_discount_structure.py`)
146-
```python
147-
from dataclasses import dataclass
148-
from enum import Enum
146+
**Phase 2:架構** (`docs/features/vip_discount/architecture.md`)
147+
```markdown
148+
# VIP 折扣系統 - 架構設計
149149

150-
class UserType(str, Enum):
151-
VIP = "VIP"
152-
NORMAL = "NORMAL"
150+
## 1. 專案上下文
151+
- 程式語言:Python
152+
- 架構模式:Service Layer
153153

154-
@dataclass
155-
class DiscountResult:
156-
final_price: float
157-
discount: float
154+
## 3. 資料模型
155+
- UserType(列舉):VIP, NORMAL
156+
- DiscountResult(實體):final_price, discount
157+
158+
## 4. 服務介面
159+
- calculate_discount(amount, user_type) → DiscountResult
158160
```
159161

160-
**階段 3:實作** (`implementation/vip_discount_impl.py`)
162+
**Phase 3:實作** (依 architecture.md 指定位置)
161163
```python
164+
# src/services/discount_service.py
162165
def calculate_discount(amount: float, user_type: UserType) -> DiscountResult:
163166
if user_type == UserType.VIP and amount >= 100:
164167
discount = amount * 0.2
165168
return DiscountResult(amount - discount, discount)
166169
return DiscountResult(amount, 0)
167170
```
168171

169-
**階段 4:驗證**
170-
```
171-
✅ 所有情境通過
172-
✅ 功能完成
172+
**Phase 4:驗證結論** (`docs/features/vip_discount/conclusion.md`)
173+
```markdown
174+
## 3. 摘要
175+
- 架構:2/2 通過
176+
- 情境:2/2 通過
177+
- **狀態:** ✅ 完成
173178
```
174179

175180
---
@@ -261,16 +266,36 @@ type UserService interface {
261266
/sdd-arch features/user_registration.feature
262267

263268
# 工程師:實作
264-
/sdd-impl features/user_registration.feature structure/user_registration_structure.py
269+
/sdd-impl features/user_registration.feature
265270

266271
# QA:驗證
267-
/sdd-verify features/user_registration.feature implementation/user_registration_impl.py
272+
/sdd-verify features/user_registration.feature
268273
```
269274

270275
---
271276

272277
## 📁 專案結構
273278

279+
執行 SDD 工作流程後的輸出:
280+
281+
```
282+
your-project/
283+
├── features/ # Phase 1: Gherkin 規格
284+
│ └── {feature}.feature
285+
├── docs/
286+
│ └── features/
287+
│ └── {feature}/
288+
│ ├── architecture.md # Phase 2: 架構設計(繁中)
289+
│ └── conclusion.md # Phase 4: 驗證結論
290+
└── src/ # Phase 3: 實作程式碼
291+
├── models/ # 依專案既有架構
292+
│ └── {Feature}Model.{ext}
293+
└── services/
294+
└── {Feature}Service.{ext}
295+
```
296+
297+
GSI-Protocol 儲存庫結構:
298+
274299
```
275300
GSI-Protocol/
276301
├── README.md # 本檔案
@@ -279,25 +304,22 @@ GSI-Protocol/
279304
├── install.sh # 安裝腳本
280305
├── .claude/
281306
│ └── commands/ # Claude Code slash 指令
282-
│ ├── gsi-auto.md # 自動工作流程
283-
│ ├── gsi-spec.md # 階段 1
284-
│ ├── gsi-arch.md # 階段 2
285-
│ ├── gsi-impl.md # 階段 3
286-
│ └── gsi-verify.md # 階段 4
307+
│ ├── sdd-auto.md # 自動工作流程
308+
│ ├── sdd-spec.md # Phase 1
309+
│ ├── sdd-arch.md # Phase 2
310+
│ ├── sdd-impl.md # Phase 3
311+
│ └── sdd-verify.md # Phase 4
287312
├── docs/ # 文件
288313
│ ├── QUICKSTART.md # 快速入門指南
289314
│ ├── INSTALL.md # 安裝指南
290315
│ ├── COMMANDS.md # 指令參考
291316
│ ├── LANGUAGE_GUIDE.md # 語言支援
292317
│ └── expected_workflow.md # 工作流程細節
293-
├── prompts/ # 代理提示
294-
│ ├── pm_agent.md
295-
│ ├── architect_agent.md
296-
│ ├── engineer_agent.md
297-
│ └── qa_agent.md
298-
└── examples/ # 實作範例
299-
├── referral_bonus/ # Python 範例
300-
└── vip_discount_typescript/ # TypeScript 範例
318+
└── prompts/ # 代理提示(參考)
319+
├── pm_agent.md
320+
├── architect_agent.md
321+
├── engineer_agent.md
322+
└── qa_agent.md
301323
```
302324

303325
---

docs/COMMANDS.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
## 指令概覽
66

77
```
8-
/sdd-auto → 自動模式:自動執行全部 4 個階段
9-
/sdd-spec → 階段 1:生成 Gherkin 規格
10-
/sdd-arch → 階段 2:設計資料模型與介面
11-
/sdd-impl → 階段 3:實作邏輯
12-
/sdd-verify → 階段 4:驗證實作
8+
/sdd-auto → 自動模式:自動執行全部 4 個 Phase
9+
/sdd-spec → Phase 1:生成 Gherkin 規格
10+
/sdd-arch → Phase 2:設計架構(繁中文件)
11+
/sdd-impl → Phase 3:實作邏輯
12+
/sdd-verify → Phase 4:驗證實作
1313
```
1414

1515
---
@@ -33,10 +33,10 @@
3333
```
3434

3535
**它會做什麼:**
36-
1. ✅ 生成 Gherkin 規格(階段 1)
37-
2.設計資料模型和介面(階段 2)
38-
3.實作邏輯(階段 3)
39-
4.根據規格驗證(階段 4)
36+
1. ✅ 生成 Gherkin 規格(Phase 1)
37+
2.設計架構文件(Phase 2)
38+
3.實作程式碼(Phase 3)
39+
4.驗證並生成結論(Phase 4)
4040

4141
**何時使用:**
4242
- ✅ 快速原型製作
@@ -53,7 +53,7 @@
5353

5454
---
5555

56-
## `/sdd-spec` - 階段 1:規格
56+
## `/sdd-spec` - Phase 1:規格
5757

5858
**目的:** 從自然語言需求生成 Gherkin 規格。
5959

@@ -80,9 +80,9 @@
8080

8181
---
8282

83-
## `/sdd-arch` - 階段 2:架構
83+
## `/sdd-arch` - Phase 2:架構
8484

85-
**目的:** 從 Gherkin 規格設計資料模型和服務介面
85+
**目的:** 從 Gherkin 規格設計語言無關的架構文件
8686

8787
**用法:**
8888
```bash
@@ -95,69 +95,70 @@
9595
```
9696

9797
**輸出:**
98-
- 建立 `structure/<feature>_structure.<ext>`(語言特定)
98+
- 建立 `docs/features/<feature>/architecture.md`(繁體中文 Markdown)
99+
- 掃描專案上下文(技術棧、架構、命名慣例)
99100
- 定義資料模型(從 Gherkin 中的名詞)
100101
- 定義服務介面(從 Gherkin 中的動詞)
101-
- 無實作邏輯,只有結構
102+
- 語言無關的高階設計
102103

103104
**何時使用:**
104-
-完成階段 1 後
105+
-完成 Phase 1 後
105106
- ✅ 您想審查技術架構
106107
- ✅ 需要與團隊驗證資料模型
107-
-想確保結構與系統設計一致
108+
-想確保架構與系統設計一致
108109

109110
---
110111

111-
## `/sdd-impl` - 階段 3:實作
112+
## `/sdd-impl` - Phase 3:實作
112113

113-
**目的:** 在定義的結構內實作邏輯以滿足 Gherkin 情境
114+
**目的:** 根據架構文件實作程式碼
114115

115116
**用法:**
116117
```bash
117-
/sdd-impl <.feature 檔案路徑> <結構檔案路徑>
118+
/sdd-impl <.feature 檔案路徑>
118119
```
119120

120121
**範例:**
121122
```bash
122-
/sdd-impl features/user_authentication.feature structure/user_authentication_structure.py
123+
/sdd-impl features/user_authentication.feature
123124
```
124125

125126
**輸出:**
126-
- 建立 `implementation/<feature>_impl.<ext>`(語言特定
127-
- 實作階段 2 的所有介面
127+
- 實作檔案放置於專案既有目錄結構(依 architecture.md 定義
128+
- 實作所有定義的資料模型與服務介面
128129
- 將每個 Gherkin 情境對應到程式碼邏輯
129-
- 包含基本自我驗證
130+
- 遵循專案技術棧與命名慣例
130131

131132
**何時使用:**
132-
-完成階段 2 後
133-
-結構已審查並批准
133+
-完成 Phase 2 後
134+
-架構已審查並批准
134135
- ✅ 準備好撰寫實際業務邏輯
135136
- ✅ 想看到可運作的程式碼
136137

137138
---
138139

139-
## `/sdd-verify` - 階段 4:驗證
140+
## `/sdd-verify` - Phase 4:驗證
140141

141-
**目的:** 根據 Gherkin 規格驗證實作
142+
**目的:** 根據 Gherkin 規格與架構設計驗證實作
142143

143144
**用法:**
144145
```bash
145-
/sdd-verify <.feature 檔案路徑> <實作檔案路徑>
146+
/sdd-verify <.feature 檔案路徑>
146147
```
147148

148149
**範例:**
149150
```bash
150-
/sdd-verify features/user_authentication.feature implementation/user_authentication_impl.py
151+
/sdd-verify features/user_authentication.feature
151152
```
152153

153154
**輸出:**
154-
- 建立 `verification/<feature>_verification_report.md`
155-
- 測試每個 Gherkin 情境
156-
- 報告通過/失敗並附證據
157-
- 為失敗提供回饋
155+
- 建立 `docs/features/<feature>/conclusion.md`
156+
- 驗證架構符合性(資料模型、服務介面、檔案結構)
157+
- 驗證每個 Gherkin 情境
158+
- 提供通過/失敗報告與改善建議
158159

159160
**何時使用:**
160-
-完成階段 3 後
161+
-完成 Phase 3 後
161162
- ✅ 提交程式碼前
162163
- ✅ 需要正式驗證報告
163164
- ✅ 想確保涵蓋所有情境

0 commit comments

Comments
 (0)