跳到主要内容

Spec Kit 整合指南

Spec Kit(GitHub 開源)是 Spec-Driven Development 工具,核心理念是「先寫規格再開發」。GST 團隊將 Spec Kit 整合到現有的 Linear + Skills 工作流中。


兩種開發模式

模式適用場景工具
Spec Kit 模式大 Feature(>5 Issues)、重構、新專案Architect + Spec Kit
傳統模式小 Feature(2-5 Issues)、Bug Fix直接開發

架構

角色分工

角色職責Spec Kit 關係
PM協調、追蹤、建 Issue將 tasks.md 轉為 Linear Issues
Architect規格、計畫、任務拆解constitution → specify → plan → tasks
Dev實作程式碼讀 spec + plan 作為開發 context
Project Test端到端功能驗收讀 spec AC → 驗收
ReviewerCode Review對照 constitution + spec 審查

Spec Kit 目錄結構

目標 repo 安裝 Spec Kit 後的結構:

{target-repo}/
├── .specify/
│ ├── init-options.json # 初始化設定
│ ├── memory/
│ │ └── constitution.md # 專案原則(最高權威)
│ ├── templates/ # 模板
│ └── scripts/powershell/ # 輔助腳本
├── specs/
│ └── ###-feature-name/ # 每個 Feature 一個目錄
│ ├── spec.md # 功能規格
│ ├── plan.md # 實作計畫
│ ├── research.md # 研究產出
│ ├── data-model.md # 資料模型
│ ├── tasks.md # 任務清單
│ ├── checklists/ # 品質檢核
│ └── contracts/ # 介面契約
└── .agent/commands/speckit.*.md # Slash Commands

完整工作流

Spec Kit 模式(大 Feature / 重構)

Step 1:  PM 建立 Parent Issue(Linear)
Step 2: PM 指派 Architect Task
Step 3: Architect 在目標 repo 執行 full-cycle
constitution → specify → clarify → plan → tasks → analyze
Step 4: Architect 產出 Handoff Report → PM
Step 5: PM 將 tasks.md 轉為 Linear Sub-Issues(含依賴 + specs/ 引用)
Step 6: Dev 依序取得 Sub-Issue → 讀 spec + plan → 開發
Step 7: Dev 完成 → 產出完成回報(含 spec 覆蓋)
Step 8: Project Test 驗收(有 qa/ 的專案)
Step 9: PM 建立 PR(含 spec 引用 + constitution 合規)
Step 10: Reviewer 審查(對照 constitution + spec 驗收條件)

傳統模式(小 Feature / Bug Fix)

PM 產出開發指令 → Dev 取得任務 → 開發 → 完成回報 → 建 PR → Review
(無 Spec Kit 參與)

GST Constitution 標準原則

所有 GST 專案的 Constitution 以此為基礎(視專案調整):

#原則說明
ILayered ArchitectureCore 與 UI 分離
IIGST Framework First優先使用 GST 底層元件
IIIDependency Injection所有 Service 透過 DI 注入
IVMVVM Strict ComplianceWPF 必須 CommunityToolkit.Mvvm
VTesting RequirementsCore 層關鍵 Service 必須有測試
VINaming Conventions遵循 GST 命名慣例
VIIError HandlingBackgroundService 不可因例外終止
VIIIPerformance Standards明確定義量化指標

重構場景額外原則

原則說明
向後相容重構不可破壞現有功能
漸進式改善每個 Task 完成後系統可建置可運行
測試先行重構前先補測試
Core 優先優先重構可被後續 Phase 重用的層

Spec 文件版控

需 commit:
.specify/memory/constitution.md
specs/{feature-name}/

不需 commit(加 .gitignore):
.specify/templates/
.specify/scripts/
.specify/init-options.json

已知限制

Spec Kit CLI 安裝

specify init 在非互動 shell 會卡住(Rich TUI 相容性問題)。必須在 Windows Terminal PowerShell 中手動執行:

cd {target-repo}
uvx --from "git+https://github.com/github/spec-kit.git" specify init --here --no-git --force

Linear GitHub Automation 設定

必須調整 team 設定,否則建 PR 時 Issue 狀態會被 reset:

設定建議值
On PR or commit openNo action
On PR review requestIn Review
On PR or commit mergeDone
Auto-close parent issues啟用

相關文件